// File: /workspace/github_cpp_makefile_star2_O3/JianjiaoSQ[P]MyPoorWebServer/http/http_conn.cpp
// Function: http_conn::process_write(http_conn::HTTP_CODE)
bool http_conn::process_write(HTTP_CODE ret)
{
    switch (ret)
    {
    case INTERNAL_ERROR:
    {
        add_status_line(500, error_500_title);
        add_headers(strlen(error_500_form));
        if (!add_content(error_500_form))
            return false;
        break;
    }
    case BAD_REQUEST:
    {
        add_status_line(404, error_404_title);
        add_headers(strlen(error_404_form));
        if (!add_content(error_404_form))
            return false;
        break;
    }
    case FORBIDDEN_REQUEST:
    {
        add_status_line(403, error_403_title);
        add_headers(strlen(error_403_form));
        if (!add_content(error_403_form))
            return false;
        break;
    }
    case FILE_REQUEST:
    {
        add_status_line(200, ok_200_title);
        if (m_file_stat.st_size != 0)
        {
            add_headers(m_file_stat.st_size);
            m_iv[0].iov_base = m_write_buf;
            m_iv[0].iov_len = m_write_idx;
            m_iv[1].iov_base = m_file_address;
            m_iv[1].iov_len = m_file_stat.st_size;
            m_iv_count = 2;
            bytes_to_send = m_write_idx + m_file_stat.st_size;
            return true;
        }
        else
        {
            const char *ok_string = "<html><body></body></html>";
            add_headers(strlen(ok_string));
            if (!add_content(ok_string))
                return false;
        }
    }
    default:
        return false;
    }
    m_iv[0].iov_base = m_write_buf;
    m_iv[0].iov_len = m_write_idx;
    m_iv_count = 1;
    bytes_to_send = m_write_idx;
    return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
xorl %ebp, %ebp
addl $-0x2, %esi
cmpl $0x4, %esi
ja 0x57e5
movq %rdi, %rbx
leaq 0x3a87(%rip), %rax      # 0x90c4
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x7d53(%rip), %r8       # 0xd3a0
leaq 0x3cfd(%rip), %rsi      # 0x9351
leaq 0x3be0(%rip), %rdx      # 0x923b
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x194, %ecx            # imm = 0x194
xorl %eax, %eax
callq 0x5412
movq 0x7d35(%rip), %rdi      # 0xd3a8
callq 0x3150
movq %rbx, %rdi
movl %eax, %esi
callq 0x5548
movq 0x7d1f(%rip), %rdx      # 0xd3a8
jmp 0x57a1
movq 0x7ce3(%rip), %r8       # 0xd378
leaq 0x3cb5(%rip), %rsi      # 0x9351
leaq 0x3b98(%rip), %rdx      # 0x923b
movq %rbx, %rdi
movl $0xc8, %ecx
xorl %eax, %eax
callq 0x5412
movq 0xd60(%rbx), %rsi
movq %rbx, %rdi
testq %rsi, %rsi
je 0x57ee
callq 0x5548
leaq 0x834(%rbx), %rax
movq %rax, 0xdc0(%rbx)
movslq 0xc34(%rbx), %rax
movq %rax, 0xdc8(%rbx)
movq 0xd28(%rbx), %rcx
movq 0xd60(%rbx), %rdx
movq %rcx, 0xdd0(%rbx)
movq %rdx, 0xdd8(%rbx)
movl $0x2, 0xde0(%rbx)
addl %eax, %edx
movl %edx, 0xdf0(%rbx)
jmp 0x57e2
movq 0x7c70(%rip), %r8       # 0xd390
leaq 0x3c2a(%rip), %rsi      # 0x9351
leaq 0x3b0d(%rip), %rdx      # 0x923b
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x193, %ecx            # imm = 0x193
xorl %eax, %eax
callq 0x5412
movq 0x7c52(%rip), %rdi      # 0xd398
callq 0x3150
movq %rbx, %rdi
movl %eax, %esi
callq 0x5548
movq 0x7c3c(%rip), %rdx      # 0xd398
jmp 0x57a1
movq 0x7c4b(%rip), %r8       # 0xd3b0
leaq 0x3be5(%rip), %rsi      # 0x9351
leaq 0x3ac8(%rip), %rdx      # 0x923b
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1f4, %ecx            # imm = 0x1F4
xorl %eax, %eax
callq 0x5412
movq 0x7c2d(%rip), %rdi      # 0xd3b8
callq 0x3150
movq %rbx, %rdi
movl %eax, %esi
callq 0x5548
movq 0x7c17(%rip), %rdx      # 0xd3b8
leaq 0x3af8(%rip), %rsi      # 0x92a0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5412
testb %al, %al
je 0x57e5
leaq 0x834(%rbx), %rax
movq %rax, 0xdc0(%rbx)
movslq 0xc34(%rbx), %rax
movq %rax, 0xdc8(%rbx)
movl $0x1, 0xde0(%rbx)
movl %eax, 0xdf0(%rbx)
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x1a, %esi
callq 0x5548
leaq 0x3aa1(%rip), %rsi      # 0x92a0
leaq 0x3b9c(%rip), %rdx      # 0x93a2
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5412
jmp 0x57e5