// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rsi, 0x10(%rsp)
movl %edi, 0xc(%rsp)
leaq 0xbeda(%rip), %rax      # 0x18cd7
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x12514(%rip), %rbx     # 0x1f320
movq (%rbx), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0xb06, 0xc(%rdi)       # imm = 0xB06
leaq 0xdbb9(%rip), %rcx      # 0x1a9e0
movq %rcx, 0x10(%rdi)
leaq 0x1230e(%rip), %rcx     # 0x1f140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x16ea2
movq (%rbx), %rax
movq 0x18(%rax), %rcx
movq 0x121ab(%rip), %rbx     # 0x1eff8
testq %rcx, %rcx
jne 0xce55
movq (%rbx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
leaq 0x124bb(%rip), %rcx     # 0x1f320
movq (%rcx), %rcx
movl %eax, 0x10(%rcx)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rcx)
movb $0x1, %bpl
xorl %r12d, %r12d
leaq 0xbe58(%rip), %r14      # 0x18cdc
movq 0x1214d(%rip), %r15     # 0x1efd8
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x21d0
cmpl $0x23, %eax
jne 0xcec0
leaq 0x12478(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb0c, 0xc(%rax)       # imm = 0xB0C
movq (%r15), %rdi
callq 0x16761
jmp 0xce8b
cmpl $0x68, %eax
jle 0xcedb
cmpl $0x74, %eax
je 0xced3
cmpl $0x69, %eax
jne 0xcef4
xorl %ebp, %ebp
jmp 0xce8b
movl $0x1, %r12d
jmp 0xce8b
cmpl $-0x1, %eax
je 0xcf16
cmpl $0x3f, %eax
je 0xcef4
cmpl $0x56, %eax
jne 0xcef4
callq 0xcdbc
jmp 0xd09f
movq (%rbx), %rdi
leaq 0xbda8(%rip), %rsi      # 0x18ca6
leaq 0x1224b(%rip), %rdx     # 0x1f150
xorl %eax, %eax
callq 0x2170
movl $0x1, %edi
callq 0x2210
movl %ebp, 0x1c(%rsp)
leaq 0xbda8(%rip), %rdi      # 0x18cc9
leaq 0x12228(%rip), %rsi     # 0x1f150
leaq 0x12229(%rip), %rdx     # 0x1f158
leaq 0x1223a(%rip), %rcx     # 0x1f170
xorl %eax, %eax
callq 0x20e0
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xd675
movq %rax, %r15
movq %rax, %rdi
callq 0xb9bf
testq %r12, %r12
je 0xcf5f
movq %r15, %rdi
callq 0xc266
leaq 0xbd7c(%rip), %rdi      # 0x18ce2
callq 0x1257b
leaq -0xa7ae(%rip), %rsi     # 0x27c4
movq %r15, %rdi
movq %rax, %rdx
callq 0xdd3a
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0xd84f
movq 0x1203e(%rip), %r13     # 0x1efd0
movl (%r13), %eax
cmpl 0xc(%rsp), %eax
jge 0xd059
leaq 0xbd49(%rip), %r14      # 0x18cf0
leal 0x1(%rax), %ecx
movl %ecx, (%r13)
cltq
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rbx
leaq 0x12930(%rip), %rax     # 0x1f8f0
cmpl $0x0, (%rax)
je 0xd00d
leaq 0x12354(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0xda06(%rip), %rdi      # 0x1a9e0
movq %rdi, 0x10(%rax)
callq 0x16604
testl %eax, %eax
je 0xd00d
leaq 0x12332(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb22, 0xc(%rax)       # imm = 0xB22
leaq 0xbce1(%rip), %rdi      # 0x18ce4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x16f13
movq %rbx, %rdi
leaq 0xd82c(%rip), %rsi      # 0x1a843
callq 0x21b0
testq %rax, %rax
je 0xd0a6
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20e0
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0xd0b3
movq %rbp, %rdi
callq 0x20c0
movl (%r13), %eax
cmpl 0xc(%rsp), %eax
jl 0xcfa7
testb $0x1, 0x1c(%rsp)
jne 0xd081
leaq 0xbdbb(%rip), %rdi      # 0x18e22
callq 0x20a0
movq 0x11f55(%rip), %rax     # 0x1efc8
movq (%rax), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0xd0b3
movq %r15, %rdi
callq 0xeffc
callq 0xcd82
leaq 0x20(%rsp), %rdi
movl $0xb33, 0xc(%rdi)       # imm = 0xB33
callq 0x17027
xorl %edi, %edi
callq 0x2210
movq %rbx, %rdi
callq 0x21c0
jmp 0xcf0c