// File: /workspace/github_c_makefile_star2_O1/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 0x703c
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34e0
testl %eax, %eax
js 0x6f28
movl %eax, %ebp
leaq 0x10(%rsp), %rsi
movl %eax, %edi
callq 0x35e0
cmpl $-0x1, %eax
je 0x6f56
movq 0x40(%rsp), %r13
leal 0x1(%r13), %esi
leaq 0x3408(%rip), %rdx      # 0xa2b6
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 0x6f8b
movl %ebp, %edi
callq 0x3290
testl %eax, %eax
je 0x6fd0
movq %r15, %rdi
callq 0x31b0
leaq 0x33e6(%rip), %rsi      # 0xa2dc
leaq 0x22ee(%rip), %rcx      # 0x91eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
leaq 0x339f(%rip), %rdx      # 0xa2b6
movq (%rsp), %rdi
movq %r14, %rsi
movl $0x5a, %ecx
jmp 0x7037
movq %r15, %rdi
callq 0x31b0
leaq 0x3355(%rip), %rsi      # 0xa28c
leaq 0x22ad(%rip), %rcx      # 0x91eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
jmp 0x703c
movq %r15, %rdi
callq 0x31b0
leaq 0x333c(%rip), %rsi      # 0xa2a1
leaq 0x227f(%rip), %rcx      # 0x91eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
movl %ebp, %edi
callq 0x3290
jmp 0x703c
movq %r15, %rdi
callq 0x31b0
leaq 0x332a(%rip), %rsi      # 0xa2c4
leaq 0x224a(%rip), %rcx      # 0x91eb
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
movl %ebp, %edi
callq 0x3290
leaq 0x32f4(%rip), %rdx      # 0xa2b6
movq (%rsp), %rdi
movq %r14, %rsi
movl $0x54, %ecx
jmp 0x7037
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 0x7024
movl 0x10(%r15), %ecx
leaq 0x32ed(%rip), %rsi      # 0xa2f1
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x35a0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3400
leaq 0x328b(%rip), %rdx      # 0xa2b6
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