// File: /workspace/github_cpp_makefile_star2_O2/boomanaiden154[P]HTTPClientHPP/./client.hpp
// Function: HTTPClient::getFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::multimap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>)
static HTTPHeader getFile(std::string uri, std::multimap<std::string, std::string> headers = std::multimap<std::string, std::string>())
    {
        struct uri websiteURI = parseURI(uri);
        int port = websiteURI.port == -1 ? 80 : websiteURI.port;
        int sockfd = initalizeSocket(websiteURI.domain, port);
        std::string path = websiteURI.path == "" ? "/" : websiteURI.path;

        HTTPHeader request(true);
        request.headerField1 = "GET";
        request.headerField2 = websiteURI.path;
        request.headerField3 = "HTTP/1.1";

        request.headers.insert(std::pair<std::string,std::string>("Host",websiteURI.domain));
        request.headers.insert(std::pair<std::string,std::string>("User-Agent","custom/0.0.1"));
        request.headers.insert(std::pair<std::string,std::string>("Accept","*/*"));

        std::multimap<std::string,std::string>::iterator itr;
        for(itr = headers.begin(); itr != headers.end(); itr++)
        {
            request.headers.insert(std::pair<std::string,std::string>(itr->first, itr->second));
        }

        std::string headerString = request.getHeaderString();

        bool ssl = websiteURI.protocol == "https";

        //init SSL
        SSL_CTX* ssl_ctx;
        SSL* conn;
        if(ssl)
        {
            SSL_load_error_strings();
            SSL_library_init();
            ssl_ctx = SSL_CTX_new(SSLv23_client_method());

            conn = SSL_new(ssl_ctx);
            SSL_set_tlsext_host_name(conn, websiteURI.domain.c_str());
            SSL_set_fd(conn, sockfd);

            SSL_connect(conn);
        }

        if(ssl)
        {
            SSL_write(conn, headerString.c_str(), headerString.size());
        }
        else
        {
            send(sockfd, headerString.c_str(), headerString.size(), 0);
        }

        HTTPHeader response;

        char headerBuffer[8191];

        int headerRecieved;
        if(ssl)
        {
            headerRecieved = SSL_read(conn, headerBuffer, 8191);
        }
        else
        {
            headerRecieved = recv(sockfd, headerBuffer, 8191, 0);
        }

        if(headerRecieved > 0)
        {
            response.parse(std::string(headerBuffer, headerRecieved));
        }
        else
        {
            response.isDone = true;
        }

        while(!response.isDone)
        {
            char buffer[8191];
            int recieved;
            if(ssl)
            {
                recieved = SSL_read(conn, buffer, 8191);
            }
            else
            {
                recieved = recv(sockfd, buffer, 8191, 0);
            }
            response.parse(std::string(buffer, recieved));
        }

        return response;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4288, %rsp           # imm = 0x4288
movq %rdx, %r15
movq %rdi, -0x38(%rbp)
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
callq 0x2270
leaq -0x160(%rbp), %rdi
movq %r14, %rsi
callq 0x2b5a
leaq -0xf8(%rbp), %rdi
callq 0x20f0
leaq -0x140(%rbp), %r12
movl 0x40(%r12), %r14d
leaq -0xd8(%rbp), %rdi
movq %r12, %rsi
callq 0x2270
cmpl $-0x1, %r14d
pushq $0x50
popq %rsi
cmovnel %r14d, %esi
leaq -0xd8(%rbp), %rdi
callq 0x2ca8
movl %eax, -0x2c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x20f0
leaq -0x120(%rbp), %r13
leaq 0x2a83(%rip), %rsi      # 0x5077
movq %r13, %rdi
callq 0x2d72
testb %al, %al
je 0x261c
leaq 0x29fd(%rip), %rsi      # 0x5004
leaq -0xb8(%rbp), %rdi
leaq -0x22b0(%rbp), %rdx
callq 0x2ab0
jmp 0x262b
leaq -0xb8(%rbp), %rdi
movq %r13, %rsi
callq 0x2270
leaq -0x2a0(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x260(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
leaq -0x240(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x220(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x200(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x1e0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x1b8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x198(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x170(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rdx)
andl $0x0, -0x60(%rdx)
leaq -0x270(%rbp), %rdi
movb $0x1, %al
movb %al, -0x18(%rdx)
movb %al, -0x78(%rcx)
movw $0x1, -0x17(%rdx)
andl $0x0, -0x14(%rdx)
leaq 0x2909(%rip), %rsi      # 0x5006
callq 0x2320
leaq -0x250(%rbp), %rdi
movq %r13, %rsi
callq 0x2130
leaq -0x230(%rbp), %rdi
leaq 0x28eb(%rip), %rsi      # 0x500a
callq 0x2320
leaq 0x28e8(%rip), %rsi      # 0x5013
leaq -0x22b0(%rbp), %rdi
movq %r12, %rdx
callq 0x2e8c
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x38dc
leaq -0x22b0(%rbp), %rdi
callq 0x2ece
leaq 0x28b8(%rip), %rsi      # 0x5018
leaq 0x28bc(%rip), %rdx      # 0x5023
leaq -0x22b0(%rbp), %rdi
callq 0x2eee
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x38dc
leaq -0x22b0(%rbp), %rdi
callq 0x2ece
leaq 0x2897(%rip), %rsi      # 0x5030
leaq 0x2897(%rip), %rdx      # 0x5037
leaq -0x22b0(%rbp), %rdi
callq 0x2f34
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x38dc
leaq -0x22b0(%rbp), %r14
movq %r14, %rdi
callq 0x2ece
movq 0x18(%r15), %r13
addq $0x8, %r15
leaq -0x2a8(%rbp), %r12
cmpq %r15, %r13
je 0x2812
leaq 0x20(%r13), %rsi
leaq 0x40(%r13), %rdx
movq %r14, %rdi
callq 0x2f7a
movq %r12, %rdi
movq %r14, %rsi
callq 0x38dc
movq %r14, %rdi
callq 0x2ece
movq %r13, %rdi
callq 0x2160
movq %rax, %r13
jmp 0x27dd
leaq -0x58(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x2fb0
leaq 0x2812(%rip), %rsi      # 0x503b
leaq -0x160(%rbp), %rdi
callq 0x2d72
movl %eax, %r15d
testb %al, %al
je 0x28a1
movl $0x200002, %edi         # imm = 0x200002
xorl %esi, %esi
callq 0x21e0
xorl %edi, %edi
xorl %esi, %esi
callq 0x21e0
callq 0x2120
movq %rax, %rdi
callq 0x2290
movq %rax, %rdi
callq 0x2210
movq %rax, %rbx
movq -0x140(%rbp), %rcx
pushq $0x37
popq %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x20c0
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
callq 0x2140
movq %rbx, %rdi
callq 0x2280
movq -0x58(%rbp), %rsi
movl -0x50(%rbp), %edx
movq %rbx, %rdi
callq 0x2330
jmp 0x28b3
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movl -0x2c(%rbp), %edi
xorl %ecx, %ecx
callq 0x2110
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x2d82
testb %r15b, %r15b
je 0x28d9
leaq -0x22b0(%rbp), %rsi
movq %rbx, %rdi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x2050
jmp 0x28ef
leaq -0x22b0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
movl -0x2c(%rbp), %edi
xorl %ecx, %ecx
callq 0x20a0
testl %eax, %eax
jle 0x2930
movl %eax, %eax
leaq -0x68(%rbp), %rcx
movq %rcx, -0x10(%rcx)
leaq (%rax,%rbp), %rdx
addq $-0x22b0, %rdx          # imm = 0xDD50
leaq -0x78(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x3f50
leaq -0x78(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x320a
leaq -0x78(%rbp), %rdi
callq 0x20f0
jmp 0x293b
movq -0x38(%rbp), %rax
movb $0x1, 0x122(%rax)
leaq -0x88(%rbp), %r12
leaq -0x42b0(%rbp), %r13
leaq -0x98(%rbp), %r14
movq -0x38(%rbp), %rax
cmpb $0x0, 0x122(%rax)
jne 0x29bb
testb %r15b, %r15b
je 0x2974
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x2050
jmp 0x2986
movl $0x1fff, %edx           # imm = 0x1FFF
movl -0x2c(%rbp), %edi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x20a0
cltq
movq %r12, -0x98(%rbp)
leaq (%rax,%rbp), %rdx
addq $-0x42b0, %rdx          # imm = 0xBD50
movq %r14, %rdi
movq %r13, %rsi
callq 0x3f50
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x320a
movq %r14, %rdi
callq 0x20f0
jmp 0x2950
leaq -0x58(%rbp), %rdi
callq 0x20f0
leaq -0x2a8(%rbp), %rdi
callq 0x2aec
leaq -0xb8(%rbp), %rdi
callq 0x20f0
leaq -0x160(%rbp), %rdi
callq 0x366e
movq -0x38(%rbp), %rax
addq $0x4288, %rsp           # imm = 0x4288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a29
jmp 0x2a29
movq %rax, %r14
leaq -0x78(%rbp), %rdi
jmp 0x2a57
jmp 0x2a48
jmp 0x2a48
jmp 0x2a70
jmp 0x2a75
jmp 0x2a70
jmp 0x2a75
jmp 0x2a70
jmp 0x2a75
jmp 0x2a70
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
jmp 0x2a97
movq %rax, %r14
jmp 0x2a9c
movq %rax, %r14
leaq -0xf8(%rbp), %rdi
callq 0x20f0
jmp 0x2aa8
jmp 0x2a70
movq %rax, %r14
jmp 0x2a65
jmp 0x2a48
movq %rax, %r14
jmp 0x2a5c
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x20f0
movq -0x38(%rbp), %rdi
callq 0x2aec
leaq -0x58(%rbp), %rdi
callq 0x20f0
jmp 0x2a84
movq %rax, %r14
jmp 0x2a84
movq %rax, %r14
leaq -0x22b0(%rbp), %rdi
callq 0x2ece
leaq -0x2a8(%rbp), %rdi
callq 0x2aec
leaq -0xb8(%rbp), %rdi
callq 0x20f0
leaq -0x160(%rbp), %rdi
callq 0x366e
movq %r14, %rdi
callq 0x22f0