// File: /workspace/github_c_makefile_star2_O0/ccxvii[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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1a0bb(%rip), %rsi     # 0x33139
callq 0x3160
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x190c3
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x32b0
movl (%rax), %edi
callq 0x3230
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
leaq 0x1a080(%rip), %rsi     # 0x3313c
movb $0x0, %al
callq 0xbb10
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x30f0
cmpl $0x0, %eax
jge 0x19118
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x32b0
movl (%rax), %edi
callq 0x3230
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq %rax, %rcx
leaq 0x1a045(%rip), %rsi     # 0x33156
movb $0x0, %al
callq 0xbb10
movq -0x18(%rbp), %rdi
callq 0x3070
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x19168
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x32b0
movl (%rax), %edi
callq 0x3230
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq %rax, %rcx
leaq 0x1a012(%rip), %rsi     # 0x33173
movb $0x0, %al
callq 0xbb10
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x30f0
cmpl $0x0, %eax
jge 0x191ba
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
callq 0x32b0
movl (%rax), %edi
callq 0x3230
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
leaq 0x19fa3(%rip), %rsi     # 0x33156
movb $0x0, %al
callq 0xbb10
movq -0x8(%rbp), %rdi
callq 0x14270
movq %rax, %rdi
callq 0x30e0
cmpl $0x0, %eax
je 0x191e2
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rdi
callq 0x8cb0
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
addl $0x1, %esi
callq 0xd9d0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14a10
movq -0x20(%rbp), %rdi
movslq -0x2c(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x32a0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0x1926a
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd710
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
callq 0x32b0
movl (%rax), %edi
callq 0x3230
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq %rax, %rcx
leaq 0x19f3b(%rip), %rsi     # 0x3319e
movb $0x0, %al
callq 0xbb10
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rdi
callq 0x14270
movq %rax, %rdi
callq 0x30e0
cmpl $0x0, %eax
je 0x192ab
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd710
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rdi
callq 0x8cb0
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x1931b
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x21, %eax
jne 0x1931b
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x81(%rbp)
je 0x192ff
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x1930b
jmp 0x19319
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x192d8
jmp 0x1931b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x18fc0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd710
movq -0x18(%rbp), %rdi
callq 0x3310
movq -0x8(%rbp), %rdi
callq 0x14a10
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)