// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rdi, -0x38(%rbp)
leaq -0xe8(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x42ae
leaq -0x160(%rbp), %rdi
movq %r14, %rsi
callq 0x2e82
movq -0xf8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x25fa
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21f0
movl -0x100(%rbp), %r14d
leaq -0xc8(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x42ae
cmpl $-0x1, %r14d
movl $0x50, %esi
cmovnel %r14d, %esi
leaq -0xd8(%rbp), %rdi
callq 0x30ac
movl %eax, -0x2c(%rbp)
movq -0xd8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2660
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x120(%rbp), %r12
leaq 0x2a09(%rip), %rsi      # 0x5077
movq %r12, %rdi
callq 0x20a0
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
testl %eax, %eax
je 0x269e
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x42ae
jmp 0x26b5
leaq 0x295f(%rip), %rsi      # 0x5004
leaq 0x2959(%rip), %rdx      # 0x5005
leaq -0x58(%rbp), %rdi
callq 0x4abc
leaq -0x2a0(%rbp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x270(%rbp), %rdi
leaq -0x260(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x240(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x220(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x200(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x1e0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x1b8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x198(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x170(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
movl %eax, -0x60(%rdx)
movb $0x1, %sil
movb %sil, -0x18(%rdx)
movb %sil, -0x78(%rcx)
movw $0x1, -0x17(%rdx)
movl %eax, -0x14(%rdx)
movq -0x68(%rcx), %rdx
leaq 0x2885(%rip), %rcx      # 0x5006
movl $0x3, %r8d
xorl %esi, %esi
callq 0x22d0
leaq -0x250(%rbp), %rdi
movq %r12, %rsi
callq 0x2120
leaq -0x230(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x285b(%rip), %rcx      # 0x500a
movl $0x8, %r8d
xorl %esi, %esi
callq 0x22d0
leaq -0x140(%rbp), %rdx
leaq 0x2849(%rip), %rsi      # 0x5013
leaq -0x22b0(%rbp), %rdi
callq 0x3334
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x43ba
leaq -0x2280(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2808
movq -0x2280(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x22a0(%rbp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x2827
movq -0x22a0(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq 0x27ea(%rip), %rsi      # 0x5018
leaq 0x27ee(%rip), %rdx      # 0x5023
leaq -0x22b0(%rbp), %rdi
callq 0x33f0
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x43ba
movq -0x2290(%rbp), %rdi
leaq -0x2280(%rbp), %rax
cmpq %rax, %rdi
je 0x2876
movq -0x2280(%rbp), %rsi
incq %rsi
callq 0x21f0
movq -0x22b0(%rbp), %rdi
cmpq %r15, %rdi
je 0x2891
movq -0x22a0(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq 0x2798(%rip), %rsi      # 0x5030
leaq 0x2798(%rip), %rdx      # 0x5037
leaq -0x22b0(%rbp), %rdi
callq 0x346e
leaq -0x2a8(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x43ba
movq -0x2290(%rbp), %rdi
leaq -0x2280(%rbp), %rax
cmpq %rax, %rdi
je 0x28e0
movq -0x2280(%rbp), %rsi
incq %rsi
callq 0x21f0
movq -0x22b0(%rbp), %rdi
cmpq %r15, %rdi
je 0x28fb
movq -0x22a0(%rbp), %rsi
incq %rsi
callq 0x21f0
movq 0x18(%r13), %r14
addq $0x8, %r13
cmpq %r13, %r14
je 0x2981
movq %r13, %rbx
leaq -0x22b0(%rbp), %r12
leaq -0x2a8(%rbp), %r13
leaq 0x20(%r14), %rsi
leaq 0x40(%r14), %rdx
movq %r12, %rdi
callq 0x34ec
movq %r13, %rdi
movq %r12, %rsi
callq 0x43ba
movq -0x2290(%rbp), %rdi
leaq -0x2280(%rbp), %rax
cmpq %rax, %rdi
je 0x2956
movq -0x2280(%rbp), %rsi
incq %rsi
callq 0x21f0
movq -0x22b0(%rbp), %rdi
cmpq %r15, %rdi
je 0x2971
movq -0x22a0(%rbp), %rsi
incq %rsi
callq 0x21f0
movq %r14, %rdi
callq 0x2160
movq %rax, %r14
cmpq %rbx, %rax
jne 0x2919
leaq -0xb8(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x355a
leaq 0x26a0(%rip), %rsi      # 0x503b
leaq -0x160(%rbp), %rdi
callq 0x20a0
movl %eax, %r15d
testl %eax, %eax
jne 0x2a04
movl $0x200002, %edi         # imm = 0x200002
xorl %esi, %esi
callq 0x21c0
xorl %edi, %edi
xorl %esi, %esi
callq 0x21c0
callq 0x2110
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x2200
movq %rax, %r12
movq -0x140(%rbp), %rcx
movq %rax, %rdi
movl $0x37, %esi
xorl %edx, %edx
callq 0x20d0
movq %r12, %rdi
movl -0x2c(%rbp), %esi
callq 0x2130
movq %r12, %rdi
callq 0x2270
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
testl %r15d, %r15d
je 0x2a23
movl -0x2c(%rbp), %edi
xorl %ecx, %ecx
callq 0x2100
jmp 0x2a2b
movq %r12, %rdi
callq 0x2320
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x3238
testl %r15d, %r15d
je 0x2a53
leaq -0x22b0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
movl -0x2c(%rbp), %edi
xorl %ecx, %ecx
callq 0x20c0
jmp 0x2a67
leaq -0x22b0(%rbp), %rsi
movq %r12, %rdi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x2060
testl %eax, %eax
jle 0x2ac3
movl %eax, %eax
leaq -0x88(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq (%rax,%rbp), %rdx
addq $-0x22b0, %rdx          # imm = 0xDD50
leaq -0x98(%rbp), %rdi
leaq -0x22b0(%rbp), %rsi
callq 0x4abc
leaq -0x98(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x3ab4
movq -0x98(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2ace
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21f0
jmp 0x2ace
movq -0x38(%rbp), %rax
movb $0x1, 0x122(%rax)
movq -0x38(%rbp), %rax
cmpb $0x0, 0x122(%rax)
jne 0x2b61
leaq -0x68(%rbp), %rbx
leaq -0x42b0(%rbp), %r13
leaq -0x78(%rbp), %r14
testl %r15d, %r15d
je 0x2b07
movl $0x1fff, %edx           # imm = 0x1FFF
movl -0x2c(%rbp), %edi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x20c0
jmp 0x2b17
movq %r12, %rdi
movq %r13, %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x2060
cltq
movq %rbx, -0x78(%rbp)
leaq (%rax,%rbp), %rdx
addq $-0x42b0, %rdx          # imm = 0xBD50
movq %r14, %rdi
movq %r13, %rsi
callq 0x4abc
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x3ab4
movq -0x78(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2b54
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21f0
movq -0x38(%rbp), %rax
cmpb $0x0, 0x122(%rax)
je 0x2aee
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b80
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x2a8(%rbp), %rdi
callq 0x2d8a
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2ba5
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x110(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bc4
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x130(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2be3
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c02
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x21f0
movq -0x38(%rbp), %rax
addq $0x4288, %rsp           # imm = 0x4288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x98(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2cba
movq -0x88(%rbp), %rsi
jmp 0x2cf4
jmp 0x2cb7
jmp 0x2cb7
jmp 0x2cfe
jmp 0x2d03
jmp 0x2cfe
jmp 0x2d03
jmp 0x2cfe
jmp 0x2d03
jmp 0x2cfe
jmp 0x2c7f
movq %rax, %r14
movq -0xd8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2d37
movq -0xc8(%rbp), %rsi
jmp 0x2d2f
movq %rax, %r14
jmp 0x2d37
movq %rax, %r14
movq -0xf8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2d43
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21f0
jmp 0x2d43
jmp 0x2cfe
movq %rax, %r14
jmp 0x2cc3
jmp 0x2cb7
movq %rax, %r14
movq -0x38(%rbp), %rdi
callq 0x2d8a
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d12
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21f0
jmp 0x2d12
movq %rax, %r14
movq -0x78(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2cba
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21f0
jmp 0x2cba
movq %rax, %r14
jmp 0x2d12
movq %rax, %r14
leaq -0x22b0(%rbp), %rdi
callq 0x33aa
leaq -0x2a8(%rbp), %rdi
callq 0x2d8a
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2d37
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21f0
leaq -0x160(%rbp), %rdi
callq 0x41a2
movq %r14, %rdi
callq 0x22f0
nop