// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
movzbl (%rdx), %eax
pushq $0x1
popq %rbx
cmpl $0x73, %eax
je 0x7c62
cmpl $0x66, %eax
jne 0x7cb3
cmpb $0x69, 0x1(%r14)
jne 0x7cb3
cmpb $0x6c, 0x2(%r14)
jne 0x7cb3
cmpb $0x65, 0x3(%r14)
jne 0x7cb3
leaq 0x4(%r14), %rbp
movq %rsp, %rsi
pushq $0xa
popq %rdx
movq %rbp, %rdi
callq 0x3540
movq %rsp, %rcx
movq (%rcx), %rcx
cmpq %rbp, %rcx
je 0x7cb3
cmpb $0x0, (%rcx)
jne 0x7cb3
jmp 0x7ce9
cmpb $0x74, 0x1(%r14)
jne 0x7cb3
cmpb $0x64, 0x2(%r14)
jne 0x7cb3
cmpb $0x69, 0x3(%r14)
jne 0x7c89
cmpb $0x6e, 0x4(%r14)
jne 0x7c89
cmpb $0x0, 0x5(%r14)
je 0x7d3b
leaq 0x3(%r14), %rbp
leaq 0xa11(%rip), %rsi       # 0x86a5
movq %rbp, %rdi
callq 0x3310
testl %eax, %eax
je 0x7ce2
leaq 0x18f7(%rip), %rsi      # 0x959e
movq %rbp, %rdi
callq 0x3310
testl %eax, %eax
je 0x7ce6
leaq 0x18e8(%rip), %rsi      # 0x95a2
leaq 0x45f(%rip), %rcx       # 0x8120
movq %r15, %rdi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3500
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
jmp 0x7ce8
pushq $0x2
popq %rax
movl (%r13), %ecx
cmpl %ecx, %eax
jl 0x7d13
testl %ecx, %ecx
setne %dl
cmpl $0x3, %eax
setge %cl
orb %dl, %cl
jne 0x7d2b
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rbp
movl %ebp, %edx
callq 0x3640
movq %rbp, %rax
movq 0x8(%r13), %rdx
movslq %eax, %rcx
movq (%rdx,%rcx,8), %rax
testq %rax, %rax
je 0x7d2b
movq %rax, (%r12)
xorl %ebx, %ebx
jmp 0x7cd1
leaq 0x158c(%rip), %rsi      # 0x92be
leaq 0x187f(%rip), %rcx      # 0x95b8
jmp 0x7cc1
xorl %eax, %eax
jmp 0x7ce9