// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0x8214
jmp 0x8434
movq -0x8(%rbp), %rdi
callq 0x3540
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x8313
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x82f6
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x8264
jmp 0x82e8
cmpl $0x3, -0x24(%rbp)
jl 0x82cf
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x3160
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x828e
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3160
movq -0x30(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jle 0x82cd
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x18(%rax), %esi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x32b0
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x2f48(%rip), %rdx      # 0xb20b
movl $0x721, %ecx            # imm = 0x721
callq 0x31f0
jmp 0x82cf
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x2f2d(%rip), %rdx      # 0xb20b
movl $0x724, %ecx            # imm = 0x724
callq 0x31f0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8235
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x2f02(%rip), %rdx      # 0xb20b
movl $0x726, %ecx            # imm = 0x726
callq 0x31f0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x833b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x2eda(%rip), %rdx      # 0xb20b
movl $0x72a, %ecx            # imm = 0x72A
callq 0x31f0
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x20(%rbp), %rcx
addq $0x20, %rcx
cmpq %rcx, %rax
je 0x836d
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rsi
leaq 0x2ea8(%rip), %rdx      # 0xb20b
movl $0x72e, %ecx            # imm = 0x72E
callq 0x31f0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x83ed
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x60(%rcx), %eax
jge 0x83d0
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x24(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x83a0
jmp 0x83d0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x2e50(%rip), %rdx      # 0xb20b
movl $0x737, %ecx            # imm = 0x737
callq 0x31f0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x837f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rsi
leaq 0x2e28(%rip), %rdx      # 0xb20b
movl $0x739, %ecx            # imm = 0x739
callq 0x31f0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x841b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rsi
leaq 0x2dfa(%rip), %rdx      # 0xb20b
movl $0x73d, %ecx            # imm = 0x73D
callq 0x31f0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq 0x2de1(%rip), %rdx      # 0xb20b
movl $0x740, %ecx            # imm = 0x740
callq 0x31f0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)