// File: /workspace/github_c_makefile_star2_O1/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 0x7f84
cmpl $0x66, %eax
jne 0x7fcd
cmpb $0x69, 0x1(%rbx)
jne 0x7f80
cmpb $0x6c, 0x2(%rbx)
jne 0x7f80
cmpb $0x65, 0x3(%rbx)
jne 0x7f80
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 0x7fcd
cmpb $0x0, (%rax)
jne 0x7fcd
jmp 0x8012
cmpb $0x73, %al
jne 0x7fcd
cmpb $0x74, 0x1(%rbx)
jne 0x7fcd
cmpb $0x64, 0x2(%rbx)
jne 0x7fcd
leaq 0x3(%rbx), %r13
leaq 0x11eb(%rip), %rsi      # 0x9186
movq %r13, %rdi
callq 0x3320
testl %eax, %eax
je 0x7fff
leaq 0x16d3(%rip), %rsi      # 0x9681
movq %r13, %rdi
callq 0x3320
testl %eax, %eax
je 0x8004
leaq 0x25b9(%rip), %rsi      # 0xa57a
movq %r13, %rdi
callq 0x3320
testl %eax, %eax
je 0x800c
leaq 0x25aa(%rip), %rsi      # 0xa57e
leaq 0x1145(%rip), %rcx      # 0x9120
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
xorl %r13d, %r13d
jmp 0x8012
movl $0x1, %r13d
jmp 0x8012
movl $0x2, %r13d
movl (%r12), %eax
cmpl %eax, %r13d
jl 0x8039
testl %eax, %eax
setne %al
cmpl $0x3, %r13d
setge %cl
orb %al, %cl
jne 0x8051
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 0x8051
movq %rax, (%r15)
xorl %eax, %eax
jmp 0x7ff0
leaq 0x2242(%rip), %rsi      # 0xa29a
leaq 0x2535(%rip), %rcx      # 0xa594
jmp 0x7fdb