// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/httpdns.c
// Function: httpRequest_init
static void httpRequest_init()
{
    char dest[22];
    uint16_t port;

    port = ntohs(httpdns.dst.sin_port);
    sprintf(dest, "%s:%u", inet_ntoa(httpdns.dst.sin_addr), port);

    //如果设置http_req = "";则不创建请求头
    if (httpdns.http_req_len > 0) {
        httpdns.http_req_len = strlen(httpdns.http_req);
        httpdns.http_req_len += 2;
        httpdns.http_req = (char *)realloc(httpdns.http_req, httpdns.http_req_len + 1);
        if (httpdns.http_req == NULL)
            printf("out of memory.\n");
        strcat(httpdns.http_req, "\r\n");
        httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[V]", 3, "HTTP/1.1", 8);
        httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[H]", 3, dest, strlen(dest));
        httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "\\0", 2, "\0", 1);
        if (httpdns.tcpDNS_mode == 0) {
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[M]", 3, "GET", 3);
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[url]", 5, "/d?dn=[D]", 9);
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[U]", 3, "/d?dn=[D]", 9);
            if (httpdns.http_req == NULL)
                printf("out of memory.\n");
        } else {
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[M]", 3, "CONNECT", 7);
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[url]", 5, "/", 1);
            httpdns.http_req = replace(httpdns.http_req, &httpdns.http_req_len, "[U]", 3, "/", 1);
            if (httpdns.http_req == NULL)
                printf("out of memory.\n");
            httpdns.connect_request = httpdns.http_req;
            httpdns.connect_request_len = httpdns.http_req_len;
            httpdns.http_req = NULL;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movzwl 0x14a63(%rip), %edi     # 0x1c6d2
callq 0x2400
movw %ax, -0x22(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x14a4e(%rip), %edi     # 0x1c6d4
callq 0x20f0
movq -0x30(%rbp), %rdi
movq %rax, %rdx
movzwl -0x22(%rbp), %ecx
leaq 0x47fa(%rip), %rsi      # 0xc497
movb $0x0, %al
callq 0x24d0
cmpl $0x0, 0x14a65(%rip)     # 0x1c710
jle 0x7f8c
movq 0x14a28(%rip), %rdi     # 0x1c6e0
callq 0x2130
movl %eax, 0x14a4d(%rip)     # 0x1c710
movl 0x14a47(%rip), %eax     # 0x1c710
addl $0x2, %eax
movl %eax, 0x14a3e(%rip)     # 0x1c710
movq 0x14a07(%rip), %rdi     # 0x1c6e0
movl 0x14a31(%rip), %eax     # 0x1c710
addl $0x1, %eax
movslq %eax, %rsi
callq 0x23e0
movq %rax, 0x149ef(%rip)     # 0x1c6e0
cmpq $0x0, 0x149e7(%rip)     # 0x1c6e0
jne 0x7d09
leaq 0x479b(%rip), %rdi      # 0xc49d
movb $0x0, %al
callq 0x2180
movq 0x149d0(%rip), %rdi     # 0x1c6e0
leaq 0x471b(%rip), %rsi      # 0xc432
callq 0x24b0
movq 0x149bd(%rip), %rdi     # 0x1c6e0
leaq 0x149a6(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4722(%rip), %rdx      # 0xc457
movl $0x3, %ecx
leaq 0x476c(%rip), %r8       # 0xc4ad
movl $0x8, %r9d
callq 0x4d00
movq %rax, 0x1498d(%rip)     # 0x1c6e0
movq 0x14986(%rip), %rax     # 0x1c6e0
movq %rax, -0x40(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x2130
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %r8
movl %eax, %r9d
leaq 0x1494f(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x46e7(%rip), %rdx      # 0xc473
movl $0x3, %ecx
callq 0x4d00
movq %rax, 0x14943(%rip)     # 0x1c6e0
movq 0x1493c(%rip), %rdi     # 0x1c6e0
leaq 0x14925(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4700(%rip), %rdx      # 0xc4b6
movl $0x2, %ecx
leaq 0x4701(%rip), %r8       # 0xc4c3
movl $0x1, %r9d
callq 0x4d00
movq %rax, 0x1490c(%rip)     # 0x1c6e0
movb 0x14956(%rip), %al      # 0x1c730
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7ea8
movq 0x148f1(%rip), %rdi     # 0x1c6e0
leaq 0x148da(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4645(%rip), %rdx      # 0xc446
movl $0x3, %r9d
leaq 0x45b3(%rip), %r8       # 0xc3c1
movl %r9d, %ecx
callq 0x4d00
movq %rax, 0x148c3(%rip)     # 0x1c6e0
movq 0x148bc(%rip), %rdi     # 0x1c6e0
leaq 0x148a5(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4649(%rip), %rdx      # 0xc47f
movl $0x5, %ecx
leaq 0x4677(%rip), %r8       # 0xc4b9
movl $0x9, %r9d
callq 0x4d00
movq %rax, 0x1488c(%rip)     # 0x1c6e0
movq 0x14885(%rip), %rdi     # 0x1c6e0
leaq 0x1486e(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x45e6(%rip), %rdx      # 0xc453
movl $0x3, %ecx
leaq 0x4640(%rip), %r8       # 0xc4b9
movl $0x9, %r9d
callq 0x4d00
movq %rax, 0x14855(%rip)     # 0x1c6e0
cmpq $0x0, 0x1484d(%rip)     # 0x1c6e0
jne 0x7ea3
leaq 0x4601(%rip), %rdi      # 0xc49d
movb $0x0, %al
callq 0x2180
jmp 0x7f8a
movq 0x14831(%rip), %rdi     # 0x1c6e0
leaq 0x1481a(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4585(%rip), %rdx      # 0xc446
movl $0x3, %ecx
leaq 0x44fd(%rip), %r8       # 0xc3ca
movl $0x7, %r9d
callq 0x4d00
movq %rax, 0x14801(%rip)     # 0x1c6e0
movq 0x147fa(%rip), %rdi     # 0x1c6e0
leaq 0x147e3(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4587(%rip), %rdx      # 0xc47f
movl $0x5, %ecx
leaq 0x453e(%rip), %r8       # 0xc442
movl $0x1, %r9d
callq 0x4d00
movq %rax, 0x147ca(%rip)     # 0x1c6e0
movq 0x147c3(%rip), %rdi     # 0x1c6e0
leaq 0x147ac(%rip), %rsi     # 0x1c6d0
addq $0x40, %rsi
leaq 0x4524(%rip), %rdx      # 0xc453
movl $0x3, %ecx
leaq 0x4507(%rip), %r8       # 0xc442
movl $0x1, %r9d
callq 0x4d00
movq %rax, 0x14793(%rip)     # 0x1c6e0
cmpq $0x0, 0x1478b(%rip)     # 0x1c6e0
jne 0x7f65
leaq 0x453f(%rip), %rdi      # 0xc49d
movb $0x0, %al
callq 0x2180
movq 0x14774(%rip), %rax     # 0x1c6e0
movq %rax, 0x1477d(%rip)     # 0x1c6f0
movl 0x14797(%rip), %eax     # 0x1c710
movl %eax, 0x14799(%rip)     # 0x1c718
movq $0x0, 0x14756(%rip) # 0x1c6e0
jmp 0x7f8c
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)