﻿namespace GCCSharp
{
    using System;
    using System.Runtime.InteropServices;

    public partial struct GCCJITContextRef
    {
        public GCCJITContextRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITResultRef
    {
        public GCCJITResultRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITObjectRef
    {
        public GCCJITObjectRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITLocationRef
    {
        public GCCJITLocationRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITTypeRef
    {
        public GCCJITTypeRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITFieldRef
    {
        public GCCJITFieldRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITStructRef
    {
        public GCCJITStructRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITFunctionRef
    {
        public GCCJITFunctionRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITBlockRef
    {
        public GCCJITBlockRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITRValueRef
    {
        public GCCJITRValueRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITLValueRef
    {
        public GCCJITLValueRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public partial struct GCCJITParamRef
    {
        public GCCJITParamRef(IntPtr pointer)
        {
            this.Pointer = pointer;
        }

        public readonly IntPtr Pointer;
    }

    public enum GCC_JIT_STR_OPTION
    {
        @GCC_JIT_STR_OPTION_PROGNAME = 0,
        @GCC_JIT_NUM_STR_OPTIONS = 1,
    }

    public enum GCC_JIT_INT_OPTION
    {
        @GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL = 0,
        @GCC_JIT_NUM_INT_OPTIONS = 1,
    }

    public enum GCC_JIT_BOOL_OPTION
    {
        @GCC_JIT_BOOL_OPTION_DEBUGINFO = 0,
        @GCC_JIT_BOOL_OPTION_DUMP_INITIAL_TREE = 1,
        @GCC_JIT_BOOL_OPTION_DUMP_INITIAL_GIMPLE = 2,
        @GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE = 3,
        @GCC_JIT_BOOL_OPTION_DUMP_SUMMARY = 4,
        @GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING = 5,
        @GCC_JIT_BOOL_OPTION_SELFCHECK_GC = 6,
        @GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES = 7,
        @GCC_JIT_NUM_BOOL_OPTIONS = 8,
    }

    public enum GCC_JIT_OUTPUT_KIND
    {
        @GCC_JIT_OUTPUT_KIND_ASSEMBLER = 0,
        @GCC_JIT_OUTPUT_KIND_OBJECT_FILE = 1,
        @GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY = 2,
        @GCC_JIT_OUTPUT_KIND_EXECUTABLE = 3,
    }

    public enum GCC_JIT_TYPES
    {
        @GCC_JIT_TYPE_VOID = 0,
        @GCC_JIT_TYPE_VOID_PTR = 1,
        @GCC_JIT_TYPE_BOOL = 2,
        @GCC_JIT_TYPE_CHAR = 3,
        @GCC_JIT_TYPE_SIGNED_CHAR = 4,
        @GCC_JIT_TYPE_UNSIGNED_CHAR = 5,
        @GCC_JIT_TYPE_SHORT = 6,
        @GCC_JIT_TYPE_UNSIGNED_SHORT = 7,
        @GCC_JIT_TYPE_INT = 8,
        @GCC_JIT_TYPE_UNSIGNED_INT = 9,
        @GCC_JIT_TYPE_LONG = 10,
        @GCC_JIT_TYPE_UNSIGNED_LONG = 11,
        @GCC_JIT_TYPE_LONG_LONG = 12,
        @GCC_JIT_TYPE_UNSIGNED_LONG_LONG = 13,
        @GCC_JIT_TYPE_FLOAT = 14,
        @GCC_JIT_TYPE_DOUBLE = 15,
        @GCC_JIT_TYPE_LONG_DOUBLE = 16,
        @GCC_JIT_TYPE_CONST_CHAR_PTR = 17,
        @GCC_JIT_TYPE_SIZE_T = 18,
        @GCC_JIT_TYPE_FILE_PTR = 19,
        @GCC_JIT_TYPE_COMPLEX_FLOAT = 20,
        @GCC_JIT_TYPE_COMPLEX_DOUBLE = 21,
        @GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE = 22,
    }

    public enum GCC_JIT_FUNCTION_KIND
    {
        @GCC_JIT_FUNCTION_EXPORTED = 0,
        @GCC_JIT_FUNCTION_INTERNAL = 1,
        @GCC_JIT_FUNCTION_IMPORTED = 2,
        @GCC_JIT_FUNCTION_ALWAYS_INLINE = 3,
    }

    public enum GCC_JIT_GLOBAL_KIND
    {
        @GCC_JIT_GLOBAL_EXPORTED = 0,
        @GCC_JIT_GLOBAL_INTERNAL = 1,
        @GCC_JIT_GLOBAL_IMPORTED = 2,
    }

    public enum GCC_JIT_UNARY_OP
    {
        @GCC_JIT_UNARY_OP_MINUS = 0,
        @GCC_JIT_UNARY_OP_BITWISE_NEGATE = 1,
        @GCC_JIT_UNARY_OP_LOGICAL_NEGATE = 2,
        @GCC_JIT_UNARY_OP_ABS = 3,
    }

    public enum GCC_JIT_BINARY_OP
    {
        @GCC_JIT_BINARY_OP_PLUS = 0,
        @GCC_JIT_BINARY_OP_MINUS = 1,
        @GCC_JIT_BINARY_OP_MULT = 2,
        @GCC_JIT_BINARY_OP_DIVIDE = 3,
        @GCC_JIT_BINARY_OP_MODULO = 4,
        @GCC_JIT_BINARY_OP_BITWISE_AND = 5,
        @GCC_JIT_BINARY_OP_BITWISE_XOR = 6,
        @GCC_JIT_BINARY_OP_BITWISE_OR = 7,
        @GCC_JIT_BINARY_OP_LOGICAL_AND = 8,
        @GCC_JIT_BINARY_OP_LOGICAL_OR = 9,
        @GCC_JIT_BINARY_OP_LSHIFT = 10,
        @GCC_JIT_BINARY_OP_RSHIFT = 11,
    }

    public enum GCC_JIT_COMPARISON
    {
        @GCC_JIT_COMPARISON_EQ = 0,
        @GCC_JIT_COMPARISON_NE = 1,
        @GCC_JIT_COMPARISON_LT = 2,
        @GCC_JIT_COMPARISON_LE = 3,
        @GCC_JIT_COMPARISON_GT = 4,
        @GCC_JIT_COMPARISON_GE = 5,
    }

    public static partial class GCC
    {
        private const string libraryPath = "libgccjit";

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_acquire", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITContextRef JITContextAcquire();

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_release", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextRelease(GCCJITContextRef @ctxt);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_set_str_option", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextSetStrOption(GCCJITContextRef @ctxt, GCC_JIT_STR_OPTION @opt, [MarshalAs(UnmanagedType.LPStr)] string @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_set_int_option", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextSetIntOption(GCCJITContextRef @ctxt, GCC_JIT_INT_OPTION @opt, int @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_set_bool_option", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextSetBoolOption(GCCJITContextRef @ctxt, GCC_JIT_BOOL_OPTION @opt, int @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_compile", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITResultRef JITContextCompile(GCCJITContextRef @ctxt);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_compile_to_file", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextCompileToFile(GCCJITContextRef @ctxt, GCC_JIT_OUTPUT_KIND @output_kind, [MarshalAs(UnmanagedType.LPStr)] string @output_path);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_dump_to_file", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextDumpToFile(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @path, int @update_locations);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_set_logfile", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextSetLogfile(GCCJITContextRef @ctxt, IntPtr @logfile, int @flags, int @verbosity);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_get_first_error", CallingConvention = CallingConvention.Cdecl)]
        public static extern string JITContextGetFirstError(GCCJITContextRef @ctxt);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_get_last_error", CallingConvention = CallingConvention.Cdecl)]
        public static extern string JITContextGetLastError(GCCJITContextRef @ctxt);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_result_get_code", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr JITResultGetCode(GCCJITResultRef @result, [MarshalAs(UnmanagedType.LPStr)] string @funcname);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_result_get_global", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr JITResultGetGlobal(GCCJITResultRef @result, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_result_release", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITResultRelease(GCCJITResultRef @result);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_object_get_context", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITContextRef JITObjectGetContext(GCCJITObjectRef @obj);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_object_get_debug_string", CallingConvention = CallingConvention.Cdecl)]
        public static extern string JITObjectGetDebugString(GCCJITObjectRef @obj);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_location", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLocationRef JITContextNewLocation(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @filename, int @line, int @column);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_location_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITLocationAsObject(GCCJITLocationRef @loc);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_type_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITTypeAsObject(GCCJITTypeRef @type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_get_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITContextGetType(GCCJITContextRef @ctxt, GCC_JIT_TYPES @type_);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_get_int_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITContextGetIntType(GCCJITContextRef @ctxt, int @num_bytes, int @is_signed);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_type_get_pointer", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITTypeGetPointer(GCCJITTypeRef @type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_type_get_const", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITTypeGetConst(GCCJITTypeRef @type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_type_get_volatile", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITTypeGetVolatile(GCCJITTypeRef @type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_array_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITContextNewArrayType(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITTypeRef @element_type, int @num_elements);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_field", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITFieldRef JITContextNewField(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITTypeRef @type, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_field_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITFieldAsObject(GCCJITFieldRef @field);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_struct_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITStructRef JITContextNewStructType(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, [MarshalAs(UnmanagedType.LPStr)] string @name, int @num_fields, out GCCJITFieldRef @fields);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_opaque_struct", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITStructRef JITContextNewOpaqueStruct(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_struct_as_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITStructAsType(GCCJITStructRef @struct_type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_struct_set_fields", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITStructSetFields(GCCJITStructRef @struct_type, GCCJITLocationRef @loc, int @num_fields, out GCCJITFieldRef @fields);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_union_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITContextNewUnionType(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, [MarshalAs(UnmanagedType.LPStr)] string @name, int @num_fields, out GCCJITFieldRef @fields);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_function_ptr_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITContextNewFunctionPtrType(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITTypeRef @return_type, int @num_params, out GCCJITTypeRef @param_types, int @is_variadic);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_param", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITParamRef JITContextNewParam(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITTypeRef @type, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_param_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITParamAsObject(GCCJITParamRef @param);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_param_as_lvalue", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITParamAsLValue(GCCJITParamRef @param);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_param_as_rvalue", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITParamAsRValue(GCCJITParamRef @param);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_function", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITFunctionRef JITContextNewFunction(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCC_JIT_FUNCTION_KIND @kind, GCCJITTypeRef @return_type, [MarshalAs(UnmanagedType.LPStr)] string @name, int @num_params, out GCCJITParamRef @params, int @is_variadic);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_get_builtin_function", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITFunctionRef JITContextGetBuiltinFunction(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_function_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITFunctionAsObject(GCCJITFunctionRef @func);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_function_get_param", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITParamRef JITFunctionGetParam(GCCJITFunctionRef @func, int @index);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_function_dump_to_dot", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITFunctionDumpToDot(GCCJITFunctionRef @func, [MarshalAs(UnmanagedType.LPStr)] string @path);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_function_new_block", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITBlockRef JITFunctionNewBlock(GCCJITFunctionRef @func, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITBlockAsObject(GCCJITBlockRef @block);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_get_function", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITFunctionRef JITBlockGetFunction(GCCJITBlockRef @block);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_global", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITContextNewGlobal(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCC_JIT_GLOBAL_KIND @kind, GCCJITTypeRef @type, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_lvalue_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITLValueAsObject(GCCJITLValueRef @lvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_lvalue_as_rvalue", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITLValueAsRValue(GCCJITLValueRef @lvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_rvalue_as_object", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITObjectRef JITRValueAsObject(GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_rvalue_get_type", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITTypeRef JITRValueGetType(GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_rvalue_from_int", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewRValueFromInt(GCCJITContextRef @ctxt, GCCJITTypeRef @numeric_type, int @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_rvalue_from_long", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewRValueFromLong(GCCJITContextRef @ctxt, GCCJITTypeRef @numeric_type, int @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_zero", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextZero(GCCJITContextRef @ctxt, GCCJITTypeRef @numeric_type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_one", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextOne(GCCJITContextRef @ctxt, GCCJITTypeRef @numeric_type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_rvalue_from_double", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewRValueFromDouble(GCCJITContextRef @ctxt, GCCJITTypeRef @numeric_type, double @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_rvalue_from_ptr", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewRValueFromPtr(GCCJITContextRef @ctxt, GCCJITTypeRef @pointer_type, IntPtr @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_null", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNull(GCCJITContextRef @ctxt, GCCJITTypeRef @pointer_type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_string_literal", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewStringLiteral(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @value);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_unary_op", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewUnaryOp(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCC_JIT_UNARY_OP @op, GCCJITTypeRef @result_type, GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_binary_op", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewBinaryOp(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCC_JIT_BINARY_OP @op, GCCJITTypeRef @result_type, GCCJITRValueRef @a, GCCJITRValueRef @b);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_comparison", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewComparison(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCC_JIT_COMPARISON @op, GCCJITRValueRef @a, GCCJITRValueRef @b);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_call", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewCall(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITFunctionRef @func, int @numargs, out GCCJITRValueRef @args);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_call_through_ptr", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewCallThroughPtr(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITRValueRef @fn_ptr, int @numargs, out GCCJITRValueRef @args);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_cast", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITContextNewCast(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITRValueRef @rvalue, GCCJITTypeRef @type);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_array_access", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITContextNewArrayAccess(GCCJITContextRef @ctxt, GCCJITLocationRef @loc, GCCJITRValueRef @ptr, GCCJITRValueRef @index);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_lvalue_access_field", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITLValueAccessField(GCCJITLValueRef @struct_or_union, GCCJITLocationRef @loc, GCCJITFieldRef @field);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_rvalue_access_field", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITRValueAccessField(GCCJITRValueRef @struct_or_union, GCCJITLocationRef @loc, GCCJITFieldRef @field);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_rvalue_dereference_field", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITRValueDereferenceField(GCCJITRValueRef @ptr, GCCJITLocationRef @loc, GCCJITFieldRef @field);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_rvalue_dereference", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITRValueDereference(GCCJITRValueRef @rvalue, GCCJITLocationRef @loc);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_lvalue_get_address", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITRValueRef JITLValueGetAddress(GCCJITLValueRef @lvalue, GCCJITLocationRef @loc);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_function_new_local", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITLValueRef JITFunctionNewLocal(GCCJITFunctionRef @func, GCCJITLocationRef @loc, GCCJITTypeRef @type, [MarshalAs(UnmanagedType.LPStr)] string @name);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_add_eval", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockAddEval(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_add_assignment", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockAddAssignment(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITLValueRef @lvalue, GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_add_assignment_op", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockAddAssignmentOp(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITLValueRef @lvalue, GCC_JIT_BINARY_OP @op, GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_add_comment", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockAddComment(GCCJITBlockRef @block, GCCJITLocationRef @loc, [MarshalAs(UnmanagedType.LPStr)] string @text);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_end_with_conditional", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockEndWithConditional(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITRValueRef @boolval, GCCJITBlockRef @on_true, GCCJITBlockRef @on_false);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_end_with_jump", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockEndWithJump(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITBlockRef @target);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_end_with_return", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockEndWithReturn(GCCJITBlockRef @block, GCCJITLocationRef @loc, GCCJITRValueRef @rvalue);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_block_end_with_void_return", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITBlockEndWithVoidReturn(GCCJITBlockRef @block, GCCJITLocationRef @loc);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_new_child_context", CallingConvention = CallingConvention.Cdecl)]
        public static extern GCCJITContextRef JITContextNewChildContext(GCCJITContextRef @parent_ctxt);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_dump_reproducer_to_file", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextDumpReproducerToFile(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @path);

        [DllImport(libraryPath, EntryPoint = "gcc_jit_context_enable_dump", CallingConvention = CallingConvention.Cdecl)]
        public static extern void JITContextEnableDump(GCCJITContextRef @ctxt, [MarshalAs(UnmanagedType.LPStr)] string @dumpname, out IntPtr @out_ptr);
    }
}