// File: /workspace/github_c_makefile_star2_O2/ArtifexSoftware[P]mujs/main.c
// Function: main
int
main(int argc, char **argv)
{
	char *input;
	js_State *J;
	int status = 0;
	int strict = 0;
	int interactive = 0;
	int i, c;

	while ((c = xgetopt(argc, argv, "is")) != -1) {
		switch (c) {
		default: usage(); break;
		case 'i': interactive = 1; break;
		case 's': strict = 1; break;
		}
	}

	J = js_newstate(NULL, NULL, strict ? JS_STRICT : 0);
	if (!J) {
		fprintf(stderr, "Could not initialize MuJS.\n");
		exit(1);
	}

	js_newcfunction(J, jsB_gc, "gc", 0);
	js_setglobal(J, "gc");

	js_newcfunction(J, jsB_load, "load", 1);
	js_setglobal(J, "load");

	js_newcfunction(J, jsB_compile, "compile", 2);
	js_setglobal(J, "compile");

	js_newcfunction(J, jsB_print, "print", 0);
	js_setglobal(J, "print");

	js_newcfunction(J, jsB_write, "write", 0);
	js_setglobal(J, "write");

	js_newcfunction(J, jsB_read, "read", 1);
	js_setglobal(J, "read");

	js_newcfunction(J, jsB_readline, "readline", 0);
	js_setglobal(J, "readline");

	js_newcfunction(J, jsB_repr, "repr", 0);
	js_setglobal(J, "repr");

	js_newcfunction(J, jsB_quit, "quit", 1);
	js_setglobal(J, "quit");

	js_dostring(J, require_js);
	js_dostring(J, stacktrace_js);
	js_dostring(J, console_js);

	if (xoptind == argc) {
		interactive = 1;
	} else {
		c = xoptind++;

		js_newarray(J);
		i = 0;
		while (xoptind < argc) {
			js_pushstring(J, argv[xoptind++]);
			js_setindex(J, -2, i++);
		}
		js_setglobal(J, "scriptArgs");

		if (js_dofile(J, argv[c]))
			status = 1;
	}

	if (interactive) {
		printf("Welcome to MuJS %d.%d.%d.\n",
			JS_VERSION_MAJOR, JS_VERSION_MINOR, JS_VERSION_PATCH);
		if (isatty(0)) {
			using_history();
			rl_bind_key('\t', rl_insert);
			input = readline(PS1);
			while (input) {
				eval_print(J, input);
				if (*input)
					add_history(input);
				free(input);
				input = readline(PS1);
			}
			putchar('\n');
		} else {
			input = read_stdin();
			if (!input || !js_dostring(J, input))
				status = 1;
			free(input);
		}
	}

	js_gc(J, 0);
	js_freestate(J);

	return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebp
movq 0x33ef2(%rip), %r10     # 0x37418
xorl %edx, %edx
movl 0x33ee2(%rip), %eax     # 0x37410
pushq $0x1
popq %rsi
pushq $0x2
popq %rdi
leaq 0x263f2(%rip), %r8      # 0x2992d
pushq $0x1
popq %r9
xorl %r15d, %r15d
movl %r15d, %ebx
movl %ebx, %r15d
testq %r10, %r10
je 0x3555
movb (%r10), %r11b
testb %r11b, %r11b
jne 0x35a9
testl %eax, %eax
jne 0x3565
movl $0x1, 0x33ead(%rip)     # 0x37410
movl %esi, %eax
cmpl %ebp, %eax
jge 0x3639
movslq %eax, %rcx
movq (%r14,%rcx,8), %r10
cmpb $0x2d, (%r10)
jne 0x3639
movzbl 0x1(%r10), %r11d
cmpl $0x2d, %r11d
je 0x3593
testl %r11d, %r11d
jne 0x359e
jmp 0x3639
cmpb $0x0, 0x2(%r10)
je 0x3631
incq %r10
incl %eax
movl %eax, 0x33e67(%rip)     # 0x37410
incq %r10
movq %r10, 0x33e65(%rip)     # 0x37418
movzbl %r11b, %ecx
testb %cl, %cl
je 0x35ce
cmpl $0x69, %ecx
je 0x35d3
cmpl $0x73, %ecx
jne 0x3aac
movq %r9, %rbx
jmp 0x35d5
movq %rdi, %rbx
jmp 0x35d5
xorl %ebx, %ebx
cmpb $0x3a, 0x1(%rbx,%r8)
jne 0x3615
cmpb $0x0, (%r10)
je 0x35f7
movq %r10, 0x33e36(%rip)     # 0x37420
andq $0x0, 0x33e26(%rip)     # 0x37418
xorl %r10d, %r10d
jmp 0x3615
cmpl %ebp, %eax
jge 0x3ab9
movslq %eax, %rbx
movq (%r14,%rbx,8), %rbx
movq %rbx, 0x33e13(%rip)     # 0x37420
incl %eax
movl %eax, 0x33dfb(%rip)     # 0x37410
movl %esi, %ebx
cmpb $0x69, %r11b
je 0x3545
cmpl $0x73, %ecx
jne 0x3ad4
movl %esi, %edx
jmp 0x3542
incl %eax
movl %eax, 0x33dd7(%rip)     # 0x37410
movl %r15d, 0x8(%rsp)
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
callq 0x121d7
testq %rax, %rax
je 0x3b25
movq %rax, %rbx
leaq 0x4e1(%rip), %rsi       # 0x3b3e
leaq 0x1c9bc(%rip), %r15     # 0x20020
movq %rax, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1093f
leaq 0x4da(%rip), %rsi       # 0x3b5d
leaq 0x1c999(%rip), %r12     # 0x20023
pushq $0x1
popq %r15
movq %rbx, %rdi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x516(%rip), %rsi       # 0x3bc4
leaq 0x1c973(%rip), %r12     # 0x20028
pushq $0x2
popq %rcx
movq %rbx, %rdi
movq %r12, %rdx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x539(%rip), %rsi       # 0x3c0e
leaq 0x1c954(%rip), %r12     # 0x20030
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x587(%rip), %rsi       # 0x3c82
leaq 0x1c934(%rip), %r12     # 0x20036
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x5cd(%rip), %rsi       # 0x3cee
leaq 0x1c914(%rip), %r12     # 0x2003c
movq %rbx, %rdi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x716(%rip), %rsi       # 0x3e5e
leaq 0x1c8f2(%rip), %r12     # 0x20041
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x741(%rip), %rsi       # 0x3eaf
leaq 0x1c8d5(%rip), %r12     # 0x2004a
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x723(%rip), %rsi       # 0x3eb7
leaq 0x1c8b4(%rip), %r12     # 0x2004f
movq %rbx, %rdi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x5958
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1093f
leaq 0x1ca07(%rip), %rsi     # 0x201c2
movq %rbx, %rdi
callq 0x12066
leaq 0x1cae4(%rip), %rsi     # 0x202ae
movq %rbx, %rdi
callq 0x12066
leaq 0x1cb75(%rip), %rsi     # 0x2034e
movq %rbx, %rdi
callq 0x12066
movslq 0x33c28(%rip), %rax     # 0x37410
cmpl %ebp, %eax
je 0x387b
movq %rax, 0x10(%rsp)
incl %eax
movl %eax, 0x33c13(%rip)     # 0x37410
movq %rbx, %rdi
callq 0xe7d1
xorl %r12d, %r12d
pushq $-0x2
popq %r15
movslq 0x33bfd(%rip), %rax     # 0x37410
cmpl %ebp, %eax
jge 0x3844
leal 0x1(%rax), %ecx
movl %ecx, 0x33bf0(%rip)     # 0x37410
movq (%r14,%rax,8), %rsi
movq %rbx, %rdi
callq 0xe7f7
leal 0x1(%r12), %r13d
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0xe9c5
movl %r13d, %r12d
jmp 0x380c
leaq 0x1c809(%rip), %rsi     # 0x20054
movq %rbx, %rdi
callq 0x1093f
movq 0x10(%rsp), %rax
movq (%r14,%rax,8), %rsi
movq %rbx, %rdi
callq 0x12116
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
movl %r13d, %ebp
cmpl $0x0, 0x8(%rsp)
je 0x3a40
movq %r13, 0x10(%rsp)
leaq 0x1c7d8(%rip), %rdi     # 0x2005f
xorl %r15d, %r15d
pushq $0x1
popq %rsi
pushq $0x3
popq %rdx
pushq $0x5
popq %rcx
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
callq 0x30e0
testl %eax, %eax
je 0x39a8
callq 0x3340
movq 0x3372b(%rip), %rsi     # 0x36fe0
pushq $0x9
popq %rdi
callq 0x3400
leaq 0x1c7b6(%rip), %r14     # 0x2007a
leaq 0x1caca(%rip), %r15     # 0x20395
pushq $-0x1
popq %rbp
pushq $0x1
popq %r13
movq %r14, %rdi
callq 0x32e0
testq %rax, %rax
je 0x3994
movq %rax, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x11b7f
testl %eax, %eax
jne 0x395c
movq %rbx, %rdi
callq 0x7336
movq %rbx, %rdi
xorl %esi, %esi
callq 0x117cd
testl %eax, %eax
jne 0x395c
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf8a8
testl %eax, %eax
je 0x3935
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x1ca79(%rip), %rdx     # 0x203a1
callq 0xf662
movq %rax, %rdi
callq 0x30f0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3f3d
cmpb $0x0, (%r12)
je 0x394f
movq %r12, %rdi
callq 0x3390
movq %r12, %rdi
callq 0x31e0
jmp 0x38d2
movq 0x33685(%rip), %rax     # 0x36fe8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x2481e(%rip), %rdx     # 0x28195
callq 0x11e70
movq 0x8(%rsp), %rdi
leaq 0x1ca15(%rip), %rsi     # 0x2039d
movq %rax, %rdx
xorl %eax, %eax
callq 0x3380
jmp 0x3935
pushq $0xa
popq %rdi
callq 0x3150
movq 0x10(%rsp), %rax
movl %eax, %ebp
jmp 0x3a40
movl $0x200, %ebp            # imm = 0x200
pushq $0x1
popq %r12
xorl %r13d, %r13d
movslq %ebp, %rsi
movq %r13, %rdi
callq 0x3360
testq %rax, %rax
je 0x3a63
movq %rax, %r14
movslq %r15d, %r13
movq %rax, %rdi
addq %r13, %rdi
movl %r13d, %eax
notl %eax
addl %ebp, %eax
movslq %eax, %rdx
movq 0x335f3(%rip), %rax     # 0x36fd8
movq (%rax), %rcx
movq %r12, %rsi
callq 0x32c0
movq %rax, %r15
addl %r13d, %r15d
leal -0x1(%rbp), %eax
addl %ebp, %ebp
movq %r14, %r13
cmpl %eax, %r15d
jge 0x39b4
movq 0x335ce(%rip), %rax     # 0x36fd8
movq (%rax), %rdi
callq 0x3210
testl %eax, %eax
jne 0x3a80
movslq %r15d, %rax
movb $0x0, (%r14,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12066
testl %eax, %eax
pushq $0x1
popq %rax
movq 0x10(%rsp), %rcx
cmovel %eax, %ecx
movl %ecx, %ebp
movq %r14, %rdi
callq 0x31e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa17a
movq %rbx, %rdi
callq 0xa8aa
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x31e0
movq 0x33576(%rip), %rax     # 0x36fe8
movq (%rax), %rcx
leaq 0x1c93d(%rip), %rdi     # 0x203b9
pushq $0x2b
jmp 0x3a9b
movq %r14, %rdi
callq 0x31e0
movq 0x33559(%rip), %rax     # 0x36fe8
movq (%rax), %rcx
leaq 0x1c94c(%rip), %rdi     # 0x203e5
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x3350
xorl %r14d, %r14d
pushq $0x1
popq %rbp
jmp 0x3a38
movsbl %r11b, %ecx
leaq 0x1c5c6(%rip), %rsi     # 0x2007d
jmp 0x3ac0
leaq 0x1c5d5(%rip), %rsi     # 0x20095
movq 0x33521(%rip), %rax     # 0x36fe8
movq (%rax), %rdi
movq (%r14), %rdx
xorl %eax, %eax
callq 0x3380
movq 0x3350d(%rip), %r14     # 0x36fe8
movq (%r14), %rcx
leaq 0x1c5d2(%rip), %rdi     # 0x200b7
pushq $0x2d
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x3350
movq (%r14), %rcx
leaq 0x1c5e8(%rip), %rdi     # 0x200e5
pushq $0x32
popq %rsi
movq %rbx, %rdx
callq 0x3350
movq (%r14), %rcx
leaq 0x1c606(%rip), %rdi     # 0x20118
pushq $0x17
popq %rsi
movq %rbx, %rdx
callq 0x3350
pushq $0x1
popq %rdi
callq 0x3120
movq 0x334bc(%rip), %rax     # 0x36fe8
movq (%rax), %rcx
leaq 0x1c4ce(%rip), %rdi     # 0x20004
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
jmp 0x3b18