// File: /workspace/github_c_makefile_star2_O0/ccxvii[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
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x39abf(%rip), %rdx     # 0x3cfd8
callq 0x3900
movl %eax, -0x34(%rbp)
cmpl $-0x1, %eax
je 0x3556
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
subl $0x69, %eax
je 0x3544
jmp 0x3533
movl -0x38(%rbp), %eax
subl $0x73, %eax
je 0x354d
jmp 0x353d
callq 0x3b30
jmp 0x3554
movl $0x1, -0x2c(%rbp)
jmp 0x3554
movl $0x1, -0x28(%rbp)
jmp 0x350b
movl -0x28(%rbp), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x19940
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x359f
movq 0x43a64(%rip), %rax     # 0x46fe8
movq (%rax), %rdi
leaq 0x2fa76(%rip), %rsi     # 0x33004
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x3100
movq -0x20(%rbp), %rdi
leaq 0x5e6(%rip), %rsi       # 0x3b90
leaq 0x2fa6f(%rip), %rdx     # 0x33020
xorl %ecx, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2fa5d(%rip), %rsi     # 0x33020
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x5fd(%rip), %rsi       # 0x3bd0
leaq 0x2fa49(%rip), %rdx     # 0x33023
movl $0x1, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2fa34(%rip), %rsi     # 0x33023
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x661(%rip), %rsi       # 0x3c60
leaq 0x2fa22(%rip), %rdx     # 0x33028
movl $0x2, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2fa0d(%rip), %rsi     # 0x33028
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x6b5(%rip), %rsi       # 0x3ce0
leaq 0x2f9fe(%rip), %rdx     # 0x33030
xorl %ecx, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f9ec(%rip), %rsi     # 0x33030
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x70c(%rip), %rsi       # 0x3d60
leaq 0x2f9db(%rip), %rdx     # 0x33036
xorl %ecx, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f9c9(%rip), %rsi     # 0x33036
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x763(%rip), %rsi       # 0x3de0
leaq 0x2f9b8(%rip), %rdx     # 0x3303c
movl $0x1, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f9a3(%rip), %rsi     # 0x3303c
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x977(%rip), %rsi       # 0x4020
leaq 0x2f991(%rip), %rdx     # 0x33041
xorl %ecx, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f97f(%rip), %rsi     # 0x33041
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x9ae(%rip), %rsi       # 0x4080
leaq 0x2f971(%rip), %rdx     # 0x3304a
xorl %ecx, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f95f(%rip), %rsi     # 0x3304a
callq 0x17250
movq -0x20(%rbp), %rdi
leaq 0x9a5(%rip), %rsi       # 0x40a0
leaq 0x2f94d(%rip), %rdx     # 0x3304f
movl $0x1, %ecx
callq 0x6580
movq -0x20(%rbp), %rdi
leaq 0x2f938(%rip), %rsi     # 0x3304f
callq 0x17250
movq -0x20(%rbp), %rdi
movq 0x43ad9(%rip), %rsi     # 0x47200
callq 0x196d0
movq -0x20(%rbp), %rdi
movq 0x43ad1(%rip), %rsi     # 0x47208
callq 0x196d0
movq -0x20(%rbp), %rdi
movq 0x43ac9(%rip), %rsi     # 0x47210
callq 0x196d0
movl 0x446ee(%rip), %eax     # 0x47e40
cmpl -0x8(%rbp), %eax
jne 0x3763
movl $0x1, -0x2c(%rbp)
jmp 0x3805
movl 0x446d7(%rip), %eax     # 0x47e40
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x446cc(%rip)     # 0x47e40
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rdi
callq 0x13830
movl $0x0, -0x30(%rbp)
movl 0x446b3(%rip), %eax     # 0x47e40
cmpl -0x8(%rbp), %eax
jge 0x37d2
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x446a0(%rip), %ecx     # 0x47e40
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x44695(%rip)     # 0x47e40
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x13880
movq -0x20(%rbp), %rdi
movl -0x30(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
jmp 0x3787
movq -0x20(%rbp), %rdi
leaq 0x2f877(%rip), %rsi     # 0x33054
callq 0x17250
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x197c0
cmpl $0x0, %eax
je 0x3803
movl $0x1, -0x24(%rbp)
jmp 0x3805
cmpl $0x0, -0x2c(%rbp)
je 0x38df
leaq 0x2f849(%rip), %rdi     # 0x3305f
movl $0x1, %esi
movl $0x3, %edx
movl $0x5, %ecx
movb $0x0, %al
callq 0x3030
xorl %edi, %edi
callq 0x30d0
cmpl $0x0, %eax
je 0x38ab
callq 0x3320
movl $0x9, %edi
movq 0x43797(%rip), %rsi     # 0x46fe0
callq 0x33d0
leaq 0x2f825(%rip), %rdi     # 0x3307a
callq 0x32c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x389f
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x40d0
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3884
movq -0x18(%rbp), %rdi
callq 0x3360
movq -0x18(%rbp), %rdi
callq 0x31c0
leaq 0x2f7e6(%rip), %rdi     # 0x3307a
callq 0x32c0
movq %rax, -0x18(%rbp)
jmp 0x385e
movl $0xa, %edi
callq 0x3130
jmp 0x38dd
callq 0x4210
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x38cd
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x196d0
cmpl $0x0, %eax
jne 0x38d4
movl $0x1, -0x24(%rbp)
movq -0x18(%rbp), %rdi
callq 0x31c0
jmp 0x38df
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xcae0
movq -0x20(%rbp), %rdi
callq 0xd780
movl -0x24(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)