// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/schemer.c
// Function: main
int
main(int argc, char** argv)
{
	int c;
	BOOL test_mode = FALSE;			/* flag to run unit tests */
	BOOL interactive = FALSE;		/* flag to run unit tests */

	DBUG_ENTER("main");
	DBUG_PROCESS(argv[0]);
	while ((c = getopt(argc, argv, "ti#:V")) != EOF) {
		switch(c) {
		case 't':	test_mode = TRUE;		break;
		case 'i':	interactive = TRUE;		break;
		case '#':	DBUG_PUSH(optarg);		break;
		case 'V':	banner();				exit(EXIT_SUCCESS);
		case '?':							usage();
		default:							usage();
		}
	}
	banner();
	{
		CONFIG* cfg = new_configuration(1000);
		CONS* show_result;

		init_schemer(cfg);		/* pre-load global definitions */
		if (test_mode) {
			test_schemer(cfg);	/* this test involves running the dispatch loop */
		}
#if 1
		show_result = CFG_ACTOR(cfg, println_beh, ATOM("="));
		cfg_add_gc_root(cfg, show_result);		/* protect from gc */
		while (optind < argc) {
			FILE* f;
			char* filename = argv[optind++];

			DBUG_PRINT("", ("filename=%s", filename));
			if ((f = fopen(filename, "r")) == NULL) {
				perror(filename);
				exit(EXIT_FAILURE);
			}
			TRACE(printf("Loading %s...\n", filename));
			read_reduce_print(cfg, f, show_result);
			fclose(f);
		}
		if (interactive) {
			printf("Entering INTERACTIVE mode.\n");
			read_reduce_print(cfg, stdin, show_result);
		}
#endif
		report_actor_usage(cfg);
		report_cons_stats();
	}
	DBUG_RETURN (exit(EXIT_SUCCESS), 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xb30c(%rip), %rax      # 0x17cd7
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x11946(%rip), %r14     # 0x1e320
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0xb06, 0xc(%rdi)       # imm = 0xB06
leaq 0xcfc7(%rip), %rcx      # 0x199bc
movq %rcx, 0x10(%rdi)
leaq 0x11740(%rip), %rcx     # 0x1e140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x16679
movq (%r14), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
jne 0xca23
movq 0x115d8(%rip), %rcx     # 0x1dff8
movq (%rcx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
leaq 0x118ed(%rip), %rcx     # 0x1e320
movq (%rcx), %rcx
movl %eax, 0x10(%rcx)
movq (%rbx), %rax
movq %rax, 0x8(%rcx)
movb $0x1, %al
movl %eax, 0x4(%rsp)
xorl %r15d, %r15d
leaq 0xb28c(%rip), %r14      # 0x17cdc
movq 0x11581(%rip), %r12     # 0x1dfd8
pushq $0x1
popq %r13
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x21e0
cmpl $0x23, %eax
jne 0xca8d
leaq 0x118ac(%rip), %rax     # 0x1e320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb0c, 0xc(%rax)       # imm = 0xB0C
movq (%r12), %rdi
callq 0x15f4d
jmp 0xca5b
cmpl $0x69, %eax
je 0xca9c
cmpl $0x74, %eax
jne 0xcaa6
movq %r13, %r15
jmp 0xca5b
movl $0x0, 0x4(%rsp)
jmp 0xca5b
cmpl $-0x1, %eax
je 0xcac4
cmpl $0x3f, %eax
je 0xcabf
cmpl $0x56, %eax
jne 0xcabf
callq 0xc98e
jmp 0xcc1a
callq 0xc966
callq 0xc98e
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xd310
movq %rax, %r12
movq %rax, %rdi
callq 0xb595
testq %r15, %r15
je 0xcaeb
movq %r12, %rdi
callq 0xbe3a
leaq 0xb1f0(%rip), %rdi      # 0x17ce2
callq 0x11f1f
leaq -0xa6da(%rip), %rsi     # 0x2424
movq %r12, %rdi
movq %rax, %rdx
callq 0xd9b7
movq %r12, %rdi
movq %rax, 0x8(%rsp)
movq %rax, %rsi
callq 0xd4e3
movq 0x114b0(%rip), %r15     # 0x1dfd0
movslq (%r15), %rax
cmpl %ebp, %eax
jge 0xcbd2
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
movq (%rbx,%rax,8), %r13
leaq 0x11db4(%rip), %rax     # 0x1e8f0
cmpl $0x0, (%rax)
je 0xcb89
leaq 0x117d8(%rip), %rax     # 0x1e320
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0xce66(%rip), %rdi      # 0x199bc
movq %rdi, 0x10(%rax)
callq 0x15df4
testl %eax, %eax
je 0xcb89
leaq 0x117b6(%rip), %rax     # 0x1e320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb22, 0xc(%rax)       # imm = 0xB22
leaq 0xb165(%rip), %rdi      # 0x17ce4
movq %r13, %rsi
xorl %eax, %eax
callq 0x166f0
movq %r13, %rdi
leaq 0xcc8c(%rip), %rsi      # 0x1981f
callq 0x21c0
testq %rax, %rax
je 0xcc21
movq %rax, %r14
leaq 0xb145(%rip), %rdi      # 0x17cf0
movq %r13, %rsi
xorl %eax, %eax
callq 0x20e0
movq %r12, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
callq 0xcc31
movq %r14, %rdi
callq 0x20c0
jmp 0xcb20
testb $0x1, 0x4(%rsp)
jne 0xcbfc
leaq 0xb242(%rip), %rdi      # 0x17e22
callq 0x20a0
movq 0x113dc(%rip), %rax     # 0x1dfc8
movq (%rax), %rsi
movq %r12, %rdi
movq 0x8(%rsp), %rdx
callq 0xcc31
movq %r12, %rdi
callq 0xec46
callq 0xc956
leaq 0x10(%rsp), %rdi
movl $0xb33, 0xc(%rdi)       # imm = 0xB33
callq 0x167f2
xorl %edi, %edi
callq 0x2220
movq %r13, %rdi
callq 0x21d0
pushq $0x1
popq %rdi
callq 0x2220