// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movl %edi, %ebp
leaq 0xb8a2(%rip), %rax      # 0x13e00
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x11e2b(%rip), %r12     # 0x1a398
movq (%r12), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x728, 0xc(%rdi)       # imm = 0x728
leaq 0xd55b(%rip), %rcx      # 0x15ae4
movq %rcx, 0x10(%rdi)
leaq 0x11bac(%rip), %rcx     # 0x1a140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x12bb9
movq (%r12), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
jne 0x85b8
movq 0x11a43(%rip), %rcx     # 0x19ff8
movq (%rcx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
movq (%r12), %rcx
movl %eax, 0x10(%rcx)
movq (%rbx), %rax
movq %rax, 0x8(%rcx)
movb $0x1, %al
movl %eax, 0xc(%rsp)
xorl %r14d, %r14d
leaq 0xb826(%rip), %r15      # 0x13e05
movq 0x119f2(%rip), %r13     # 0x19fd8
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x21e0
cmpl $0x23, %eax
jne 0x8612
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x72e, 0xc(%rax)       # imm = 0x72E
movq (%r13), %rdi
callq 0x1248d
jmp 0x85e6
cmpl $0x69, %eax
je 0x8622
cmpl $0x74, %eax
jne 0x862c
pushq $0x1
popq %r14
jmp 0x85e6
movl $0x0, 0xc(%rsp)
jmp 0x85e6
cmpl $-0x1, %eax
je 0x864a
cmpl $0x3f, %eax
je 0x8645
cmpl $0x56, %eax
jne 0x8645
callq 0x8521
jmp 0x87a1
callq 0x84f9
callq 0x8521
testq %r14, %r14
jne 0x8753
callq 0x887c
movq %rax, %r15
leaq 0xa99d(%rip), %rdi      # 0x13004
callq 0xe45f
movq %rax, %r14
leaq 0xb795(%rip), %rdi      # 0x13e0b
callq 0xe45f
leaq 0x11c86(%rip), %rdi     # 0x1a308
movq %r14, %rsi
movq %rax, %rdx
callq 0x11339
leaq -0x6348(%rip), %rsi     # 0x234c
movq %r15, 0x18(%rsp)
movq %r15, %rdi
movq %rax, %rdx
callq 0x9ef7
movq %rax, 0x10(%rsp)
movq 0x11920(%rip), %r15     # 0x19fd0
movslq (%r15), %rax
cmpl %ebp, %eax
jge 0x875a
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
movq (%rbx,%rax,8), %r14
leaq 0x12274(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x870d
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd404(%rip), %rdi      # 0x15ae4
movq %rdi, 0x10(%rax)
callq 0x12334
testl %eax, %eax
je 0x870d
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x741, 0xc(%rax)       # imm = 0x741
leaq 0xb70b(%rip), %rdi      # 0x13e0e
movq %r14, %rsi
xorl %eax, %eax
callq 0x12c30
movq %r14, %rdi
leaq 0xd232(%rip), %rsi      # 0x15949
callq 0x21c0
testq %rax, %rax
je 0x87a8
movq %rax, %r13
leaq 0xb6eb(%rip), %rdi      # 0x13e1a
movq %r14, %rsi
xorl %eax, %eax
callq 0x20e0
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x87b8
movq %r13, %rdi
callq 0x20c0
jmp 0x86b0
callq 0x7d5f
jmp 0x878b
testb $0x1, 0xc(%rsp)
jne 0x8781
leaq 0xb800(%rip), %rdi      # 0x13f68
callq 0x20a0
movq 0x11854(%rip), %rax     # 0x19fc8
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x87b8
movq 0x18(%rsp), %rdi
callq 0xb186
callq 0x84e9
leaq 0x20(%rsp), %rdi
movl $0x751, 0xc(%rdi)       # imm = 0x751
callq 0x12d32
xorl %edi, %edi
callq 0x2220
movq %r14, %rdi
callq 0x21d0
pushq $0x1
popq %rdi
callq 0x2220