// File: /workspace/github_c_makefile_star2_O3/dalnefre[P]kernel_abe/reduce.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();
	if (test_mode) {
		test_reduce();	/* this test involves running the dispatch loop */
	} else {
		CONFIG* cfg;
		CONS* show_result;

		cfg = init_reduce();
		show_result = CFG_ACTOR(cfg, print_msg,
			map_put(NIL, ATOM("message"), ATOM("= ")));
		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(f, show_result);
			fclose(f);
		}
		if (interactive) {
			printf("Entering INTERACTIVE mode.\n");
			read_reduce_print(stdin, show_result);
		}
		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, 0x8(%rsp)
movl %edi, 0x4(%rsp)
leaq 0xc4d1(%rip), %rax      # 0x14e00
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x12a4a(%rip), %rbx     # 0x1b388
movq (%rbx), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x728, 0xc(%rdi)       # imm = 0x728
leaq 0xe1ab(%rip), %rcx      # 0x16b04
movq %rcx, 0x10(%rdi)
leaq 0x127cc(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1339a
movq (%rbx), %rax
movq 0x18(%rax), %rcx
movq 0x12679(%rip), %rbx     # 0x1aff8
testq %rcx, %rcx
jne 0x8987
movq (%rbx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
leaq 0x129f1(%rip), %rcx     # 0x1b388
movq (%rcx), %rcx
movl %eax, 0x10(%rcx)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rcx)
movb $0x1, %bpl
xorl %r14d, %r14d
leaq 0xc44f(%rip), %r15      # 0x14e05
movq 0x1261b(%rip), %r12     # 0x1afd8
movl 0x4(%rsp), %edi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x21d0
cmpl $0x23, %eax
jne 0x89f3
leaq 0x129ae(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0x72e, 0xc(%rax)       # imm = 0x72E
movq (%r12), %rdi
callq 0x12c59
jmp 0x89bd
cmpl $0x68, %eax
jle 0x8a0e
cmpl $0x74, %eax
je 0x8a06
cmpl $0x69, %eax
jne 0x8a27
xorl %ebp, %ebp
jmp 0x89bd
movl $0x1, %r14d
jmp 0x89bd
cmpl $-0x1, %eax
je 0x8a49
cmpl $0x3f, %eax
je 0x8a27
cmpl $0x56, %eax
jne 0x8a27
callq 0x88ee
jmp 0x8bdf
movq (%rbx), %rdi
leaq 0xc39e(%rip), %rsi      # 0x14dcf
leaq 0x12780(%rip), %rdx     # 0x1b1b8
xorl %eax, %eax
callq 0x2170
movl $0x1, %edi
callq 0x2210
leaq 0xc3a2(%rip), %rdi      # 0x14df2
leaq 0x12761(%rip), %rsi     # 0x1b1b8
leaq 0x12761(%rip), %rdx     # 0x1b1bf
leaq 0x1276b(%rip), %rcx     # 0x1b1d0
xorl %eax, %eax
callq 0x20e0
testq %r14, %r14
jne 0x8bc4
movl %ebp, 0x14(%rsp)
callq 0x8cb7
movq %rax, %r14
leaq 0xb57c(%rip), %rdi      # 0x14004
callq 0xea73
movq %rax, %rbx
leaq 0xc374(%rip), %rdi      # 0x14e0b
callq 0xea73
leaq 0x12855(%rip), %rdi     # 0x1b2f8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x11b2c
leaq -0x63c9(%rip), %rsi     # 0x26ec
movq %r14, 0x18(%rsp)
movq %r14, %rdi
movq %rax, %rdx
callq 0xa232
movq %rax, %r12
movq 0x12501(%rip), %rbp     # 0x1afd0
movl (%rbp), %eax
cmpl 0x4(%rsp), %eax
jge 0x8b93
leaq 0xde86(%rip), %r13      # 0x16969
leaq 0xc330(%rip), %r15      # 0x14e1a
leal 0x1(%rax), %ecx
movl %ecx, (%rbp)
cltq
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %r14
leaq 0x12e2e(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x8b4f
leaq 0x1287a(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0xdfe8(%rip), %rdi      # 0x16b04
movq %rdi, 0x10(%rax)
callq 0x12afc
testl %eax, %eax
je 0x8b4f
leaq 0x12858(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0x741, 0xc(%rax)       # imm = 0x741
leaq 0xc2c9(%rip), %rdi      # 0x14e0e
movq %r14, %rsi
xorl %eax, %eax
callq 0x1340b
movq %r14, %rdi
movq %r13, %rsi
callq 0x21b0
testq %rax, %rax
je 0x8be6
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8bf3
movq %rbx, %rdi
callq 0x20c0
movl (%rbp), %eax
cmpl 0x4(%rsp), %eax
jl 0x8aea
testb $0x1, 0x14(%rsp)
jne 0x8bb8
leaq 0xc3c7(%rip), %rdi      # 0x14f68
callq 0x20a0
movq 0x1241b(%rip), %rax     # 0x1afc8
movq (%rax), %rdi
movq %r12, %rsi
callq 0x8bf3
movq 0x18(%rsp), %rdi
callq 0xb4f4
jmp 0x8bc9
callq 0x812a
callq 0x88b4
leaq 0x20(%rsp), %rdi
movl $0x751, 0xc(%rdi)       # imm = 0x751
callq 0x1351f
xorl %edi, %edi
callq 0x2210
movq %r14, %rdi
callq 0x21c0
jmp 0x8a3f