// File: /workspace/github_c_makefile_star2_O0/qq-smart[P]qq_sh_server/core/qq_connection.c
// Function: qq_close_connection
void
qq_close_connection(qq_connection_t *c)
{
    qq_socket_t  fd;

    if (c->fd == (qq_socket_t) -1) {
        qq_log_error(0, "qq_close_connection() connection already closed");
        return;
    }

    if (c->read->timer_set) {
        qq_event_del_timer(c->read);
    }

    if (c->write->timer_set) {
        qq_event_del_timer(c->write);
    }

    qq_epoll_del_connection(c);

    if (c->read->posted) {
        qq_delete_posted_event(c->read);
    }

    if (c->write->posted) {
        qq_delete_posted_event(c->write);
    }

    c->read->closed = 1;
    c->write->closed = 1;

    qq_free_connection(c);

    fd = c->fd;
    c->fd = (qq_socket_t) -1;

    if (close(fd) == -1) {
        qq_log_error(errno, "qq_close_connection(fd:%d) failed", fd);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
jne 0x2b3b
xorl %edi, %edi
leaq 0xc6c2(%rip), %rsi      # 0xf1f1
movb $0x0, %al
callq 0x9cc0
jmp 0x2cf5
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
shrl $0xb, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2b5e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2d00
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %eax
shrl $0xb, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2b81
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2d00
movq -0x8(%rbp), %rdi
callq 0x3360
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
shrl $0xf, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2c04
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %ecx
andl $0xffff7fff, %ecx       # imm = 0xFFFF7FFF
orl $0x0, %ecx
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xc624(%rip), %rdi      # 0xf221
movb $0x0, %al
callq 0x9e70
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %eax
shrl $0xf, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2c7e
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %ecx
andl $0xffff7fff, %ecx       # imm = 0xFFFF7FFF
orl $0x0, %ecx
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0xc5aa(%rip), %rdi      # 0xf221
movb $0x0, %al
callq 0x9e70
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %ecx
andl $0xfffeffff, %ecx       # imm = 0xFFFEFFFF
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %ecx
andl $0xfffeffff, %ecx       # imm = 0xFFFEFFFF
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x2ac0
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movl -0xc(%rbp), %edi
callq 0x2350
cmpl $-0x1, %eax
jne 0x2cf5
callq 0x2030
movl (%rax), %edi
movl -0xc(%rbp), %edx
leaq 0xc551(%rip), %rsi      # 0xf23f
movb $0x0, %al
callq 0x9cc0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)