// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/main.c
// Function: initialize
void initialize(conf * configure)
{
    int i;
    char *p;

    memset(cts, 0, sizeof(cts));
    for (i = MAX_CONNECTION; i--;)
        cts[i].fd = -1;
    // 为服务端的结构体分配内存
    for (i = 1; i < MAX_CONNECTION; i += 2) {
        cts[i].ready_data = (char *)malloc(BUFFER_SIZE);
        if (cts[i].ready_data == NULL) {
            fputs("out of memory.", stderr);
            exit(1);
        }
    }

    memset(&global, 0, sizeof(global));
    memset(&httpdns, 0, sizeof(httpdns));
    memset(&https, 0, sizeof(https));
    memset(&udp, 0, sizeof(udp));
    saveHdrs = NULL;
    httpdns.dst.sin_family = AF_INET;
    udp.dst.sin_family = AF_INET;
    global.tcp_listen_fd = global.dns_listen_fd = global.udp_listen_fd = global.uid = -1;

    // httpdns module
    global.dns_listen_fd = udp_listen((char *)"127.0.0.1", configure->dns_listen);
    if ((p = strchr(configure->httpdns_addr, ':')) != NULL) {
        *p = '\0';
        httpdns.dst.sin_port = htons(atoi(p + 1));
    } else {
        httpdns.dst.sin_port = htons(80);
    }
    httpdns.dst.sin_addr.s_addr = inet_addr(configure->httpdns_addr);
    httpdns.http_req_len = configure->httpdns_http_req_len;
    copy_new_mem(configure->httpdns_http_req, httpdns.http_req_len, &httpdns.http_req);

    // httpudp module
    global.udp_listen_fd = udp_listen((char *)"0.0.0.0", configure->udp_listen);
    if ((p = strchr(configure->httpudp_addr, ':')) != NULL) {
        *p = '\0';
        udp.dst.sin_port = htons(atoi(p + 1));
    } else {
        udp.dst.sin_port = htons(80);
    }
    udp.dst.sin_addr.s_addr = inet_addr(configure->httpudp_addr);
    udp.http_request_len = configure->httpudp_http_req_len;
    copy_new_mem(configure->httpudp_http_req, udp.http_request_len, &udp.http_request);

    // global module
    server_sock = create_server_socket(configure->tcp_listen); // IPV4
    server_sock6 = create_server_socket6(configure->tcp_listen); // IPV6

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x94bb(%rip), %r14      # 0xc420
movl $0x9f60, %edx           # imm = 0x9F60
movq %r14, %rdi
xorl %esi, %esi
callq 0x21b0
movl $0x9f48, %eax           # imm = 0x9F48
movl $0xffffffff, (%rax,%r14) # imm = 0xFFFFFFFF
addq $-0x28, %rax
cmpq $-0x18, %rax
jne 0x2f79
movq $-0x1, %r14
leaq 0x94af(%rip), %r15      # 0xc448
movl $0x2000, %edi           # imm = 0x2000
callq 0x2330
movq %rax, (%r15)
testq %rax, %rax
je 0x3167
addq $0x2, %r14
addq $0x50, %r15
cmpq $0x3f9, %r14            # imm = 0x3F9
jbe 0x2f99
xorl %eax, %eax
movq %rax, 0x163c7(%rip)     # 0x19390
movl $0x0, 0x163c5(%rip)     # 0x19398
pxor %xmm0, %xmm0
leaq 0x166a2(%rip), %r15     # 0x19680
movdqu %xmm0, (%r15)
movdqu %xmm0, 0x10(%r15)
movdqu %xmm0, 0x20(%r15)
movdqu %xmm0, 0x30(%r15)
movdqu %xmm0, 0x40(%r15)
movdqu %xmm0, 0x50(%r15)
movq %rax, 0x60(%r15)
movdqu %xmm0, 0x16393(%rip)    # 0x193a0
movdqu %xmm0, 0x1639b(%rip)    # 0x193b0
leaq 0x207094c(%rip), %r14   # 0x2073968
movdqu %xmm0, (%r14)
movdqu %xmm0, 0x10(%r14)
movdqu %xmm0, 0x20(%r14)
movq %rax, 0x1638c(%rip)     # 0x193c0
movw $0x2, %ax
movw %ax, (%r15)
movw %ax, (%r14)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x16334(%rip)    # 0x19380
movl 0x18(%rbx), %esi
leaq 0x60a1(%rip), %rdi      # 0x90f7
callq 0x2e5a
movl %eax, 0x16323(%rip)     # 0x19384
movq 0x80(%rbx), %r12
movq %r12, %rdi
movl $0x3a, %esi
callq 0x2160
movw $0x5000, %bp            # imm = 0x5000
movw $0x5000, %cx            # imm = 0x5000
testq %rax, %rax
je 0x309d
movb $0x0, (%rax)
incq %rax
movq %rax, %rdi
callq 0x2480
movl %eax, %ecx
rolw $0x8, %cx
movq 0x80(%rbx), %r12
movw %cx, 0x2(%r15)
movq %r12, %rdi
callq 0x2280
movl %eax, 0x4(%r15)
movl 0x94(%rbx), %esi
movl %esi, 0x40(%r15)
movq 0x88(%rbx), %rdi
addq $0x10, %r15
movq %r15, %rdx
callq 0x4072
movl 0x1c(%rbx), %esi
leaq 0x602c(%rip), %rdi      # 0x9101
callq 0x2e5a
movl %eax, 0x162a8(%rip)     # 0x19388
movq 0xa0(%rbx), %r15
movq %r15, %rdi
movl $0x3a, %esi
callq 0x2160
testq %rax, %rax
je 0x3114
movb $0x0, (%rax)
incq %rax
movq %rax, %rdi
callq 0x2480
movl %eax, %ebp
rolw $0x8, %bp
movq 0xa0(%rbx), %r15
movw %bp, 0x2(%r14)
movq %r15, %rdi
callq 0x2280
movl %eax, 0x4(%r14)
movl 0xb4(%rbx), %esi
movl %esi, 0x20(%r14)
movq 0xa8(%rbx), %rdi
addq $0x10, %r14
movq %r14, %rdx
callq 0x4072
movl 0x10(%rbx), %edi
callq 0x27dc
movl %eax, 0x13230(%rip)     # 0x16380
movl 0x10(%rbx), %edi
callq 0x2899
movl %eax, 0x1322a(%rip)     # 0x16388
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x266f