// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./jsstate.c
// Function: js_loadfile
void js_loadfile(js_State *J, const char *filename)
{
	FILE *f;
	char *s, *p;
	int n, t;

	f = fopen(filename, "rb");
	if (!f) {
		js_error(J, "cannot open file '%s': %s", filename, strerror(errno));
	}

	if (fseek(f, 0, SEEK_END) < 0) {
		fclose(f);
		js_error(J, "cannot seek in file '%s': %s", filename, strerror(errno));
	}

	n = ftell(f);
	if (n < 0) {
		fclose(f);
		js_error(J, "cannot tell in file '%s': %s", filename, strerror(errno));
	}

	if (fseek(f, 0, SEEK_SET) < 0) {
		fclose(f);
		js_error(J, "cannot seek in file '%s': %s", filename, strerror(errno));
	}

	if (js_try(J)) {
		fclose(f);
		js_throw(J);
	}
	s = js_malloc(J, n + 1); /* add space for string terminator */
	js_endtry(J);

	t = fread(s, 1, (size_t)n, f);
	if (t != n) {
		js_free(J, s);
		fclose(f);
		js_error(J, "cannot read data from file '%s': %s", filename, strerror(errno));
	}

	s[n] = 0; /* zero-terminate string containing file data */

	if (js_try(J)) {
		js_free(J, s);
		fclose(f);
		js_throw(J);
	}

	/* skip first line if it starts with "#!" */
	p = s;
	if (p[0] == '#' && p[1] == '!') {
		p += 2;
		while (*p && *p != '\n')
			++p;
	}

	js_loadstring(J, filename, p);

	js_free(J, s);
	fclose(f);
	js_endtry(J);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x13adb(%rip), %rsi     # 0x2b139
movq %r13, %rdi
callq 0x3180
testq %rax, %rax
je 0x177e6
movq %rax, %r15
xorl %eax, %eax
movl %eax, %esi
movq %r15, %rdi
movl $0x2, %edx
callq 0x3110
testl %eax, %eax
js 0x177b5
movq %r15, %rdi
callq 0x3070
movq %rax, %r12
testl %r12d, %r12d
js 0x177fe
movl %r12d, %r14d
xorl %edx, %edx
movl %edx, %esi
movq %r15, %rdi
callq 0x3110
testl %eax, %eax
js 0x177b5
movq %rbx, %rdi
callq 0x13b6c
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0x1786d
movq %r13, (%rsp)
movl %r14d, %eax
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0xde05
movq %rax, %r13
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x177d5
movq %r12, %rcx
movq %r13, %r12
decl %eax
movl %eax, 0x8198(%rbx)
movl %ecx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %ebp
movl $0x1, %esi
movq %r13, %rdi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x32c0
cmpl %r14d, %eax
jne 0x17829
movb $0x0, (%r12,%rbp)
movq %rbx, %rdi
callq 0x13b6c
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0x17862
cmpb $0x23, (%r12)
movq %r12, %rdx
jne 0x17771
cmpb $0x21, 0x1(%r12)
movq %r12, %rdx
jne 0x17771
addq $0x2, %r13
movq %r13, %rax
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x1776e
cmpl $0xa, %ecx
je 0x1776e
incq %rax
jmp 0x1775d
movq %rax, %rdx
xorl %ebp, %ebp
movq %rbx, %rdi
movq (%rsp), %rsi
movl %ebp, %ecx
callq 0x17bb5
movq (%rbx), %rdi
movq %r12, %rsi
movl %ebp, %edx
callq *0x10(%rbx)
movq %r15, %rdi
callq 0x3330
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x177d5
decl %eax
movl %eax, 0x8198(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x3330
callq 0x32d0
movl (%rax), %edi
callq 0x3250
movq %rax, %rcx
leaq 0x13983(%rip), %rsi     # 0x2b156
jmp 0x1781c
leaq 0x1c05d(%rip), %rsi     # 0x33839
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc666
callq 0x32d0
movl (%rax), %edi
callq 0x3250
movq %rax, %rcx
leaq 0x13940(%rip), %rsi     # 0x2b13c
jmp 0x1781c
movq %r15, %rdi
callq 0x3330
callq 0x32d0
movl (%rax), %edi
callq 0x3250
movq %rax, %rcx
leaq 0x13957(%rip), %rsi     # 0x2b173
xorl %eax, %eax
movq %rbx, %rdi
movq %r13, %rdx
callq 0xc666
movq (%rbx), %rdi
xorl %ebp, %ebp
movq %r12, %rsi
movl %ebp, %edx
callq *0x10(%rbx)
movq %r15, %rdi
callq 0x3330
callq 0x32d0
movl (%rax), %edi
callq 0x3250
leaq 0x1394d(%rip), %rsi     # 0x2b19e
movq %rbx, %rdi
movq (%rsp), %rdx
movq %rax, %rcx
movl %ebp, %eax
callq 0xc666
movq (%rbx), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq *0x10(%rbx)
movq %r15, %rdi
callq 0x3330
movq %rbx, %rdi
callq 0x8e1b