// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
jne 0xa996
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x69, %eax
jne 0xa996
movq -0x20(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x6c, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movq -0x20(%rbp), %rcx
movsbl 0x3(%rcx), %ecx
cmpl $0x65, %ecx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0xa996
movq -0x20(%rbp), %rdi
addq $0x4, %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x3550
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0x4, %rcx
cmpq %rcx, %rax
je 0xa98c
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xa991
jmp 0xaa30
jmp 0xaa60
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x73, %eax
jne 0xaa2e
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0xaa2e
movq -0x20(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x64, %eax
jne 0xaa2e
movq -0x20(%rbp), %rdi
addq $0x3, %rdi
leaq 0x7b7(%rip), %rsi       # 0xb186
callq 0x3320
cmpl $0x0, %eax
jne 0xa9e2
movl $0x0, -0x2c(%rbp)
jmp 0xaa2c
movq -0x20(%rbp), %rdi
addq $0x3, %rdi
leaq 0xc27(%rip), %rsi       # 0xb618
callq 0x3320
cmpl $0x0, %eax
jne 0xaa04
movl $0x1, -0x2c(%rbp)
jmp 0xaa2a
movq -0x20(%rbp), %rdi
addq $0x3, %rdi
leaq 0x1aff(%rip), %rsi      # 0xc512
callq 0x3320
cmpl $0x0, %eax
jne 0xaa26
movl $0x2, -0x2c(%rbp)
jmp 0xaa28
jmp 0xaa30
jmp 0xaa2a
jmp 0xaa2c
jmp 0xaa5e
jmp 0xaa30
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1ad7(%rip), %rsi      # 0xc516
leaq 0x6da(%rip), %rcx       # 0xb120
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x3510
movl $0x1, -0x4(%rbp)
jmp 0xaaee
jmp 0xaa60
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jl 0xaabb
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xaa8c
cmpl $0x2, -0x2c(%rbp)
jg 0xaa8c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x3650
jmp 0xaab9
jmp 0xaa8e
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1795(%rip), %rsi      # 0xc232
leaq 0x1a88(%rip), %rcx      # 0xc52c
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x3510
movl $0x1, -0x4(%rbp)
jmp 0xaaee
jmp 0xaabb
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0xaad0
jmp 0xaa8e
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq