// File: /workspace/github_c_makefile_star2_O2/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 0x68ee
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
callq 0x3530
movq %rax, %r14
movl (%rbx), %eax
testl %eax, %eax
jle 0x69a2
xorl %r13d, %r13d
leaq 0x1982(%rip), %r15      # 0x8298
movslq %eax, %rcx
movq 0x8(%rbx), %rsi
cmpq %rcx, %r13
jge 0x698e
movq (%rsi,%r13,8), %r12
testq %r12, %r12
je 0x6989
cmpq $0x3, %r13
jb 0x6974
movq (%r12), %rdi
callq 0x3160
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x6949
callq 0x3160
movl 0x18(%r12), %esi
testl %esi, %esi
jle 0x6974
movq 0x20(%r12), %rdx
movq %rbx, %rdi
callq 0x32a0
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
jmp 0x6916
leaq 0x1903(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x726, %ecx            # imm = 0x726
callq 0x31f0
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x69bf
leaq 0x18e6(%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 0x69e0
leaq 0x18c5(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x72e, %ecx            # imm = 0x72E
callq 0x31f0
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x6a35
xorl %r12d, %r12d
leaq 0x18a5(%rip), %r15      # 0x8298
movslq 0x60(%rbx), %rax
cmpq %rax, %r12
jge 0x6a21
movq (%rsi,%r12,8), %rax
testq %rax, %rax
je 0x6a21
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movl $0x737, %ecx            # imm = 0x737
callq 0x31f0
incq %r12
movq 0x68(%rbx), %rsi
jmp 0x69f3
leaq 0x1870(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x739, %ecx            # imm = 0x739
callq 0x31f0
movq 0x88(%rbx), %rsi
testq %rsi, %rsi
je 0x6a55
leaq 0x1850(%rip), %rdx      # 0x8298
movq %r14, %rdi
movl $0x73d, %ecx            # imm = 0x73D
callq 0x31f0
leaq 0x183c(%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