// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxUnixAZ.c
// Function: Hax_CloseCmd
int
Hax_CloseCmd(
    ClientData clientData,		/* Unix ClientData */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    Hax_Memoryp *memoryp;
    UnixClientData *clientDataPtr;
    OpenFile *filePtr;
    int result = HAX_OK;

    memoryp = Hax_GetMemoryp(interp);

    if (argc != 2) {
	Hax_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" fileId\"", (char *) NULL);
	return HAX_ERROR;
    }

    clientDataPtr = (UnixClientData *) clientData;
    if (HaxGetOpenFile(interp, clientDataPtr, argv[1], &filePtr) != HAX_OK) {
	return HAX_ERROR;
    }

    clientDataPtr->filePtrArray[fileno(filePtr->f)] = NULL;

    /*
     * First close the file (in the case of a process pipeline, there may
     * be two files, one for the pipe at each end of the pipeline).
     */

    if (filePtr->f2 != NULL) {
	if (fclose(filePtr->f2) == EOF) {
	    Hax_AppendResult(interp, "error closing \"", argv[1],
		    "\": ", Hax_UnixError(interp), "\n", (char *) NULL);
	    result = HAX_ERROR;
	}
    }
    if (fclose(filePtr->f) == EOF) {
	Hax_AppendResult(interp, "error closing \"", argv[1],
		"\": ", Hax_UnixError(interp), "\n", (char *) NULL);
	result = HAX_ERROR;
    }

    /*
     * If the file was a connection to a pipeline, clean up everything
     * associated with the child processes.
     */

    if (filePtr->numPids > 0) {
	if (CleanupChildren(interp, clientData, filePtr->numPids, filePtr->pidPtr,
		filePtr->errorId) != HAX_OK) {
	    result = HAX_ERROR;
	}
    }

    ckfree(memoryp, (char *) filePtr);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3540
movq %rax, -0x30(%rbp)
cmpl $0x2, -0x1c(%rbp)
je 0x5105
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x605d(%rip), %rsi      # 0xb143
leaq 0x6565(%rip), %rcx      # 0xb652
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x3510
movl $0x1, -0x4(%rbp)
jmp 0x5295
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq -0x40(%rbp), %rcx
callq 0x3060
cmpl $0x0, %eax
je 0x5137
movl $0x1, -0x4(%rbp)
jmp 0x5295
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
callq 0x33e0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x51d4
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3160
cmpl $-0x1, %eax
jne 0x51d2
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x31b0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq %rax, %r8
leaq 0x6092(%rip), %rsi      # 0xb23e
leaq 0x6038(%rip), %rcx      # 0xb1eb
leaq 0x664d(%rip), %r9       # 0xb807
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x3510
movl $0x1, -0x44(%rbp)
jmp 0x51d4
movq -0x40(%rbp), %rax
movq (%rax), %rdi
callq 0x3160
cmpl $-0x1, %eax
jne 0x523a
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
callq 0x31b0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq %rax, %r8
leaq 0x602a(%rip), %rsi      # 0xb23e
leaq 0x5fd0(%rip), %rcx      # 0xb1eb
leaq 0x65e5(%rip), %r9       # 0xb807
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x3510
movl $0x1, -0x44(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jle 0x5276
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %r8d
callq 0x52b0
cmpl $0x0, %eax
je 0x5274
movl $0x1, -0x44(%rbp)
jmp 0x5276
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq 0x5f86(%rip), %rdx      # 0xb20b
movl $0xcf, %ecx
callq 0x31f0
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)