// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/httpdns.c
// Function: http_out
static void http_out(dns_t * out)
{
    int write_len;

    out->timer = 0;
    if (httpdns.connect_request && out->sent_CONNECT_len < httpdns.connect_request_len) {
        write_len = write(out->fd, httpdns.connect_request + out->sent_CONNECT_len, httpdns.connect_request_len - out->sent_CONNECT_len);
        if (write_len == -1) {
            dnsProxyStop(out);
        } else {
            out->sent_CONNECT_len += write_len;
            if (out->sent_CONNECT_len == httpdns.connect_request_len) {
                out->sent_CONNECT_len++; //表示已完全发送CONNECT请求，等待HTTP回应
                dns_ev.events = EPOLLIN | EPOLLET;
                dns_ev.data.ptr = out;
                epoll_ctl(dns_efd, EPOLL_CTL_MOD, out->fd, &dns_ev);
            }
        }
        return;
    }

    write_len = write(out->fd, out->out_request, out->out_request_len);
    if (write_len == out->out_request_len) {
        dns_ev.events = EPOLLIN | EPOLLET;
        dns_ev.data.ptr = out;
        epoll_ctl(dns_efd, EPOLL_CTL_MOD, out->fd, &dns_ev);
    } else if (write_len > 0) {
        out->out_request_len -= write_len;
        memmove(out->out_request, out->out_request + write_len, out->out_request_len);
    } else {
        epoll_ctl(dns_efd, EPOLL_CTL_DEL, out->fd, NULL);
        close(out->fd);
        out->query_type = 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x230(%rax)
cmpq $0x0, 0x14c6e(%rip)     # 0x1c6f0
je 0x7b5e
movq -0x8(%rbp), %rax
movl 0x234(%rax), %eax
cmpl 0x14c80(%rip), %eax     # 0x1c718
jge 0x7b5e
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edi
movq 0x14c41(%rip), %rsi     # 0x1c6f0
movq -0x8(%rbp), %rax
movslq 0x234(%rax), %rax
addq %rax, %rsi
movl 0x14c55(%rip), %eax     # 0x1c718
movq -0x8(%rbp), %rcx
subl 0x234(%rcx), %eax
movslq %eax, %rdx
callq 0x20d0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x7ae9
movq -0x8(%rbp), %rdi
callq 0x7560
jmp 0x7b59
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x234(%rax), %ecx
movl %ecx, 0x234(%rax)
movq -0x8(%rbp), %rax
movl 0x234(%rax), %eax
cmpl 0x14c0c(%rip), %eax     # 0x1c718
jne 0x7b57
movq -0x8(%rbp), %rax
movl 0x234(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x234(%rax)
movl $0x80000001, 0x5cc19(%rip) # imm = 0x80000001
movq -0x8(%rbp), %rax
movq %rax, 0x5cc12(%rip)     # 0x64748
movl 0x5cc04(%rip), %edi     # 0x64740
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edx
movl $0x3, %esi
leaq 0x5cbf2(%rip), %rcx     # 0x64744
callq 0x2240
jmp 0x7b59
jmp 0x7c54
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edi
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0x228(%rax), %rdx
callq 0x20d0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x228(%rcx), %eax
jne 0x7bd0
movl $0x80000001, 0x5cba5(%rip) # imm = 0x80000001
movq -0x8(%rbp), %rax
movq %rax, 0x5cb9e(%rip)     # 0x64748
movl 0x5cb90(%rip), %edi     # 0x64740
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edx
movl $0x3, %esi
leaq 0x5cb7e(%rip), %rcx     # 0x64744
callq 0x2240
jmp 0x7c54
cmpl $0x0, -0xc(%rbp)
jle 0x7c1a
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x228(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x228(%rax)
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rsi
movslq -0xc(%rbp), %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movslq 0x228(%rax), %rdx
callq 0x2450
jmp 0x7c52
movl 0x5cb20(%rip), %edi     # 0x64740
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x2240
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edi
callq 0x2200
movq -0x8(%rbp), %rax
movb $0x0, 0x23a(%rax)
jmp 0x7c54
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)