{%- if proxy.return_plan.is_void() %}
            Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
{%- elif proxy.return_plan.is_direct() %}
            return Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
{%- elif proxy.return_plan.is_c_style_enum() %}
            return {{ proxy.return_plan.c_style_enum_class() }}.fromValue(Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %}));
{%- elif proxy.return_plan.is_handle() %}
            long _handle = Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
{%- if proxy.return_plan.handle_nullable() %}
            if (_handle == 0L) return null;
{%- endif %}
            return new {{ proxy.return_plan.handle_class() }}(_handle);
{%- elif proxy.return_plan.is_callback() %}
            long _handle = Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
{%- if proxy.return_plan.callback_nullable() %}
            if (_handle == 0L) return null;
{%- endif %}
            return {{ proxy.return_plan.callback_bridge_class() }}.wrap(_handle);
{%- elif proxy.return_plan.is_decode() %}
            byte[] _buf = Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
            if (_buf == null) throw new RuntimeException("FFI call returned null buffer");
            WireReader reader = new WireReader(_buf);
            return {{ proxy.return_plan.decode_expr() }};
{%- elif proxy.return_plan.is_result() %}
            byte[] _buf = Native.{{ proxy.native_name }}({{ handle_name }}{% if !proxy.params.is_empty() %}, {% endif %}{% for param in proxy.params %}{{ param.native_expr }}{% if !loop.last %}, {% endif %}{% endfor %});
            if (_buf == null) throw new RuntimeException("FFI call returned null buffer");
            WireReader reader = new WireReader(_buf);
            if (reader.readI8() != 0) {
{%- if proxy.return_plan.result_err_throws_directly() %}
                throw {{ proxy.return_plan.result_err_decode() }};
{%- elif proxy.return_plan.result_has_typed_exception() %}
                throw new {{ proxy.return_plan.result_err_exception_class() }}({{ proxy.return_plan.result_err_decode() }});
{%- elif proxy.return_plan.result_err_is_string() %}
                throw new RuntimeException({{ proxy.return_plan.result_err_decode() }});
{%- else %}
                throw new RuntimeException(String.valueOf({{ proxy.return_plan.result_err_decode() }}));
{%- endif %}
            }
{%- if proxy.return_type == "void" %}
{%- else %}
            return {{ proxy.return_plan.result_ok_decode() }};
{%- endif %}
{%- endif %}
