// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_udp.c
// Function: parse_recv
static int parse_recv(channel_udp_t* c, char* buf, int buf_len, struct sockaddr* from, int from_len)
{
	udpreq_t* req;
	ns_msg_t* result = NULL;
	rbnode_t* rbn;

	result = (ns_msg_t*)malloc(sizeof(ns_msg_t));
	if (!result) {
		loge("alloc\n");
		return -1;
	}

	if (init_ns_msg(result)) {
		loge("init_ns_msg() error\n");
		free(result);
		return -1;
	}

	if (ns_parse(result, (const uint8_t*)buf, buf_len)) {
		loge("ns_parse() error\n");
		ns_msg_free(result);
		free(result);
		return -1;
	}

	rbn = rbtree_lookup(&c->reqdic, &result->id);
	if (!rbn) {
		logd("request have been destroyed - %s - %s\n", msg_key(result), get_addrname(from));
		ns_msg_free(result);
		free(result);
		return -1;
	}
	else {
		logd("request got answer(s) - %s - %s\n", msg_key(result), get_addrname(from));
	}

	req = rbtree_container_of(rbn, udpreq_t, rbn);

	dllist_remove(&req->entry);
	rbtree_remove(&c->reqdic, &req->rbn);
	c->req_count--;

	if (req->callback) {
		req->callback((channel_t*)c, 0, result, FALSE, TRUE, req->cb_state);
		req->callback = NULL;
	}

	req_destroy(req);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x20, %edi
callq 0x34d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1a0da
jmp 0x1a09a
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1a0cc
movl $0x3, %edi
leaq 0x1cb41(%rip), %rsi     # 0x36bf3
leaq 0x1cac3(%rip), %rdx     # 0x36b7c
movl $0xc6, %ecx
leaq 0x1cdd2(%rip), %r8      # 0x36e97
movb $0x0, %al
callq 0x243b0
jmp 0x1a0ce
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1a328
movq -0x40(%rbp), %rdi
callq 0x270f0
cmpl $0x0, %eax
je 0x1a133
jmp 0x1a0ea
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1a11c
movl $0x3, %edi
leaq 0x1caf1(%rip), %rsi     # 0x36bf3
leaq 0x1ca73(%rip), %rdx     # 0x36b7c
movl $0xcb, %ecx
leaq 0x1ba8d(%rip), %r8      # 0x35ba2
movb $0x0, %al
callq 0x243b0
jmp 0x1a11e
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1a328
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x284b0
cmpl $0x0, %eax
je 0x1a19c
jmp 0x1a14a
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1a17c
movl $0x3, %edi
leaq 0x1ca91(%rip), %rsi     # 0x36bf3
leaq 0x1ca13(%rip), %rdx     # 0x36b7c
movl $0xd1, %ecx
leaq 0x1c416(%rip), %r8      # 0x3658b
movb $0x0, %al
callq 0x243b0
jmp 0x1a17e
movq -0x40(%rbp), %rdi
callq 0x27870
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1a328
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
movq -0x40(%rbp), %rsi
callq 0x3b10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1a22a
jmp 0x1a1ba
movb $0x0, %al
callq 0x242d0
cmpl $0x7, (%rax)
jl 0x1a20a
movq -0x40(%rbp), %rdi
callq 0x1a4d0
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
callq 0x25020
movq -0x50(%rbp), %r9
movl $0x7, %edi
leaq 0x1ca07(%rip), %rsi     # 0x36bf3
leaq 0x1c989(%rip), %rdx     # 0x36b7c
movl $0xd9, %ecx
leaq 0x1cad4(%rip), %r8      # 0x36cd3
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x1a20c
movq -0x40(%rbp), %rdi
callq 0x27870
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1a328
jmp 0x1a22c
movb $0x0, %al
callq 0x242d0
cmpl $0x7, (%rax)
jl 0x1a27c
movq -0x40(%rbp), %rdi
callq 0x1a4d0
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
callq 0x25020
movq -0x58(%rbp), %r9
movl $0x7, %edi
leaq 0x1c995(%rip), %rsi     # 0x36bf3
leaq 0x1c917(%rip), %rdx     # 0x36b7c
movl $0xdf, %ecx
leaq 0x1c961(%rip), %r8      # 0x36bd2
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x1a27e
jmp 0x1a280
xorl %eax, %eax
movq %rax, %rcx
addq $0x40, %rcx
subq %rcx, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
movq -0x38(%rbp), %rsi
addq $0x40, %rsi
callq 0x3b90
movq -0x10(%rbp), %rax
movl 0x78(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x78(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1a318
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq 0x28(%rcx), %r9
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ecx, %esi
callq *%rax
movq -0x38(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x38(%rbp), %rdi
callq 0x19260
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)