// File: /workspace/github_c_makefile_star2_O3/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 0x206ce54(%rip), %edi   # 0x207396c
callq 0x2100
movzwl 0x206ce46(%rip), %ecx   # 0x207396a
rolw $0x8, %cx
movzwl %cx, %ecx
leaq 0x28b1(%rip), %rsi      # 0x93e3
movq %rsp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x24a0
movq 0x206ce32(%rip), %rbx   # 0x2073978
testq %rbx, %rbx
je 0x6cbb
movq %rbx, %rdi
callq 0x2140
leal 0x2(%rax), %ecx
movl %ecx, 0x206ce28(%rip)   # 0x2073988
addl $0x3, %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x23d0
movq %rax, %rbx
movq %rax, 0x206ce00(%rip)   # 0x2073978
testq %rax, %rax
jne 0x6b90
leaq 0x2894(%rip), %rdi      # 0x9418
callq 0x404c
movq 0x206cde8(%rip), %rbx   # 0x2073978
movq %rbx, %rdi
callq 0x2140
movw $0xa0d, (%rbx,%rax)     # imm = 0xA0D
movb $0x0, 0x2(%rbx,%rax)
movq 0x206cdce(%rip), %rdi   # 0x2073978
leaq 0x206cdd7(%rip), %rbx   # 0x2073988
leaq 0x27f2(%rip), %rdx      # 0x93aa
leaq 0x282a(%rip), %r8       # 0x93e9
movq %rbx, %rsi
movl $0x3, %ecx
movl $0x8, %r9d
callq 0x40c3
movq %rax, %r14
movq %rax, 0x206cd9c(%rip)   # 0x2073978
movq %rsp, %r15
movq %r15, %rdi
callq 0x2140
leaq 0x27d8(%rip), %rdx      # 0x93c6
movq %r14, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r15, %r8
movl %eax, %r9d
callq 0x40c3
movq %rax, 0x206cd6d(%rip)   # 0x2073978
leaq 0x27e0(%rip), %rdx      # 0x93f2
leaq 0x2839(%rip), %r8       # 0x9452
movq %rax, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
movl $0x1, %r9d
callq 0x40c3
movq %rax, 0x206cd42(%rip)   # 0x2073978
leaq 0x275c(%rip), %rdx      # 0x9399
leaq 0x26c1(%rip), %r8       # 0x9305
movq %rax, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movl $0x7, %r9d
callq 0x40c3
movq %rax, 0x206cd17(%rip)   # 0x2073978
leaq 0x276a(%rip), %rdx      # 0x93d2
leaq 0x2726(%rip), %r14      # 0x9395
movq %rax, %rdi
movq %rbx, %rsi
movl $0x5, %ecx
movq %r14, %r8
movl $0x1, %r9d
callq 0x40c3
movq %rax, 0x206cce9(%rip)   # 0x2073978
leaq 0x2710(%rip), %rdx      # 0x93a6
movq %rax, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r14, %r8
movl $0x1, %r9d
callq 0x40c3
movq %rax, 0x206ccc2(%rip)   # 0x2073978
jmp 0x6d5b
leaq 0x126de(%rip), %r12     # 0x193a0
movl 0x18(%r12), %ebx
testl %ebx, %ebx
je 0x6ced
movq %rsp, %r14
movq %r14, %rdi
callq 0x2140
movq %r14, %rdi
movl %eax, %esi
movl %ebx, %edx
callq 0x3794
movl 0x18(%r12), %eax
movl %eax, 0x206cca7(%rip)   # 0x2073994
leaq 0x1283c(%rip), %rax     # 0x19530
movl (%rax), %esi
movl %esi, 0x206cc8c(%rip)   # 0x2073988
leaq 0x206cc85(%rip), %rbx   # 0x2073988
leaq 0x1281e(%rip), %rax     # 0x19528
movq (%rax), %rdi
leaq 0x206cc64(%rip), %rdx   # 0x2073978
callq 0x4072
movq 0x206cc58(%rip), %r14   # 0x2073978
movq %rsp, %r15
movq %r15, %rdi
callq 0x2140
leaq 0x2694(%rip), %rdx      # 0x93c6
movq %r14, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
movq %r15, %r8
movl %eax, %r9d
callq 0x40c3
movq %rax, 0x206cc29(%rip)   # 0x2073978
movups (%r12), %xmm0
movups %xmm0, 0x206cc0d(%rip)  # 0x2073968
testq %rax, %rax
jne 0x6d6c
leaq 0x2381(%rip), %rdi      # 0x90e8
callq 0x404c
leaq 0x1264d(%rip), %rax     # 0x193c0
cmpq $0x0, (%rax)
je 0x6dae
movq 0x206cbf8(%rip), %rdi   # 0x2073978
movl 0x206cc02(%rip), %esi   # 0x2073988
leaq 0x206cbf3(%rip), %rdx   # 0x2073980
callq 0x4072
testb %al, %al
je 0x6da2
leaq 0x234b(%rip), %rdi      # 0x90e8
callq 0x404c
movl 0x206cbe0(%rip), %eax   # 0x2073988
movl %eax, 0x206cbde(%rip)   # 0x207398c
leaq 0x5cb8b(%rip), %rbx     # 0x63940
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 0x6dc9
movl $0x401, %edi            # imm = 0x401
callq 0x2490
movl %eax, 0x2069b50(%rip)   # 0x2070940
testl %eax, %eax
js 0x6e45
leaq 0x12585(%rip), %rbx     # 0x19380
movl 0x8(%rbx), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x20d0
movl 0x8(%rbx), %edx
movl %edx, 0x2069b30(%rip)   # 0x2070948
leaq 0x2069b25(%rip), %rcx   # 0x2070944
movl $0x1, 0x2069b1b(%rip)   # 0x2070944
movl 0x2069b11(%rip), %edi   # 0x2070940
movl $0x1, %esi
callq 0x2220
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x26b8