// File: /workspace/github_c_makefile_star2_O1/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 0xc489(%rip), %rax      # 0x14e00
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x12a02(%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 0xe163(%rip), %rcx      # 0x16b04
movq %rcx, 0x10(%rdi)
leaq 0x12784(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x13322
movq (%rbx), %rax
movq 0x18(%rax), %rcx
movq 0x12631(%rip), %rbx     # 0x1aff8
testq %rcx, %rcx
jne 0x89cf
movq (%rbx), %rcx
movq %rcx, 0x18(%rax)
callq 0x20b0
leaq 0x129a9(%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 0xc407(%rip), %r15      # 0x14e05
movq 0x125d3(%rip), %r12     # 0x1afd8
movl 0x4(%rsp), %edi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x21d0
cmpl $0x23, %eax
jne 0x8a3b
leaq 0x12966(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0x72e, 0xc(%rax)       # imm = 0x72E
movq (%r12), %rdi
callq 0x12bf1
jmp 0x8a05
cmpl $0x68, %eax
jle 0x8a56
cmpl $0x74, %eax
je 0x8a4e
cmpl $0x69, %eax
jne 0x8a6f
xorl %ebp, %ebp
jmp 0x8a05
movl $0x1, %r14d
jmp 0x8a05
cmpl $-0x1, %eax
je 0x8a91
cmpl $0x3f, %eax
je 0x8a6f
cmpl $0x56, %eax
jne 0x8a6f
callq 0x8936
jmp 0x8c27
movq (%rbx), %rdi
leaq 0xc356(%rip), %rsi      # 0x14dcf
leaq 0x12738(%rip), %rdx     # 0x1b1b8
xorl %eax, %eax
callq 0x2170
movl $0x1, %edi
callq 0x2210
leaq 0xc35a(%rip), %rdi      # 0x14df2
leaq 0x12719(%rip), %rsi     # 0x1b1b8
leaq 0x12719(%rip), %rdx     # 0x1b1bf
leaq 0x12723(%rip), %rcx     # 0x1b1d0
xorl %eax, %eax
callq 0x20e0
testq %r14, %r14
jne 0x8c0c
movl %ebp, 0x14(%rsp)
callq 0x8cff
movq %rax, %r14
leaq 0xb534(%rip), %rdi      # 0x14004
callq 0xea8c
movq %rax, %rbx
leaq 0xc32c(%rip), %rdi      # 0x14e0b
callq 0xea8c
leaq 0x1280d(%rip), %rdi     # 0x1b2f8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x11afc
leaq -0x63b1(%rip), %rsi     # 0x274c
movq %r14, 0x18(%rsp)
movq %r14, %rdi
movq %rax, %rdx
callq 0xa24a
movq %rax, %r12
movq 0x124b9(%rip), %rbp     # 0x1afd0
movl (%rbp), %eax
cmpl 0x4(%rsp), %eax
jge 0x8bdb
leaq 0xde3e(%rip), %r13      # 0x16969
leaq 0xc2e8(%rip), %r15      # 0x14e1a
leal 0x1(%rax), %ecx
movl %ecx, (%rbp)
cltq
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %r14
leaq 0x12de6(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x8b97
leaq 0x12832(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0xdfa0(%rip), %rdi      # 0x16b04
movq %rdi, 0x10(%rax)
callq 0x12a94
testl %eax, %eax
je 0x8b97
leaq 0x12810(%rip), %rax     # 0x1b388
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0x741, 0xc(%rax)       # imm = 0x741
leaq 0xc281(%rip), %rdi      # 0x14e0e
movq %r14, %rsi
xorl %eax, %eax
callq 0x13393
movq %r14, %rdi
movq %r13, %rsi
callq 0x21b0
testq %rax, %rax
je 0x8c2e
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8c3b
movq %rbx, %rdi
callq 0x20c0
movl (%rbp), %eax
cmpl 0x4(%rsp), %eax
jl 0x8b32
testb $0x1, 0x14(%rsp)
jne 0x8c00
leaq 0xc37f(%rip), %rdi      # 0x14f68
callq 0x20a0
movq 0x123d3(%rip), %rax     # 0x1afc8
movq (%rax), %rdi
movq %r12, %rsi
callq 0x8c3b
movq 0x18(%rsp), %rdi
callq 0xb4eb
jmp 0x8c11
callq 0x8172
callq 0x88fc
leaq 0x20(%rsp), %rdi
movl $0x751, 0xc(%rdi)       # imm = 0x751
callq 0x134a7
xorl %edi, %edi
callq 0x2210
movq %r14, %rdi
callq 0x21c0
jmp 0x8a87