// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxUnixAZ.c
// Function: Hax_UnixCoreDelete
void
Hax_UnixCoreDelete(
    Hax_Interp *interp,
    ClientData clientData)
{
    Hax_Memoryp *memoryp;
    UnixClientData *clientDataPtr;
    int i;

    clientDataPtr = (UnixClientData *)clientData;
    clientDataPtr->refCount--;

    if (clientDataPtr->refCount > 0)
	return;

    memoryp = Hax_GetMemoryp(interp);

    if (clientDataPtr->numFiles > 0) {
	for (i = 0; i < clientDataPtr->numFiles; i++) {
	    OpenFile *filePtr;

	    filePtr = clientDataPtr->filePtrArray[i];
	    if (filePtr == NULL) {
		continue;
	    }
	    if (i >= 3) {
		fclose(filePtr->f);
		if (filePtr->f2 != NULL) {
		    fclose(filePtr->f2);
		}
		if (filePtr->numPids > 0) {
		    Hax_DetachPids(clientData, filePtr->numPids,
			filePtr->pidPtr);
		    ckfree(memoryp, (char *) filePtr->pidPtr);
		}
	    }
	    ckfree(memoryp, (char *) filePtr);
	}
	ckfree(memoryp, (char *) clientDataPtr->filePtrArray);
    }

    if (clientDataPtr->currentDir != NULL) {
	ckfree(memoryp, clientDataPtr->currentDir);
    }

    if (clientDataPtr->curBuf != clientDataPtr->staticBuf) {
	ckfree(memoryp, clientDataPtr->curBuf);
    }

    if (clientDataPtr->haxEnviron != NULL) {
	for (i = 0; i < clientDataPtr->environSize; i++) {
	    /* The last allocated entry is divided by NULL */
	    if (clientDataPtr->haxEnviron[i] == NULL) {
		break;
	    }
	    ckfree(memoryp, clientDataPtr->haxEnviron[i]);
	}
	ckfree(memoryp, clientDataPtr->haxEnviron);
    }

    if (clientDataPtr->waitTable != NULL) {
	ckfree(memoryp, clientDataPtr->waitTable);
    }

    ckfree(memoryp, (char *) clientDataPtr);
}

// Assembly:
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jle 0x6a12
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
callq 0x3540
movq %rax, %r14
movl (%rbx), %eax
testl %eax, %eax
jle 0x6ac8
xorl %r13d, %r13d
leaq 0x185e(%rip), %r15      # 0x8298
movq 0x8(%rbx), %rcx
movq (%rcx,%r13,8), %r12
testq %r12, %r12
je 0x6aa5
cmpq $0x3, %r13
jb 0x6a90
movq (%r12), %rdi
callq 0x3160
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x6a65
callq 0x3160
movl 0x18(%r12), %esi
testl %esi, %esi
jle 0x6a90
movq 0x20(%r12), %rdx
movq %rbx, %rdi
callq 0x32b0
movq 0x20(%r12), %rsi
movq %r14, %rdi
movq %r15, %rdx
movl $0x721, %ecx            # imm = 0x721
callq 0x31f0
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl $0x724, %ecx            # imm = 0x724
callq 0x31f0
movl (%rbx), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x6a3a
movq 0x8(%rbx), %rsi
leaq 0x17dd(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x726, %ecx            # imm = 0x726
callq 0x31f0
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x6ae5
leaq 0x17c0(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x72a, %ecx            # imm = 0x72A
callq 0x31f0
movq 0x58(%rbx), %rsi
leaq 0x20(%rbx), %rax
cmpq %rax, %rsi
je 0x6b06
leaq 0x179f(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x72e, %ecx            # imm = 0x72E
callq 0x31f0
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x6b63
cmpl $0x0, 0x60(%rbx)
jle 0x6b4f
xorl %r12d, %r12d
leaq 0x1779(%rip), %r15      # 0x8298
movq 0x68(%rbx), %rsi
movq (%rsi,%r12,8), %rax
testq %rax, %rax
je 0x6b4f
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movl $0x737, %ecx            # imm = 0x737
callq 0x31f0
incq %r12
movslq 0x60(%rbx), %rax
cmpq %rax, %r12
jl 0x6b1f
movq 0x68(%rbx), %rsi
leaq 0x1742(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x739, %ecx            # imm = 0x739
callq 0x31f0
movq 0x88(%rbx), %rsi
testq %rsi, %rsi
je 0x6b83
leaq 0x1722(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x73d, %ecx            # imm = 0x73D
callq 0x31f0
leaq 0x170e(%rip), %rdx      # 0x8298
movq %r14, %rdi
movq %rbx, %rsi
movl $0x740, %ecx            # imm = 0x740
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x31f0