// File: /workspace/github_c_makefile_star2_O1/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 0x6b52
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
callq 0x3540
movq %rax, %r14
cmpl $0x0, (%rbx)
jle 0x6c0a
cmpl $0x0, (%rbx)
jle 0x6bf2
xorl %r13d, %r13d
leaq 0x26f6(%rip), %r15      # 0x9274
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %r12
testq %r12, %r12
je 0x6be7
cmpq $0x3, %r13
jb 0x6bd4
movq (%r12), %rdi
callq 0x3160
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x6ba9
callq 0x3160
movl 0x18(%r12), %esi
testl %esi, %esi
jle 0x6bd4
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
incq %r13
movslq (%rbx), %rax
cmpq %rax, %r13
jl 0x6b7e
movq 0x8(%rbx), %rsi
leaq 0x2677(%rip), %rdx      # 0x9274
movq %r14, %rdi
movl $0x726, %ecx            # imm = 0x726
callq 0x31f0
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x6c27
leaq 0x265a(%rip), %rdx      # 0x9274
movq %r14, %rdi
movl $0x72a, %ecx            # imm = 0x72A
callq 0x31f0
movq 0x58(%rbx), %rsi
leaq 0x20(%rbx), %rax
cmpq %rax, %rsi
je 0x6c48
leaq 0x2639(%rip), %rdx      # 0x9274
movq %r14, %rdi
movl $0x72e, %ecx            # imm = 0x72E
callq 0x31f0
cmpq $0x0, 0x68(%rbx)
je 0x6ca0
cmpl $0x0, 0x60(%rbx)
jle 0x6c88
xorl %r12d, %r12d
leaq 0x2615(%rip), %r15      # 0x9274
movq 0x68(%rbx), %rax
movq (%rax,%r12,8), %rsi
testq %rsi, %rsi
je 0x6c88
movq %r14, %rdi
movq %r15, %rdx
movl $0x737, %ecx            # imm = 0x737
callq 0x31f0
incq %r12
movslq 0x60(%rbx), %rax
cmpq %rax, %r12
jl 0x6c5f
movq 0x68(%rbx), %rsi
leaq 0x25e1(%rip), %rdx      # 0x9274
movq %r14, %rdi
movl $0x739, %ecx            # imm = 0x739
callq 0x31f0
movq 0x88(%rbx), %rsi
testq %rsi, %rsi
je 0x6cc0
leaq 0x25c1(%rip), %rdx      # 0x9274
movq %r14, %rdi
movl $0x73d, %ecx            # imm = 0x73D
callq 0x31f0
leaq 0x25ad(%rip), %rdx      # 0x9274
movq %r14, %rdi
movq %rbx, %rsi
movl $0x740, %ecx            # imm = 0x740
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x31f0