// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_chndoh.c
// Function: doh_build_post_request
static http_request_t* doh_build_post_request(channel_req_t* rq, doh_server_t* doh, ns_msg_t* msg)
{
	channel_chndoh_t* c = rq->ctx;
	http_request_t* req = NULL;
	int r, len;
	stream_t s = STREAM_INIT();

	if ((len = ns_serialize(&s, msg, 0)) <= 0) {
		loge("ns_serialize() error\n");
		stream_free(&s);
		return NULL;
	}

	req = http_request_create("POST", doh->path, doh->host, doh->keep_alive);
	if (!req) {
		loge("http_request_create() error\n");
		stream_free(&s);
		return NULL;
	}

	r = http_request_set_header(req, "Content-Type", "application/dns-message");
	if (r) {
		loge("http_request_set_header() error\n");
		stream_free(&s);
		http_request_destroy(req);
		return NULL;
	}

	r = http_request_set_header(req, "Accept", "*/*");
	if (r) {
		loge("http_request_set_header() error\n");
		stream_free(&s);
		http_request_destroy(req);
		return NULL;
	}

	http_request_set_data(req, s.array, s.size);

	http_request_set_state(req, doh);

	http_request_set_tag(req, rq->qr.qname);

	return req;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3200
movq -0x20(%rbp), %rsi
leaq -0x50(%rbp), %rdi
xorl %edx, %edx
callq 0x29ec0
movl %eax, -0x38(%rbp)
cmpl $0x0, %eax
jg 0x117fb
jmp 0x117b1
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x117e3
movl $0x3, %edi
leaq 0x247b5(%rip), %rsi     # 0x35f7e
leaq 0x24ce5(%rip), %rdx     # 0x364b5
movl $0x312, %ecx            # imm = 0x312
leaq 0x24586(%rip), %r8      # 0x35d62
movb $0x0, %al
callq 0x243b0
jmp 0x117e5
leaq -0x50(%rbp), %rdi
callq 0x2d640
movq $0x0, -0x8(%rbp)
jmp 0x1199b
movq -0x18(%rbp), %rax
movq 0x468(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x460(%rax), %rdx
movq -0x18(%rbp), %rax
movl 0x470(%rax), %ecx
leaq 0x23be9(%rip), %rdi     # 0x3540b
callq 0x1e3d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1187e
jmp 0x11834
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x11866
movl $0x3, %edi
leaq 0x24732(%rip), %rsi     # 0x35f7e
leaq 0x24c62(%rip), %rdx     # 0x364b5
movl $0x319, %ecx            # imm = 0x319
leaq 0x24c6d(%rip), %r8      # 0x364cc
movb $0x0, %al
callq 0x243b0
jmp 0x11868
leaq -0x50(%rbp), %rdi
callq 0x2d640
movq $0x0, -0x8(%rbp)
jmp 0x1199b
movq -0x30(%rbp), %rdi
leaq 0x24c60(%rip), %rsi     # 0x364e9
leaq 0x24c66(%rip), %rdx     # 0x364f6
callq 0x1e6c0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x118f3
jmp 0x118a0
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x118d2
movl $0x3, %edi
leaq 0x246c6(%rip), %rsi     # 0x35f7e
leaq 0x24bf6(%rip), %rdx     # 0x364b5
movl $0x320, %ecx            # imm = 0x320
leaq 0x24c43(%rip), %r8      # 0x3650e
movb $0x0, %al
callq 0x243b0
jmp 0x118d4
leaq -0x50(%rbp), %rdi
callq 0x2d640
movq -0x30(%rbp), %rdi
callq 0x1e4b0
movq $0x0, -0x8(%rbp)
jmp 0x1199b
movq -0x30(%rbp), %rdi
leaq 0x24c31(%rip), %rsi     # 0x3652f
leaq 0x24c31(%rip), %rdx     # 0x36536
callq 0x1e6c0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x11965
jmp 0x11915
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x11947
movl $0x3, %edi
leaq 0x24651(%rip), %rsi     # 0x35f7e
leaq 0x24b81(%rip), %rdx     # 0x364b5
movl $0x328, %ecx            # imm = 0x328
leaq 0x24bce(%rip), %r8      # 0x3650e
movb $0x0, %al
callq 0x243b0
jmp 0x11949
leaq -0x50(%rbp), %rdi
callq 0x2d640
movq -0x30(%rbp), %rdi
callq 0x1e4b0
movq $0x0, -0x8(%rbp)
jmp 0x1199b
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl -0x48(%rbp), %edx
callq 0x1ea40
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e910
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x1e950
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)