// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
xorl %eax, %eax
addl $-0x2, %esi
cmpl $0x4, %esi
ja 0x5353
movq %rdi, %rbx
leaq 0x2ee7(%rip), %rcx      # 0x80c4
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq 0x71db(%rip), %rdx      # 0xc3c8
movq %rbx, %rdi
movl $0x194, %esi            # imm = 0x194
callq 0x510e
movq 0x71cf(%rip), %rdi      # 0xc3d0
callq 0x3160
movq %rbx, %rdi
movl %eax, %esi
callq 0x5128
movq 0x71b9(%rip), %rsi      # 0xc3d0
jmp 0x52fb
movq 0x717d(%rip), %rdx      # 0xc3a0
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x510e
movq 0xd60(%rbx), %rsi
testq %rsi, %rsi
je 0x5337
movq %rbx, %rdi
callq 0x5128
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 0x5333
movq 0x711a(%rip), %rdx      # 0xc3b8
movq %rbx, %rdi
movl $0x193, %esi            # imm = 0x193
callq 0x510e
movq 0x710e(%rip), %rdi      # 0xc3c0
callq 0x3160
movq %rbx, %rdi
movl %eax, %esi
callq 0x5128
movq 0x70f8(%rip), %rsi      # 0xc3c0
jmp 0x52fb
movq 0x7107(%rip), %rdx      # 0xc3d8
movq %rbx, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x510e
movq 0x70fb(%rip), %rdi      # 0xc3e0
callq 0x3160
movq %rbx, %rdi
movl %eax, %esi
callq 0x5128
movq 0x70e5(%rip), %rsi      # 0xc3e0
movq %rbx, %rdi
callq 0x51b2
testb %al, %al
je 0x5351
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, %al
jmp 0x5353
pushq $0x1a
popq %rsi
movq %rbx, %rdi
callq 0x5128
leaq 0x3059(%rip), %rsi      # 0x83a2
movq %rbx, %rdi
callq 0x51b2
xorl %eax, %eax
popq %rbx
retq
nop