// File: /workspace/github_cpp_makefile_star2_O1/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 0x1004e
leaq 0x58(%r14), %rbx
leaq 0x5ca9(%rip), %rsi      # 0x158f5
movq %rbx, %rdi
callq 0x4760
movq %r14, %rdi
callq 0x10374
cmpb $0x0, 0x78(%r14)
je 0xfd25
leaq -0x308(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq -0x318(%rbp), %rsi
movq %r15, %rdi
callq 0x143a8
movq -0x310(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x1378a
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x10af6
leaq -0x30(%rbp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0xfcc5
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
leaq 0x5fb6(%rip), %rsi      # 0x15c82
leaq -0x40(%rbp), %rdi
leaq -0x318(%rbp), %rdx
callq 0x6400
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x4150
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xfd01
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
movq -0x318(%rbp), %rdi
cmpq %r12, %rdi
je 0xfdc3
movq -0x308(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfdc3
movq (%r15), %rsi
leaq -0x318(%rbp), %r12
movq %r12, %rdi
movl $0x1, %edx
callq 0x6a8c
movq %r12, %rdi
callq 0x71a8
leaq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x1378a
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x10af6
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfd75
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
movq (%r15), %rsi
movq %r14, %rdi
callq 0x10bf4
leaq 0x5efb(%rip), %rsi      # 0x15c82
movq %rbx, %rdi
callq 0x4760
movq 0x8(%r14), %rdi
callq 0xca92
testl %eax, %eax
jne 0xfdb7
leaq -0x318(%rbp), %rdi
callq 0x700a
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x4150
leaq -0x318(%rbp), %rdi
callq 0x6f74
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 0xfe11
jmp 0xfe24
jmp 0xfe21
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe46
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfe46
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfe24
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfe24
jmp 0xfe21
movq %rax, %rbx
movq -0x318(%rbp), %rdi
cmpq %r12, %rdi
je 0xfe52
movq -0x308(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xfe52
jmp 0xfe43
movq %rax, %rbx
leaq -0x318(%rbp), %rdi
callq 0x6f74
movq %rbx, %rdi
callq 0x46d0