// File: /workspace/github_cpp_makefile_star2_O2/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)
movq %rsi, %r14
movq %rdi, %r15
leaq 0xb3c7(%rip), %r12      # 0x15116
movl $0x21c, %r13d           # imm = 0x21C
testq %r14, %r14
je 0x9e9f
cmpb $0x67, 0x9(%r14)
je 0x9e39
movl 0x20(%r14), %eax
cmpl $0xf, %eax
ja 0x9e79
btl %eax, %r13d
jae 0x9da2
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0x9e1c
cmpl $0x6f, %eax
jne 0x9df2
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb2e9(%rip), %rsi      # 0x15086
jmp 0x9e29
movl $0x8802, %ecx           # imm = 0x8802
btl %eax, %ecx
jae 0x9e79
movq 0x10(%r14), %rdi
callq 0x5781
testb %al, %al
je 0x9e32
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0x9dd5
cmpl $0x6f, %eax
je 0x9e82
cmpl $0x69, %eax
jne 0x9e32
movl (%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb2e1(%rip), %rsi      # 0x150c7
movl %edx, %r8d
xorl %eax, %eax
callq 0x32b0
jmp 0x9e32
movq 0x10(%r14), %rbx
movq %rbx, %rdi
leaq 0x2c80(%rip), %rsi      # 0xca80
callq 0x32a0
testl %eax, %eax
je 0x9e32
movq %rbx, %rdi
leaq 0x2c74(%rip), %rsi      # 0xca87
callq 0x32a0
testl %eax, %eax
je 0x9e32
movl (%r14), %ecx
movq %r15, %rdi
leaq 0xb27e(%rip), %rsi      # 0x150a7
movl %ecx, %edx
xorl %eax, %eax
callq 0x32b0
cmpb $0x67, 0x9(%r14)
jne 0x9e79
movzbl 0x8(%r14), %eax
cmpl $0x69, %eax
je 0x9e48
cmpl $0x62, %eax
jne 0x9e5e
movl (%r14), %ecx
movq %r15, %rdi
movq %r12, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x32b0
movb 0x8(%r14), %al
cmpb $0x6f, %al
jne 0x9e79
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb2ea(%rip), %rsi      # 0x1515a
movl %ecx, %edx
xorl %eax, %eax
callq 0x32b0
movq 0x30(%r14), %r14
jmp 0x9d55
cmpb $0x0, -0x2c(%rbp)
jne 0x9e32
movl 0x4(%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb254(%rip), %rsi      # 0x150ee
jmp 0x9de6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq