// File: /workspace/github_cpp_makefile_star2_O3/zgimbutas[P]mwrap/src/mwrap-cgen.cc
// Function: mex_dealloc(_IO_FILE*, Var*, bool)
void mex_dealloc(FILE* fp, Var* v, bool return_flag)
{
    if (!v)
        return;

    if (v->devicespec != 'g'){
    if (is_array(v->tinfo) || v->tinfo == VT_string) {
        if (v->iospec == 'o')
            fprintf(fp, "    if (out%d_) mxFree(out%d_);\n",
                    v->output_label, v->output_label);
        else if (v->iospec == 'b' || !(strcmp(v->basetype, "double") == 0 || strcmp(v->basetype, "float") == 0) )
            fprintf(fp, "    if (in%d_)  mxFree(in%d_);\n",
                    v->input_label, v->input_label);
    } else if (is_obj(v->tinfo) && is_mxarray_type(v->basetype)) {
        if (v->iospec == 'i' || v->iospec == 'b')
            fprintf(fp, "    if (in%d_)  mxWrapFree_%s(in%d_);\n",
                    v->input_label, v->basetype, v->input_label);
        else if (v->iospec == 'o' && !return_flag)
            fprintf(fp, "    if (out%d_) mxWrapFree_%s(out%d_);\n",
                    v->output_label, v->basetype, v->output_label);
    }
    }
    if (v->devicespec == 'g'){
        if (v->iospec == 'i' || v->iospec == 'b'){
            fprintf(fp, "    if (mxGPUArray_in%d_)  mxGPUDestroyGPUArray(mxGPUArray_in%d_);\n",
                    v->input_label, v->input_label);
        }
        if (v->iospec == 'o'){
            fprintf(fp, "    if (mxGPUArray_out%d_)  mxGPUDestroyGPUArray(mxGPUArray_out%d_);\n",
                    v->output_label, v->output_label);
        }
    }

    mex_dealloc(fp, v->next, return_flag);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, -0x2c(%rbp)
testq %rsi, %rsi
je 0xaa64
movq %rsi, %r14
movq %rdi, %r15
leaq 0xb7ff(%rip), %r12      # 0x16116
movl $0x21c, %r13d           # imm = 0x21C
cmpb $0x67, 0x9(%r14)
je 0xa9f8
movl 0x20(%r14), %eax
cmpl $0xf, %eax
ja 0xaa38
btl %eax, %r13d
jae 0xa961
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0xa9db
cmpl $0x6f, %eax
jne 0xa9b1
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb72a(%rip), %rsi      # 0x16086
jmp 0xa9e8
movl $0x8802, %ecx           # imm = 0x8802
btl %eax, %ecx
jae 0xaa38
movq 0x10(%r14), %rdi
callq 0x5f6f
testb %al, %al
je 0xa9f1
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0xa994
cmpl $0x6f, %eax
je 0xaa47
cmpl $0x69, %eax
jne 0xa9f1
movl (%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb722(%rip), %rsi      # 0x160c7
movl %edx, %r8d
xorl %eax, %eax
callq 0x3270
jmp 0xa9f1
movq 0x10(%r14), %rbx
movq %rbx, %rdi
leaq 0x30e9(%rip), %rsi      # 0xdaa8
callq 0x3260
testl %eax, %eax
je 0xa9f1
movq %rbx, %rdi
leaq 0x30dd(%rip), %rsi      # 0xdaaf
callq 0x3260
testl %eax, %eax
je 0xa9f1
movl (%r14), %ecx
movq %r15, %rdi
leaq 0xb6bf(%rip), %rsi      # 0x160a7
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
cmpb $0x67, 0x9(%r14)
jne 0xaa38
movzbl 0x8(%r14), %eax
cmpl $0x69, %eax
je 0xaa07
cmpl $0x62, %eax
jne 0xaa1d
movl (%r14), %ecx
movq %r15, %rdi
movq %r12, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
movb 0x8(%r14), %al
cmpb $0x6f, %al
jne 0xaa38
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb72b(%rip), %rsi      # 0x1615a
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
movq 0x30(%r14), %r14
testq %r14, %r14
jne 0xa91d
jmp 0xaa64
cmpb $0x0, -0x2c(%rbp)
jne 0xa9f1
movl 0x4(%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb68f(%rip), %rsi      # 0x160ee
jmp 0xa9a5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq