// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxUnixUtil.c
// Function: Hax_EvalFile
int
Hax_EvalFile(
    Hax_Interp *interp,		/* Interpreter in which to process file. */
    ClientData clientData,	/* Unix Client Data */
    char *fileName		/* Name of file to process.  Tilde-substitution
				 * will be performed on this name. */)
{
    Hax_Memoryp *memoryp;
    int fileId, result;
    struct stat statBuf;
    char *cmdBuffer, *end;

    memoryp = Hax_GetMemoryp (interp);

    fileName = Hax_TildeSubst(interp, clientData, fileName);
    if (fileName == NULL) {
	goto error;
    }
    fileId = open(fileName, O_RDONLY, 0);
    if (fileId < 0) {
	Hax_AppendResult(interp, "couldn't read file \"", fileName,
		"\": ", Hax_UnixError(interp), (char *) NULL);
	goto error;
    }
    if (fstat(fileId, &statBuf) == -1) {
	Hax_AppendResult(interp, "couldn't stat file \"", fileName,
		"\": ", Hax_UnixError(interp), (char *) NULL);
	close(fileId);
	goto error;
    }
    cmdBuffer = (char *) ckalloc(memoryp, (unsigned) statBuf.st_size+1);
    if (read(fileId, cmdBuffer, (int) statBuf.st_size) != statBuf.st_size) {
	Hax_AppendResult(interp, "error in reading file \"", fileName,
		"\": ", Hax_UnixError(interp), (char *) NULL);
	close(fileId);
	ckfree(memoryp, cmdBuffer);
	goto error;
    }
    if (close(fileId) != 0) {
	Hax_AppendResult(interp, "error closing file \"", fileName,
		"\": ", Hax_UnixError(interp), (char *) NULL);
	ckfree(memoryp, cmdBuffer);
	goto error;
    }
    cmdBuffer[statBuf.st_size] = 0;
    result = Hax_Eval(interp, fileName, cmdBuffer, 0, &end);
    if (result == HAX_RETURN) {
	result = HAX_OK;
    }
    if (result == HAX_ERROR) {
	char msg[200];

	/*
	 * Record information telling where the error occurred.
	 */

	sprintf(msg, "\n    (file \"%.150s\" line %d)", fileName,
		interp->errorLine);
	Hax_AddErrorInfo(interp, msg);
    }
    ckfree(memoryp, cmdBuffer);
    return result;

    error:
    return HAX_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
callq 0x3540
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3570
movl $0x1, %ebx
testq %rax, %rax
je 0x6efc
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34e0
testl %eax, %eax
js 0x6de8
movl %eax, %ebp
leaq 0x10(%rsp), %rsi
movl %eax, %edi
callq 0x35e0
cmpl $-0x1, %eax
je 0x6e16
movq 0x40(%rsp), %r13
leal 0x1(%r13), %esi
leaq 0x256c(%rip), %rdx      # 0x92da
movq %r14, %rdi
movl $0x4f, %ecx
callq 0x34c0
movq %r14, (%rsp)
movq %rax, %r14
movslq %r13d, %rdx
movl %ebp, %edi
movq %rax, %rsi
callq 0x32f0
cmpq %r13, %rax
jne 0x6e4b
movl %ebp, %edi
callq 0x3290
testl %eax, %eax
je 0x6e90
movq %r15, %rdi
callq 0x31b0
leaq 0x254a(%rip), %rsi      # 0x9300
leaq 0x142e(%rip), %rcx      # 0x81eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
leaq 0x2503(%rip), %rdx      # 0x92da
movq (%rsp), %rdi
movq %r14, %rsi
movl $0x5a, %ecx
jmp 0x6ef7
movq %r15, %rdi
callq 0x31b0
leaq 0x24b9(%rip), %rsi      # 0x92b0
leaq 0x13ed(%rip), %rcx      # 0x81eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
jmp 0x6efc
movq %r15, %rdi
callq 0x31b0
leaq 0x24a0(%rip), %rsi      # 0x92c5
leaq 0x13bf(%rip), %rcx      # 0x81eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
movl %ebp, %edi
callq 0x3290
jmp 0x6efc
movq %r15, %rdi
callq 0x31b0
leaq 0x248e(%rip), %rsi      # 0x92e8
leaq 0x138a(%rip), %rcx      # 0x81eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
movl %ebp, %edi
callq 0x3290
leaq 0x2458(%rip), %rdx      # 0x92da
movq (%rsp), %rdi
movq %r14, %rsi
movl $0x54, %ecx
jmp 0x6ef7
movb $0x0, (%r14,%r13)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r8
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x3590
movl %eax, %ebx
cmpl $0x2, %eax
cmovel %ebp, %ebx
cmpl $0x1, %ebx
jne 0x6ee4
movl 0x10(%r15), %ecx
leaq 0x2451(%rip), %rsi      # 0x9315
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x35a0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3400
leaq 0x23ef(%rip), %rdx      # 0x92da
movq (%rsp), %rdi
movq %r14, %rsi
movl $0x6d, %ecx
callq 0x31f0
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq