// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/config.c
// Function: conf_check
int conf_check(config_t* conf)
{
	int channel_num = 0;
	int channel_args_num = 0;
	char** p;

	if (conf->listen_addr == NULL) {
		conf->listen_addr = strdup(DEFAULT_LISTEN_ADDR);
	}
	if (conf->listen_port == NULL) {
		conf->listen_port = strdup(DEFAULT_LISTEN_PORT);
	}
	if (conf->timeout <= 0) {
		conf->timeout = DEFAULT_TIMEOUT;
	}
	if (conf->cache_timeout < 0) {
		conf->cache_timeout = CACHE_TIMEOUT_FOLLOWING_TTL;
	}
	if (conf->channel_choose_mode < 0) {
		conf->channel_choose_mode = CHOOSE_MODE_CONCUR;
	}
	if (conf->channels == NULL) {
		if (conf_add_channel(conf, DEFAULT_CHANNEL)) {
			return -1;
		}
	}
	if (conf->channel_args == NULL) {
		if (conf_add_channel_args(conf, DEFAULT_CHANNEL_ARGS)) {
			return -1;
		}
	}
	if (conf->wwwroot == NULL) {
		conf->wwwroot = strdup(DEFAULT_WWWROOT);
	}

	p = conf->channels;
	while (p && *p) {
		channel_num++;
		p++;
	}

	p = conf->channel_args;
	while (p && *p) {
		channel_args_num++;
		p++;
	}

	if (channel_num != channel_args_num) {
		loge("channel and channel_args are not match\n");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1cbca
leaq 0x1a5cf(%rip), %rdi     # 0x3718a
callq 0x3620
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1cbec
leaq 0x19449(%rip), %rdi     # 0x36025
callq 0x3620
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x88(%rax)
jg 0x1cc07
movq -0x10(%rbp), %rax
movl $0x5, 0x88(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8c(%rax)
jge 0x1cc22
movq -0x10(%rbp), %rax
movl $0x1, 0x8c(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x80(%rax)
jge 0x1cc3d
movq -0x10(%rbp), %rax
movl $0x1, 0x80(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x1cc6b
movq -0x10(%rbp), %rdi
leaq 0x18f92(%rip), %rsi     # 0x35be5
callq 0x1c970
cmpl $0x0, %eax
je 0x1cc69
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1cd95
jmp 0x1cc6b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x1cc99
movq -0x10(%rbp), %rdi
leaq 0x1a511(%rip), %rsi     # 0x37192
callq 0x1ca80
cmpl $0x0, %eax
je 0x1cc97
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1cd95
jmp 0x1cc99
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x1ccbb
leaq 0x1a526(%rip), %rdi     # 0x371d1
callq 0x3620
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x21(%rbp)
je 0x1cce1
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x1ccea
jmp 0x1cd01
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
jmp 0x1ccc7
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x22(%rbp)
je 0x1cd27
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
setne %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x1cd30
jmp 0x1cd47
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
jmp 0x1cd0d
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
je 0x1cd8e
jmp 0x1cd51
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1cd83
movl $0x3, %edi
leaq 0x1a480(%rip), %rsi     # 0x371e9
leaq 0x1a486(%rip), %rdx     # 0x371f6
movl $0xe4, %ecx
leaq 0x1a485(%rip), %r8      # 0x37201
movb $0x0, %al
callq 0x243b0
jmp 0x1cd85
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1cd95
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop