// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: parse_result
static int parse_result(tcpreq_t* req, char* buf, int buf_len, reqconn_t *conn)
{
	channel_tcp_t* c = req->ctx;
	ns_msg_t* result = NULL;

	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;
	}

	logd("request got answer(s) - %s - %s\n",
		msg_key(result), get_sockaddrname(&c->upstreams[conn->upstream]));

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

	req_close(req);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x20, %edi
callq 0x34d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x189a2
jmp 0x18962
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x18994
movl $0x3, %edi
leaq 0x1deb6(%rip), %rsi     # 0x36830
leaq 0x1e244(%rip), %rdx     # 0x36bc5
movl $0xc3, %ecx
leaq 0x1e50a(%rip), %r8      # 0x36e97
movb $0x0, %al
callq 0x243b0
jmp 0x18996
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x18b1c
movq -0x38(%rbp), %rdi
callq 0x270f0
cmpl $0x0, %eax
je 0x189fb
jmp 0x189b2
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x189e4
movl $0x3, %edi
leaq 0x1de66(%rip), %rsi     # 0x36830
leaq 0x1e1f4(%rip), %rdx     # 0x36bc5
movl $0xc8, %ecx
leaq 0x1d1c5(%rip), %r8      # 0x35ba2
movb $0x0, %al
callq 0x243b0
jmp 0x189e6
movq -0x38(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x18b1c
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x284b0
cmpl $0x0, %eax
je 0x18a64
jmp 0x18a12
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x18a44
movl $0x3, %edi
leaq 0x1de06(%rip), %rsi     # 0x36830
leaq 0x1e194(%rip), %rdx     # 0x36bc5
movl $0xce, %ecx
leaq 0x1db4e(%rip), %r8      # 0x3658b
movb $0x0, %al
callq 0x243b0
jmp 0x18a46
movq -0x38(%rbp), %rdi
callq 0x27870
movq -0x38(%rbp), %rdi
callq 0x3460
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x18b1c
jmp 0x18a66
movb $0x0, %al
callq 0x242d0
cmpl $0x7, (%rax)
jl 0x18acf
movq -0x38(%rbp), %rdi
callq 0x18b30
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rax
movslq 0x90(%rax), %rax
imulq $0x88, %rax, %rax
addq %rax, %rdi
callq 0x17bd0
movq -0x40(%rbp), %r9
movl $0x7, %edi
leaq 0x1dd7f(%rip), %rsi     # 0x36830
leaq 0x1e10d(%rip), %rdx     # 0x36bc5
movl $0xd5, %ecx
leaq 0x1e10e(%rip), %r8      # 0x36bd2
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x18ad1
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x18b0c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %r9
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ecx, %esi
callq *%rax
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x18b80
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)