// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxUnixUtil.c
// Function: HaxGetOpenFile
int
HaxGetOpenFile(
    Hax_Interp *interp,		/* Interpreter in which to find file. */
    UnixClientData *clientDataPtr,
				/* Unix Client Data in which to find file. */
    char *string,		/* String that identifies file. */
    OpenFile **filePtrPtr	/* Address of word in which to store pointer
				 * to structure about open file. */)
{
    int fd = 0;			/* Initial value needed only to stop compiler
				 * warnings. */

    if ((string[0] == 'f') && (string[1] == 'i') && (string[2] == 'l')
	    & (string[3] == 'e')) {
	char *end;

	fd = strtoul(string+4, &end, 10);
	if ((end == string+4) || (*end != 0)) {
	    goto badId;
	}
    } else if ((string[0] == 's') && (string[1] == 't')
	    && (string[2] == 'd')) {
	if (strcmp(string+3, "in") == 0) {
	    fd = 0;
	} else if (strcmp(string+3, "out") == 0) {
	    fd = 1;
	} else if (strcmp(string+3, "err") == 0) {
	    fd = 2;
	} else {
	    goto badId;
	}
    } else {
	badId:
	Hax_AppendResult(interp, "bad file identifier \"", string,
		"\"", (char *) NULL);
	return HAX_ERROR;
    }

    if (fd >= clientDataPtr->numFiles) {
	if ((clientDataPtr->numFiles == 0) && (fd <= 2)) {
	    HaxMakeFileTable(interp, clientDataPtr, fd);
	} else {
	    notOpen:
	    Hax_AppendResult(interp, "file \"", string, "\" isn't open",
		    (char *) NULL);
	    return HAX_ERROR;
	}
    }
    if (clientDataPtr->filePtrArray[fd] == NULL) {
	goto notOpen;
    }
    *filePtrPtr = clientDataPtr->filePtrArray[fd];
    return HAX_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movzbl (%rdx), %eax
cmpl $0x73, %eax
je 0x7e08
cmpl $0x66, %eax
jne 0x7e50
cmpb $0x69, 0x1(%rbx)
jne 0x7e50
cmpb $0x6c, 0x2(%rbx)
jne 0x7e50
cmpb $0x65, 0x3(%rbx)
jne 0x7e50
leaq 0x4(%rbx), %rbp
movq %rsp, %rsi
movq %rbp, %rdi
movl $0xa, %edx
callq 0x3550
movq %rax, %r13
movq %rsp, %rax
movq (%rax), %rax
cmpq %rbp, %rax
je 0x7e50
cmpb $0x0, (%rax)
jne 0x7e50
jmp 0x7e95
cmpb $0x74, 0x1(%rbx)
jne 0x7e50
cmpb $0x64, 0x2(%rbx)
jne 0x7e50
cmpb $0x69, 0x3(%rbx)
jne 0x7e26
cmpb $0x6e, 0x4(%rbx)
jne 0x7e26
cmpb $0x0, 0x5(%rbx)
je 0x7e92
leaq 0x3(%rbx), %r13
leaq 0x874(%rip), %rsi       # 0x86a5
movq %r13, %rdi
callq 0x3320
testl %eax, %eax
je 0x7e82
leaq 0x175a(%rip), %rsi      # 0x959e
movq %r13, %rdi
callq 0x3320
testl %eax, %eax
je 0x7e8a
leaq 0x174b(%rip), %rsi      # 0x95a2
leaq 0x2c2(%rip), %rcx       # 0x8120
movq %r14, %rdi
movq %rbx, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r13d
jmp 0x7e95
movl $0x2, %r13d
jmp 0x7e95
xorl %r13d, %r13d
movl (%r12), %eax
cmpl %eax, %r13d
jl 0x7ebc
testl %eax, %eax
setne %al
cmpl $0x3, %r13d
setge %cl
orb %al, %cl
jne 0x7ed4
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x3650
movq 0x8(%r12), %rax
movslq %r13d, %rcx
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x7ed4
movq %rax, (%r15)
xorl %eax, %eax
jmp 0x7e73
leaq 0x13e3(%rip), %rsi      # 0x92be
leaq 0x16d6(%rip), %rcx      # 0x95b8
jmp 0x7e5e