// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_udp.c
// Function: parse_args
static int parse_args(channel_udp_t* ctx, const char* args)
{
	char* cpy, *saveptr = NULL;
	char* p;
	char* v;

	if (!args) return -1;

	cpy = strdup(args);

	for (p = strtok_r(cpy, "&", &saveptr);
		p && *p;
		p = strtok_r(NULL, "&", &saveptr)) {

		v = strchr(p, '=');
		if (!v) continue;

		*v = '\0';
		v++;

		if (strcmp(p, "upstream") == 0) {
			int n = str2addrs(v, &ctx->upstreams[0].addr, MAX_UPSTREAM,
					sizeof(upstream_t), "53");
			if (n <= 0) {
				loge("parse address failed: %s:%s\n",
					p,
					(v && (*v)) ? v : "53"
				);
				free(cpy);
				return -1;
			}
			ctx->upstream_num = n;
		}
		else if (strcmp(p, "proxy") == 0) {
			ctx->use_proxy = strcmp(v, "0");
		}
		else if (strcmp(p, "timeout") == 0) {
			if (*v) {
				ctx->timeout = atoi(v);
			}
		}
		else {
			logw("unknown argument: %s=%s\n", p, v);
		}
	}

	free(cpy);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1969b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x198de
movq -0x18(%rbp), %rdi
callq 0x3620
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x1c954(%rip), %rsi     # 0x36007
leaq -0x28(%rbp), %rdx
callq 0x3610
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0x3d(%rbp)
je 0x196dc
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x196e8
jmp 0x198ce
movq -0x30(%rbp), %rdi
movl $0x3d, %esi
callq 0x3160
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x19706
jmp 0x198b1
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x1d40a(%rip), %rsi     # 0x36b2e
callq 0x3500
cmpl $0x0, %eax
jne 0x197ff
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x80, %rsi
movl $0x8, %edx
movl $0x90, %ecx
leaq 0x1c8d3(%rip), %r8      # 0x36025
callq 0x25580
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jg 0x197ed
jmp 0x19766
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x197d6
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x19797
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x19797
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x197a4
leaq 0x1c887(%rip), %rax     # 0x36025
movq %rax, -0x50(%rbp)
jmp 0x197a4
movq -0x48(%rbp), %r9
movq -0x50(%rbp), %rax
movl $0x3, %edi
leaq 0x1d43b(%rip), %rsi     # 0x36bf3
leaq 0x1c869(%rip), %rdx     # 0x36028
movl $0x18c, %ecx            # imm = 0x18C
leaq 0x1c868(%rip), %r8      # 0x36033
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x197d8
movq -0x20(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x198de
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x500(%rax)
jmp 0x198af
movq -0x30(%rbp), %rdi
leaq 0x1c8d1(%rip), %rsi     # 0x360db
callq 0x3500
cmpl $0x0, %eax
jne 0x19832
movq -0x38(%rbp), %rdi
leaq 0x1b5d7(%rip), %rsi     # 0x34df6
callq 0x3500
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x504(%rax)
jmp 0x198ad
movq -0x30(%rbp), %rdi
leaq 0x1d90c(%rip), %rsi     # 0x37149
callq 0x3500
cmpl $0x0, %eax
jne 0x19867
movq -0x38(%rbp), %rax
cmpb $0x0, (%rax)
je 0x19865
movq -0x38(%rbp), %rdi
callq 0x3580
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x508(%rax)
jmp 0x198ab
jmp 0x19869
movb $0x0, %al
callq 0x242d0
cmpl $0x4, (%rax)
jl 0x198a7
movq -0x30(%rbp), %r9
movq -0x38(%rbp), %rax
movl $0x4, %edi
leaq 0x1d36a(%rip), %rsi     # 0x36bf3
leaq 0x1c798(%rip), %rdx     # 0x36028
movl $0x19b, %ecx            # imm = 0x19B
leaq 0x1c92e(%rip), %r8      # 0x361ca
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x198a9
jmp 0x198ab
jmp 0x198ad
jmp 0x198af
jmp 0x198b1
xorl %eax, %eax
movl %eax, %edi
leaq 0x1c74b(%rip), %rsi     # 0x36007
leaq -0x28(%rbp), %rdx
callq 0x3610
movq %rax, -0x30(%rbp)
jmp 0x196c0
movq -0x20(%rbp), %rdi
callq 0x3460
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)