// File: /workspace/github_c_makefile_star2_O0/uhlin[P]enhanced-duc/source/main.c
// Function: main
int
main(int argc, char *argv[])
{
	char conf[DUC_PATH_MAX] = "/etc/enhanced-duc.conf";
	struct program_options opt = {
		.want_usage              = false,
		.want_create_config_file = false,
		.want_debug              = false,
		.want_update_once        = false,
		.want_daemon             = false,
	};

	if (sighand_init() == -1)
		log_warn(0, "Initialization of signal handling failed");
	if (atexit(program_clean_up) == -1)
		log_warn(errno, "Failed to register a clean up function");
	block_signals();
	duc_set_terminate();

	(void) setlocale(LC_ALL, "");
	process_options(argc, argv, &opt, &conf[0], nitems(conf));

	if (opt.want_usage) {
		usage();
		/* NOTREACHED */
	}
	if (opt.want_create_config_file) {
		char *path = NULL;

		while ((path = get_answer("Create where?",
					  TYPE_STRING,
					  &conf[0])) == NULL) {
			/* continue */;
		}

		create_config_file(path);
		free(path);
		exit(0);
	}
	if (opt.want_debug)
		turn_on_debug_mode();
	if (opt.want_update_once)
		set_cycle_off();
	if (opt.want_daemon) {
		/*
		 * Detach the program from the controlling terminal
		 * and continue execution...
		 */

		daemonize();
	}

	log_msg("%s %s has started", g_programName, g_programVersion);
	log_msg("reading %s...", conf);
	read_config_file(conf);
	check_some_settings_strictly();

	/* Drop root privileges. */
	if (geteuid() == UID_SUPER_USER) {
		force_priv_drop();
		log_msg("EUID = %ld", (long int) geteuid());
	}

	net_init();
	start_update_cycle();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x210(%rbp), %rdi
leaq 0x5239(%rip), %rsi      # 0xb600
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x4340
leaq -0x215(%rbp), %rdi
xorl %esi, %esi
movl $0x5, %edx
callq 0x4210
callq 0x9bd0
cmpl $-0x1, %eax
jne 0x63fe
xorl %edi, %edi
leaq 0x544b(%rip), %rsi      # 0xb842
movb $0x0, %al
callq 0x6300
leaq 0x375b(%rip), %rdi      # 0x9b60
callq 0xa890
cmpl $-0x1, %eax
jne 0x6424
callq 0x4050
movl (%rax), %edi
leaq 0x544e(%rip), %rsi      # 0xb86b
movb $0x0, %al
callq 0x6300
callq 0x9ab0
callq 0x9fe0
movl $0x6, %edi
leaq 0x5bf1(%rip), %rsi      # 0xc02b
callq 0x4390
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x210(%rbp), %rcx
leaq -0x215(%rbp), %rdx
movl $0x1f4, %r8d            # imm = 0x1F4
callq 0x6570
testb $0x1, -0x215(%rbp)
je 0x646d
callq 0x66a0
testb $0x1, -0x214(%rbp)
je 0x64c7
movq $0x0, -0x220(%rbp)
leaq -0x210(%rbp), %rdx
leaq 0x5403(%rip), %rdi      # 0xb892
movl $0x2, %esi
callq 0x8c50
movq %rax, -0x220(%rbp)
cmpq $0x0, %rax
jne 0x64a8
jmp 0x6481
movq -0x220(%rbp), %rdi
callq 0x9630
movq -0x220(%rbp), %rdi
callq 0x4510
xorl %edi, %edi
callq 0x4520
testb $0x1, -0x213(%rbp)
je 0x64d5
callq 0x6790
testb $0x1, -0x212(%rbp)
je 0x64e3
callq 0x67a0
testb $0x1, -0x211(%rbp)
je 0x64f1
callq 0x5260
leaq 0x53a8(%rip), %rdi      # 0xb8a0
leaq 0x50c1(%rip), %rsi      # 0xb5c0
leaq 0x50c7(%rip), %rdx      # 0xb5cd
movb $0x0, %al
callq 0x6260
leaq -0x210(%rbp), %rsi
leaq 0x5397(%rip), %rdi      # 0xb8b2
movb $0x0, %al
callq 0x6260
leaq -0x210(%rbp), %rdi
callq 0x9830
callq 0x9260
callq 0x4270
cmpl $0x0, %eax
jne 0x6559
callq 0x67b0
callq 0x4270
movl %eax, %eax
movl %eax, %esi
leaq 0x536e(%rip), %rdi      # 0xb8c0
movb $0x0, %al
callq 0x6260
callq 0x8a70
callq 0x68e0
xorl %eax, %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nop