// File: /workspace/github_c_makefile_star2_O1/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 0xbdd0(%rip), %rax      # 0x18cd7
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x1240a(%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 0xdaaf(%rip), %rcx      # 0x1a9e0
movq %rcx, 0x10(%rdi)
leaq 0x12204(%rip), %rcx     # 0x1f140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x16ef2
movq (%rbx), %rax
movq 0x18(%rax), %rcx
movq 0x120a1(%rip), %rbx     # 0x1eff8
testq %rcx, %rcx
jne 0xcf5f
movq (%rbx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
leaq 0x123b1(%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 0xbd4e(%rip), %r14      # 0x18cdc
movq 0x12043(%rip), %r15     # 0x1efd8
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x21d0
cmpl $0x23, %eax
jne 0xcfca
leaq 0x1236e(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb0c, 0xc(%rax)       # imm = 0xB0C
movq (%r15), %rdi
callq 0x167c1
jmp 0xcf95
cmpl $0x68, %eax
jle 0xcfe5
cmpl $0x74, %eax
je 0xcfdd
cmpl $0x69, %eax
jne 0xcffe
xorl %ebp, %ebp
jmp 0xcf95
movl $0x1, %r12d
jmp 0xcf95
cmpl $-0x1, %eax
je 0xd020
cmpl $0x3f, %eax
je 0xcffe
cmpl $0x56, %eax
jne 0xcffe
callq 0xcec6
jmp 0xd1a9
movq (%rbx), %rdi
leaq 0xbc9e(%rip), %rsi      # 0x18ca6
leaq 0x12141(%rip), %rdx     # 0x1f150
xorl %eax, %eax
callq 0x2170
movl $0x1, %edi
callq 0x2210
movl %ebp, 0x1c(%rsp)
leaq 0xbc9e(%rip), %rdi      # 0x18cc9
leaq 0x1211e(%rip), %rsi     # 0x1f150
leaq 0x1211f(%rip), %rdx     # 0x1f158
leaq 0x12130(%rip), %rcx     # 0x1f170
xorl %eax, %eax
callq 0x20e0
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xd73f
movq %rax, %r15
movq %rax, %rdi
callq 0xbac9
testq %r12, %r12
je 0xd069
movq %r15, %rdi
callq 0xc370
leaq 0xbc72(%rip), %rdi      # 0x18ce2
callq 0x1265c
leaq -0xa858(%rip), %rsi     # 0x2824
movq %r15, %rdi
movq %rax, %rdx
callq 0xde1a
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0xd92f
movq 0x11f34(%rip), %r13     # 0x1efd0
movl (%r13), %eax
cmpl 0xc(%rsp), %eax
jge 0xd163
leaq 0xbc3f(%rip), %r14      # 0x18cf0
leal 0x1(%rax), %ecx
movl %ecx, (%r13)
cltq
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rbx
leaq 0x12826(%rip), %rax     # 0x1f8f0
cmpl $0x0, (%rax)
je 0xd117
leaq 0x1224a(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0xd8fc(%rip), %rdi      # 0x1a9e0
movq %rdi, 0x10(%rax)
callq 0x16664
testl %eax, %eax
je 0xd117
leaq 0x12228(%rip), %rax     # 0x1f320
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xb22, 0xc(%rax)       # imm = 0xB22
leaq 0xbbd7(%rip), %rdi      # 0x18ce4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x16f63
movq %rbx, %rdi
leaq 0xd722(%rip), %rsi      # 0x1a843
callq 0x21b0
testq %rax, %rax
je 0xd1b0
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20e0
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0xd1bd
movq %rbp, %rdi
callq 0x20c0
movl (%r13), %eax
cmpl 0xc(%rsp), %eax
jl 0xd0b1
testb $0x1, 0x1c(%rsp)
jne 0xd18b
leaq 0xbcb1(%rip), %rdi      # 0x18e22
callq 0x20a0
movq 0x11e4b(%rip), %rax     # 0x1efc8
movq (%rax), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0xd1bd
movq %r15, %rdi
callq 0xf0bb
callq 0xce8c
leaq 0x20(%rsp), %rdi
movl $0xb33, 0xc(%rdi)       # imm = 0xB33
callq 0x17077
xorl %edi, %edi
callq 0x2210
movq %rbx, %rdi
callq 0x21c0
jmp 0xd016