// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
movq %rsi, %r15
movl %edi, %ebp
movq 0x3cdb5(%rip), %rdi     # 0x40418
xorl %edx, %edx
movl 0x3cda5(%rip), %eax     # 0x40410
leaq 0x312e0(%rip), %rsi     # 0x34952
xorl %r13d, %r13d
movl %r13d, %r9d
movl %r9d, %r13d
testq %rdi, %rdi
je 0x3688
movb (%rdi), %r8b
testb %r8b, %r8b
jne 0x36dd
testl %eax, %eax
jne 0x369b
movl $0x1, 0x3cd7a(%rip)     # 0x40410
movl $0x1, %eax
cmpl %ebp, %eax
jge 0x377c
movslq %eax, %rcx
movq (%r15,%rcx,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x377c
movzbl 0x1(%rdi), %r8d
cmpl $0x2d, %r8d
je 0x36c8
testl %r8d, %r8d
jne 0x36d2
jmp 0x377c
cmpb $0x0, 0x2(%rdi)
je 0x3774
incq %rdi
incl %eax
movl %eax, 0x3cd33(%rip)     # 0x40410
incq %rdi
movq %rdi, 0x3cd31(%rip)     # 0x40418
movzbl %r8b, %ecx
testb %cl, %cl
je 0x3705
cmpl $0x69, %ecx
je 0x370d
cmpl $0x73, %ecx
jne 0x3baa
movl $0x1, %r9d
jmp 0x3710
movl $0x2, %r9d
jmp 0x3710
xorl %r9d, %r9d
cmpb $0x3a, 0x1(%r9,%rsi)
jne 0x3751
cmpb $0x0, (%rdi)
je 0x3733
movq %rdi, 0x3ccfc(%rip)     # 0x40420
movq $0x0, 0x3cce9(%rip) # 0x40418
xorl %edi, %edi
jmp 0x3751
cmpl %ebp, %eax
jge 0x3bb7
movslq %eax, %r9
movq (%r15,%r9,8), %r9
movq %r9, 0x3ccd7(%rip)      # 0x40420
incl %eax
movl %eax, 0x3ccbf(%rip)     # 0x40410
movl $0x1, %r9d
cmpb $0x69, %r8b
je 0x3678
cmpl $0x73, %ecx
jne 0x3bd2
movl $0x1, %edx
jmp 0x3675
incl %eax
movl %eax, 0x3cc94(%rip)     # 0x40410
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
callq 0x17f33
testq %rax, %rax
je 0x3bd7
movq %rax, %rbx
leaq 0x441(%rip), %rsi       # 0x3bdc
leaq 0x2787e(%rip), %r12     # 0x2b020
movq %rax, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x43c(%rip), %rsi       # 0x3bfd
leaq 0x2785b(%rip), %r12     # 0x2b023
movq %rbx, %rdi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x475(%rip), %rsi       # 0x3c5f
leaq 0x27837(%rip), %r12     # 0x2b028
movq %rbx, %rdi
movq %r12, %rdx
movl $0x2, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x49c(%rip), %rsi       # 0x3caf
leaq 0x27816(%rip), %r12     # 0x2b030
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x4e6(%rip), %rsi       # 0x3d1f
leaq 0x277f6(%rip), %r12     # 0x2b036
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x526(%rip), %rsi       # 0x3d85
leaq 0x277d6(%rip), %r12     # 0x2b03c
movq %rbx, %rdi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x673(%rip), %rsi       # 0x3efb
leaq 0x277b2(%rip), %r12     # 0x2b041
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x69e(%rip), %rsi       # 0x3f4c
leaq 0x27795(%rip), %r12     # 0x2b04a
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x682(%rip), %rsi       # 0x3f56
leaq 0x27774(%rip), %r12     # 0x2b04f
movq %rbx, %rdi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x661f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15f48
leaq 0x278c5(%rip), %rsi     # 0x2b1c2
movq %rbx, %rdi
callq 0x17c6d
leaq 0x279a2(%rip), %rsi     # 0x2b2ae
movq %rbx, %rdi
callq 0x17c6d
leaq 0x27a33(%rip), %rsi     # 0x2b34e
movq %rbx, %rdi
callq 0x17c6d
movslq 0x3cae6(%rip), %rax     # 0x40410
cmpl %ebp, %eax
je 0x39bc
movq %rax, (%rsp)
incl %eax
movl %eax, 0x3cad2(%rip)     # 0x40410
movq %rbx, %rdi
callq 0x1318e
movl 0x3cac4(%rip), %eax     # 0x40410
cmpl %ebp, %eax
jge 0x398b
xorl %r14d, %r14d
leal 0x1(%rax), %ecx
movl %ecx, 0x3cab4(%rip)     # 0x40410
cltq
movq (%r15,%rax,8), %rsi
movq %rbx, %rdi
callq 0x13215
leal 0x1(%r14), %r12d
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl %r14d, %edx
callq 0x134ed
movl 0x3ca8c(%rip), %eax     # 0x40410
movl %r12d, %r14d
cmpl %ebp, %eax
jl 0x3953
leaq 0x276c2(%rip), %rsi     # 0x2b054
movq %rbx, %rdi
callq 0x15f48
movq (%rsp), %rax
movq (%r15,%rax,8), %rsi
movq %rbx, %rdi
callq 0x17dc8
xorl %r14d, %r14d
testl %eax, %eax
setne %r14b
testl %r13d, %r13d
je 0x3b69
leaq 0x2769c(%rip), %rdi     # 0x2b05f
xorl %r12d, %r12d
movl $0x1, %esi
movl $0x3, %edx
movl $0x5, %ecx
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
callq 0x30e0
testl %eax, %eax
je 0x3ad6
callq 0x3340
movq 0x3c5e9(%rip), %rsi     # 0x3ffe0
movl $0x9, %edi
callq 0x3400
leaq 0x27672(%rip), %rdi     # 0x2b07a
callq 0x32e0
testq %rax, %rax
je 0x3ac7
movq %rax, %r12
leaq 0x27975(%rip), %r15     # 0x2b395
leaq 0x2797a(%rip), %r13     # 0x2b3a1
leaq 0x2764c(%rip), %rbp     # 0x2b07a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x174e3
movq %rbx, %rdi
testl %eax, %eax
jne 0x3ab9
callq 0x88f1
movq %rbx, %rdi
xorl %esi, %esi
callq 0x170f0
movq %rbx, %rdi
testl %eax, %eax
jne 0x3ac0
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1477a
testl %eax, %eax
je 0x3a7f
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r13, %rdx
callq 0x144c7
movq %rax, %rdi
callq 0x30f0
movq %rbx, %rdi
movl $0x1, %esi
callq 0x40c7
cmpb $0x0, (%r12)
je 0x3a9b
movq %r12, %rdi
callq 0x3390
movq %r12, %rdi
callq 0x31e0
movq %rbp, %rdi
callq 0x32e0
movq %rax, %r12
testq %rax, %rax
jne 0x3a2e
jmp 0x3ac7
callq 0x3420
jmp 0x3a7f
callq 0x344f
jmp 0x3a7f
movl $0xa, %edi
callq 0x3150
jmp 0x3b69
movq %r14, (%rsp)
movl $0x200, %ebp            # imm = 0x200
movq 0x3c4f2(%rip), %r14     # 0x3ffd8
xorl %r13d, %r13d
movslq %ebp, %rsi
movq %r13, %rdi
callq 0x3360
testq %rax, %rax
je 0x3b8d
movq %rax, %r15
movslq %r12d, %r13
movq %rax, %rdi
addq %r13, %rdi
movl %r13d, %eax
notl %eax
addl %ebp, %eax
movslq %eax, %rdx
movq (%r14), %rcx
movl $0x1, %esi
callq 0x32c0
movq %rax, %r12
addl %r13d, %r12d
leal -0x1(%rbp), %eax
addl %ebp, %ebp
movq %r15, %r13
cmpl %eax, %r12d
jge 0x3ae9
movq (%r14), %rdi
callq 0x3210
testl %eax, %eax
jne 0x3b97
movslq %r12d, %rax
movb $0x0, (%r15,%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x17c6d
testl %eax, %eax
movl $0x1, %eax
movq (%rsp), %r14
cmovel %eax, %r14d
movq %r15, %rdi
callq 0x31e0
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd4eb
movq %rbx, %rdi
callq 0xdc9e
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x34a1
jmp 0x3b9f
movq %r15, %rdi
callq 0x347e
movl $0x1, %r14d
xorl %r15d, %r15d
jmp 0x3b61
movsbl %r8b, %ecx
leaq 0x274c8(%rip), %rsi     # 0x2b07d
jmp 0x3bbe
leaq 0x274d7(%rip), %rsi     # 0x2b095
movq 0x3c423(%rip), %rax     # 0x3ffe8
movq (%rax), %rdi
movq (%r15), %rdx
xorl %eax, %eax
callq 0x3380
callq 0x34e9
callq 0x34c4