// File: /workspace/github_cpp_makefile_star2_O1/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 0xb733(%rip), %r12      # 0x16136
movl $0x21c, %r13d           # imm = 0x21C
testq %r14, %r14
je 0xab52
cmpb $0x67, 0x9(%r14)
je 0xaae6
movl 0x20(%r14), %eax
cmpl $0xf, %eax
ja 0xaae6
btl %eax, %r13d
jae 0xaa56
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0xaad0
cmpl $0x6f, %eax
jne 0xaaa6
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb655(%rip), %rsi      # 0x160a6
jmp 0xaadd
movl $0x8802, %ecx           # imm = 0x8802
btl %eax, %ecx
jae 0xaae6
movq 0x10(%r14), %rdi
callq 0x608e
testb %al, %al
je 0xaae6
movzbl 0x8(%r14), %eax
cmpl $0x62, %eax
je 0xaa89
cmpl $0x6f, %eax
je 0xab35
cmpl $0x69, %eax
jne 0xaae6
movl (%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb64d(%rip), %rsi      # 0x160e7
movl %edx, %r8d
xorl %eax, %eax
callq 0x3270
jmp 0xaae6
movq 0x10(%r14), %rbx
movq %rbx, %rdi
leaq 0x2ffc(%rip), %rsi      # 0xdab0
callq 0x3260
testl %eax, %eax
je 0xaae6
movq %rbx, %rdi
leaq 0x2ff0(%rip), %rsi      # 0xdab7
callq 0x3260
testl %eax, %eax
je 0xaae6
movl (%r14), %ecx
movq %r15, %rdi
leaq 0xb5ea(%rip), %rsi      # 0x160c7
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
cmpb $0x67, 0x9(%r14)
jne 0xab2c
movzbl 0x8(%r14), %eax
cmpl $0x69, %eax
je 0xaafc
cmpl $0x62, %eax
jne 0xab0e
movl (%r14), %ecx
movq %r15, %rdi
movq %r12, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
cmpb $0x6f, 0x8(%r14)
jne 0xab2c
movl 0x4(%r14), %ecx
movq %r15, %rdi
leaq 0xb657(%rip), %rsi      # 0x1617a
movl %ecx, %edx
xorl %eax, %eax
callq 0x3270
movq 0x30(%r14), %r14
jmp 0xaa09
cmpb $0x0, -0x2c(%rbp)
jne 0xaae6
movl 0x4(%r14), %edx
movq 0x10(%r14), %rcx
movq %r15, %rdi
leaq 0xb5c1(%rip), %rsi      # 0x1610e
jmp 0xaa9a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq