// File: /workspace/github_c_makefile_star2_O1/niuyuling[P]CProxy/httpudp.c
// Function: udp_init
static void http_udp_req_init()
{
    char dest[22];

    sprintf(dest, "%s:%u", inet_ntoa(udp.dst.sin_addr), ntohs(udp.dst.sin_port));
    if (udp.http_request) {
        udp.http_request_len = strlen(udp.http_request) + 2;
        udp.http_request = (char *)realloc(udp.http_request, udp.http_request_len + 1);
        if (udp.http_request == NULL)
            errors("httpudp http request initializate failed.");
        strcat(udp.http_request, "\r\n");
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[V]", 3, "HTTP/1.1", 8);
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[H]", 3, dest, strlen(dest));
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "\\0", 2, "\0", 1);
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[M]", 3, "CONNECT", 7);
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[url]", 5, "/", 1);
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[U]", 3, "/", 1);
    } else {                    /* 默认使用CONNECT请求 */
        if (https.encodeCode) {
            dataEncode(dest, strlen(dest), https.encodeCode);
            udp.httpsProxy_encodeCode = https.encodeCode;
        }
        udp.http_request_len = default_ssl_request_len;
        copy_new_mem(default_ssl_request, default_ssl_request_len, &udp.http_request);
        udp.http_request = replace(udp.http_request, &udp.http_request_len, "[H]", 3, dest, strlen(dest));
        memcpy(&udp.dst, &https.dst, sizeof(udp.dst));
    }
    if (udp.http_request == NULL)
        errors("out of memory.");
    /* 保存原始生成的请求头，配合usr_hdr使用 */
    if (saveHdrs) {
        if (copy_new_mem(udp.http_request, udp.http_request_len, &udp.original_http_request) != 0)
            errors("out of memory.");
        udp.original_http_request_len = udp.http_request_len;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x206cde8(%rip), %edi   # 0x207395c
callq 0x2100
movzwl 0x206cdda(%rip), %ecx   # 0x207395a
rolw $0x8, %cx
movzwl %cx, %ecx
leaq 0x285d(%rip), %rsi      # 0x93eb
movq %rsp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2490
movq 0x206cdc6(%rip), %rbx   # 0x2073968
testq %rbx, %rbx
je 0x6d14
movq %rbx, %rdi
callq 0x2140
leal 0x2(%rax), %ecx
movl %ecx, 0x206cdbc(%rip)   # 0x2073978
addl $0x3, %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x23c0
movq %rax, 0x206cd97(%rip)   # 0x2073968
testq %rax, %rax
jne 0x6be2
leaq 0x283f(%rip), %rdi      # 0x941c
callq 0x4058
movq 0x206cd7f(%rip), %rbx   # 0x2073968
movq %rbx, %rdi
callq 0x2140
movw $0xa0d, (%rbx,%rax)     # imm = 0xA0D
movb $0x0, 0x2(%rbx,%rax)
movq 0x206cd65(%rip), %rdi   # 0x2073968
leaq 0x206cd6e(%rip), %rbx   # 0x2073978
leaq 0x27a1(%rip), %rdx      # 0x93b2
leaq 0x27d9(%rip), %r8       # 0x93f1
movq %rbx, %rsi
movl $0x3, %ecx
movl $0x8, %r9d
callq 0x40cf
movq %rax, %r14
movq %rax, 0x206cd33(%rip)   # 0x2073968
movq %rsp, %r15
movq %r15, %rdi
callq 0x2140
leaq 0x2787(%rip), %rdx      # 0x93ce
movq %r14, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r15, %r8
movl %eax, %r9d
callq 0x40cf
movq %rax, 0x206cd04(%rip)   # 0x2073968
leaq 0x278f(%rip), %rdx      # 0x93fa
leaq 0x27e4(%rip), %r8       # 0x9456
movq %rax, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
movl $0x1, %r9d
callq 0x40cf
movq %rax, 0x206ccd9(%rip)   # 0x2073968
leaq 0x270b(%rip), %rdx      # 0x93a1
leaq 0x266c(%rip), %r8       # 0x9309
movq %rax, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movl $0x7, %r9d
callq 0x40cf
movq %rax, 0x206ccae(%rip)   # 0x2073968
leaq 0x2719(%rip), %rdx      # 0x93da
leaq 0x26d5(%rip), %r14      # 0x939d
movq %rax, %rdi
movq %rbx, %rsi
movl $0x5, %ecx
movq %r14, %r8
movl $0x1, %r9d
callq 0x40cf
movq %rax, 0x206cc80(%rip)   # 0x2073968
leaq 0x26bf(%rip), %rdx      # 0x93ae
movq %rax, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r14, %r8
movl $0x1, %r9d
callq 0x40cf
movq %rax, 0x206cc59(%rip)   # 0x2073968
jmp 0x6db4
leaq 0x12675(%rip), %r12     # 0x19390
movl 0x18(%r12), %ebx
testl %ebx, %ebx
je 0x6d46
movq %rsp, %r14
movq %r14, %rdi
callq 0x2140
movq %r14, %rdi
movl %eax, %esi
movl %ebx, %edx
callq 0x37b0
movl 0x18(%r12), %eax
movl %eax, 0x206cc3e(%rip)   # 0x2073984
leaq 0x127d3(%rip), %rax     # 0x19520
movl (%rax), %esi
movl %esi, 0x206cc23(%rip)   # 0x2073978
leaq 0x206cc1c(%rip), %rbx   # 0x2073978
leaq 0x127b5(%rip), %rax     # 0x19518
movq (%rax), %rdi
leaq 0x206cbfb(%rip), %rdx   # 0x2073968
callq 0x407e
movq 0x206cbef(%rip), %r14   # 0x2073968
movq %rsp, %r15
movq %r15, %rdi
callq 0x2140
leaq 0x2643(%rip), %rdx      # 0x93ce
movq %r14, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r15, %r8
movl %eax, %r9d
callq 0x40cf
movq %rax, 0x206cbc0(%rip)   # 0x2073968
movups (%r12), %xmm0
movups %xmm0, 0x206cba4(%rip)  # 0x2073958
cmpq $0x0, 0x206cbac(%rip)   # 0x2073968
jne 0x6dca
leaq 0x2326(%rip), %rdi      # 0x90eb
callq 0x4058
leaq 0x125df(%rip), %rax     # 0x193b0
cmpq $0x0, (%rax)
je 0x6e0c
movq 0x206cb8a(%rip), %rdi   # 0x2073968
movl 0x206cb94(%rip), %esi   # 0x2073978
leaq 0x206cb85(%rip), %rdx   # 0x2073970
callq 0x407e
testb %al, %al
je 0x6e00
leaq 0x22f0(%rip), %rdi      # 0x90eb
callq 0x4058
movl 0x206cb72(%rip), %eax   # 0x2073978
movl %eax, 0x206cb70(%rip)   # 0x207397c
leaq 0x5cb1d(%rip), %rbx     # 0x63930
movl $0x200d000, %edx        # imm = 0x200D000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21b0
movl $0x10060, %eax          # imm = 0x10060
movq $-0x1, -0x4(%rax,%rbx)
addq $0x10068, %rax          # imm = 0x10068
cmpq $0x201d060, %rax        # imm = 0x201D060
jne 0x6e27
movl $0x401, %edi            # imm = 0x401
callq 0x2480
movl %eax, 0x2069ae2(%rip)   # 0x2070930
testl %eax, %eax
js 0x6ea3
leaq 0x12517(%rip), %rbx     # 0x19370
movl 0x8(%rbx), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x20d0
movl 0x8(%rbx), %edx
movl %edx, 0x2069ac2(%rip)   # 0x2070938
leaq 0x2069ab7(%rip), %rcx   # 0x2070934
movl $0x1, 0x2069aad(%rip)   # 0x2070934
movl 0x2069aa3(%rip), %edi   # 0x2070930
movl $0x1, %esi
callq 0x2220
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x26a8