// File: /workspace/github_cpp_makefile_star2_O3/llefranc[P]42_webserv/srcs/server/Response.cpp
// Function: Response::execGet(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Response::execGet(const std::string& realUri)
{
    // Storing status line and some headers in buffer
    fillStatusLine(_staLine);
    fillServerHeader();
    fillDateHeader();
    
    if (!_autoIndex)
    {
        FileParser body(realUri.c_str(), true); // CAHNGER

        // Setting size after storing the body in FileParser object, then setting Last-Modified header
        fillContentlengthHeader(convertNbToString(body.getRequestFileSize()));
        fillLastModifiedHeader(realUri.c_str());
        _buffer += CLRF;

        // For GET, writing the body previously stored to the buffer
        if (_req->getMethod() == GET)
            _buffer += body.getRequestFile();
    }

    // Filling autoindex
    else
    {
        std::string autoIndexPage;
        autoIndexDisplayer(realUri, &autoIndexPage);

        fillContentlengthHeader(convertNbToString(autoIndexPage.size()));
        _buffer += CLRF + autoIndexPage;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movq %rsi, %r15
movq %rdi, %r14
leaq 0x10(%rdi), %rsi
callq 0xffe4
leaq 0x58(%r14), %rbx
leaq 0x5d0f(%rip), %rsi      # 0x158f5
movq %rbx, %rdi
callq 0x4760
movq %r14, %rdi
callq 0x10304
cmpb $0x0, 0x78(%r14)
je 0xfcbf
leaq -0x308(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq -0x318(%rbp), %rsi
movq %r15, %rdi
callq 0x14258
movq -0x310(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x136be
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x10a86
leaq -0x30(%rbp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0xfc5f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
leaq 0x601c(%rip), %rsi      # 0x15c82
leaq -0x40(%rbp), %rdi
leaq -0x318(%rbp), %rdx
callq 0x643f
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x4150
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xfc9b
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
movq -0x318(%rbp), %rdi
cmpq %r12, %rdi
je 0xfd5d
movq -0x308(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfd5d
movq (%r15), %rsi
leaq -0x318(%rbp), %r12
movq %r12, %rdi
movl $0x1, %edx
callq 0x6ad0
movq %r12, %rdi
callq 0x71ec
leaq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x136be
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x10a86
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd0f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
movq (%r15), %rsi
movq %r14, %rdi
callq 0x10b80
leaq 0x5f61(%rip), %rsi      # 0x15c82
movq %rbx, %rdi
callq 0x4760
movq 0x8(%r14), %rdi
callq 0xcad2
testl %eax, %eax
jne 0xfd51
leaq -0x318(%rbp), %rdi
callq 0x704e
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x4150
leaq -0x318(%rbp), %rdi
callq 0x6fb8
addq $0x300, %rsp            # imm = 0x300
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
jne 0xfdab
jmp 0xfdbe
jmp 0xfdbb
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfde0
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfde0
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfdbe
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfdbe
jmp 0xfdbb
movq %rax, %rbx
movq -0x318(%rbp), %rdi
cmpq %r12, %rdi
je 0xfdec
movq -0x308(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfdec
jmp 0xfddd
movq %rax, %rbx
leaq -0x318(%rbp), %rdi
callq 0x6fb8
movq %rbx, %rdi
callq 0x46d0