// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-cmd.c
// Function: main2
static int main2(int argc, char **argv)
{
	deark *c = NULL;
	struct cmdctx *cc = NULL;
	int ret;
	int exit_status = 0;

	cc = de_malloc(NULL, sizeof(struct cmdctx));
	c = de_create();
	cc->c = c;

	de_set_userdata(c, (void*)cc);
	de_set_fatalerror_callback(c, our_fatalerrorfn);
	de_set_messages_callback(c, our_msgfn);
	de_set_special_messages_callback(c, our_specialmsgfn);
	cc->plctx = de_platformdata_create();

	if(argc<2) { // Empty command line
		print_help(c);
		goto done;
	}

	parse_cmdline(c, cc, argc, argv);

	if(cc->error_flag) {
		if(cc->show_usage_message) {
			print_usage_error(c);
		}
		goto done;
	}

	if(cc->special_command_flag) {
		switch(cc->special_command_code) {
		case CMD_PRINTHELP:
			print_help(c);
			break;
		case CMD_PRINTVERSION:
			print_version(c, 1);
			break;
		case CMD_PRINTLICENSE:
			print_license(c);
			break;
		case CMD_PRINTMODULES:
			print_modules(c);
			break;
		default:
			break;
		}
		goto done;
	}

#ifdef DE_WINDOWS
	if(cc->to_stdout) {
		(void)_setmode(_fileno(stdout), _O_BINARY);
	}
	if(cc->from_stdin) {
		(void)_setmode(_fileno(stdin), _O_BINARY);
	}
#endif

	ret = de_run(c);
	if(!ret) {
		exit_status = 1;
	}

done:
	de_destroy(c);
	de_platformdata_destroy(cc->plctx);
	cc->plctx = NULL;
	if(cc->error_flag) exit_status = 1;
	de_free(NULL, cc);
	return exit_status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
movl $0x478, %esi            # imm = 0x478
callq 0x15b780
movq %rax, -0x20(%rbp)
callq 0x1ab70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x18eba0
movq -0x18(%rbp), %rdi
leaq 0x14c(%rip), %rsi       # 0x195a0
callq 0x18ec20
movq -0x18(%rbp), %rdi
leaq 0x16c(%rip), %rsi       # 0x195d0
callq 0x18ebe0
movq -0x18(%rbp), %rdi
leaq 0x1ec(%rip), %rsi       # 0x19660
callq 0x18ec00
callq 0x1901e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x2, -0x4(%rbp)
jge 0x1949d
movq -0x18(%rbp), %rdi
callq 0x19750
jmp 0x19555
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
movq -0x10(%rbp), %rcx
callq 0x197a0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x194d3
movq -0x20(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x194ce
movq -0x18(%rbp), %rdi
callq 0x1a300
jmp 0x19555
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x1953a
movq -0x20(%rbp), %rax
movl 0x24(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x3, %eax
ja 0x19536
movq -0x30(%rbp), %rax
leaq 0x182b08(%rip), %rcx    # 0x19c004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
callq 0x19750
jmp 0x19538
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x1a330
jmp 0x19538
movq -0x18(%rbp), %rdi
callq 0x1a3b0
jmp 0x19538
movq -0x18(%rbp), %rdi
callq 0x1a3e0
jmp 0x19538
jmp 0x19538
jmp 0x19555
movq -0x18(%rbp), %rdi
callq 0x18d940
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x19553
movl $0x1, -0x28(%rbp)
jmp 0x19555
movq -0x18(%rbp), %rdi
callq 0x18e950
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x190210
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x19588
movl $0x1, -0x28(%rbp)
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x15b820
movl -0x28(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop