// File: 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
subq $0x4540, %rsp           # imm = 0x4540
movq %rdx, -0x4440(%rbp)
movq %rdi, -0x4438(%rbp)
movq %rdi, %rax
movq %rax, -0x4430(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x4428(%rbp)
callq 0x3120
movq -0x4428(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x4340
jmp 0x37f4
leaq -0xa0(%rbp), %rdi
callq 0x31a0
cmpl $-0x1, -0x20(%rbp)
jne 0x3813
movl $0x50, %eax
movl %eax, -0x4444(%rbp)
jmp 0x381c
movl -0x20(%rbp), %eax
movl %eax, -0x4444(%rbp)
movl -0x4444(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x3120
jmp 0x383a
movl -0xb0(%rbp), %esi
leaq -0xd8(%rbp), %rdi
callq 0x46c0
movl %eax, -0x4448(%rbp)
jmp 0x3854
leaq -0xd8(%rbp), %rdi
callq 0x31a0
movl -0x4448(%rbp), %eax
movl %eax, -0xb4(%rbp)
leaq -0x40(%rbp), %rdi
movb $0x0, -0xfa(%rbp)
leaq 0x57cf(%rip), %rsi      # 0x904d
callq 0x4800
movb %al, -0x4449(%rbp)
jmp 0x388b
movb -0x4449(%rbp), %al
testb $0x1, %al
jne 0x3897
jmp 0x38cf
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x4458(%rbp)
callq 0x3450
movq -0x4458(%rbp), %rdx
movb $0x1, -0xfa(%rbp)
leaq 0x5745(%rip), %rsi      # 0x9004
leaq -0xf8(%rbp), %rdi
callq 0x41b0
jmp 0x38cd
jmp 0x38e3
leaq -0x40(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x3120
jmp 0x38e1
jmp 0x38e3
testb $0x1, -0xfa(%rbp)
jne 0x38ee
jmp 0x38fa
leaq -0xf9(%rbp), %rdi
callq 0x3300
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x4830
jmp 0x390d
leaq -0x210(%rbp), %rdi
leaq 0x56eb(%rip), %rsi      # 0x9006
callq 0x33b0
jmp 0x3922
leaq -0x40(%rbp), %rsi
leaq -0x1f0(%rbp), %rdi
callq 0x3040
jmp 0x3934
leaq -0x1d0(%rbp), %rdi
leaq 0x56c8(%rip), %rsi      # 0x900a
callq 0x33b0
jmp 0x3949
leaq -0x248(%rbp), %rax
movq %rax, -0x4460(%rbp)
leaq -0x60(%rbp), %rdx
leaq 0x56b1(%rip), %rsi      # 0x9013
leaq -0x288(%rbp), %rdi
callq 0x4940
jmp 0x3970
movq -0x4460(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x4910
movq %rax, -0x4468(%rbp)
jmp 0x398c
movq -0x4468(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x49e0
leaq -0x248(%rbp), %rax
movq %rax, -0x4470(%rbp)
leaq 0x565d(%rip), %rsi      # 0x9018
leaq 0x5661(%rip), %rdx      # 0x9023
leaq -0x2d0(%rbp), %rdi
callq 0x4a10
jmp 0x39d0
movq -0x4470(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x4910
movq %rax, -0x4478(%rbp)
jmp 0x39ec
movq -0x4478(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x49e0
leaq -0x248(%rbp), %rax
movq %rax, -0x4480(%rbp)
leaq 0x5615(%rip), %rsi      # 0x9030
leaq 0x5615(%rip), %rdx      # 0x9037
leaq -0x318(%rbp), %rdi
callq 0x4af0
jmp 0x3a30
movq -0x4480(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x4910
movq %rax, -0x4488(%rbp)
jmp 0x3a4c
movq -0x4488(%rbp), %rax
movq %rax, -0x320(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x49e0
leaq -0x328(%rbp), %rdi
callq 0x4bd0
movq -0x4440(%rbp), %rdi
callq 0x4bf0
movq %rax, -0x330(%rbp)
movq -0x330(%rbp), %rax
movq %rax, -0x328(%rbp)
movq -0x4440(%rbp), %rdi
callq 0x4c50
movq %rax, -0x338(%rbp)
leaq -0x328(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x4c20
testb $0x1, %al
jne 0x3ac2
jmp 0x3ca7
leaq -0x248(%rbp), %rax
movq %rax, -0x44a0(%rbp)
leaq -0x328(%rbp), %rdi
movq %rdi, -0x4498(%rbp)
callq 0x4c80
movq -0x4498(%rbp), %rdi
movq %rax, -0x4490(%rbp)
callq 0x4c80
movq -0x4490(%rbp), %rsi
movq %rax, %rdx
addq $0x20, %rdx
leaq -0x378(%rbp), %rdi
callq 0x4ca0
jmp 0x3b12
movq -0x44a0(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x4910
movq %rax, -0x44a8(%rbp)
jmp 0x3b2e
movq -0x44a8(%rbp), %rax
movq %rax, -0x380(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x49e0
leaq -0x328(%rbp), %rdi
xorl %esi, %esi
callq 0x4d00
movq %rax, -0x388(%rbp)
jmp 0x3a93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x31a0
jmp 0x419d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x4194
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x31a0
jmp 0x4194
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
testb $0x1, -0xfa(%rbp)
jne 0x3bdc
jmp 0x3be8
leaq -0xf9(%rbp), %rdi
callq 0x3300
jmp 0x4194
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x4188
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x417c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x49e0
jmp 0x417c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x49e0
jmp 0x417c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x49e0
jmp 0x417c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x49e0
jmp 0x417c
leaq -0x3a8(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x4d40
jmp 0x3cbc
leaq 0x5378(%rip), %rsi      # 0x903b
leaq -0x80(%rbp), %rdi
callq 0x4800
movb %al, -0x44a9(%rbp)
jmp 0x3cd4
movb -0x44a9(%rbp), %al
andb $0x1, %al
movb %al, -0x3a9(%rbp)
testb $0x1, -0x3a9(%rbp)
je 0x3dcd
xorl %eax, %eax
movl %eax, %esi
movl $0x200002, %edi         # imm = 0x200002
callq 0x3270
jmp 0x3cff
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x3270
jmp 0x3d0d
callq 0x3150
movq %rax, -0x44b8(%rbp)
jmp 0x3d1b
movq -0x44b8(%rbp), %rdi
callq 0x33e0
movq %rax, -0x44c0(%rbp)
jmp 0x3d30
movq -0x44c0(%rbp), %rax
movq %rax, -0x3b8(%rbp)
movq -0x3b8(%rbp), %rdi
callq 0x32c0
movq %rax, -0x44c8(%rbp)
jmp 0x3d53
movq -0x44c8(%rbp), %rax
movq %rax, -0x3c0(%rbp)
movq -0x3c0(%rbp), %rax
movq %rax, -0x44d0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3110
movq -0x44d0(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
movl $0x37, %esi
callq 0x30f0
jmp 0x3d92
movq -0x3c0(%rbp), %rdi
movl -0xb4(%rbp), %esi
callq 0x3180
jmp 0x3da6
movq -0x3c0(%rbp), %rdi
callq 0x33d0
jmp 0x3db4
jmp 0x3dcd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x4170
testb $0x1, -0x3a9(%rbp)
je 0x3e23
movq -0x3c0(%rbp), %rax
movq %rax, -0x44e0(%rbp)
leaq -0x3a8(%rbp), %rdi
movq %rdi, -0x44e8(%rbp)
callq 0x3110
movq -0x44e8(%rbp), %rdi
movq %rax, -0x44d8(%rbp)
callq 0x31e0
movq -0x44e0(%rbp), %rdi
movq -0x44d8(%rbp), %rsi
movl %eax, %edx
callq 0x3490
jmp 0x3e21
jmp 0x3e70
movl -0xb4(%rbp), %eax
movl %eax, -0x44f4(%rbp)
leaq -0x3a8(%rbp), %rdi
movq %rdi, -0x4500(%rbp)
callq 0x3110
movq -0x4500(%rbp), %rdi
movq %rax, -0x44f0(%rbp)
callq 0x31e0
movl -0x44f4(%rbp), %edi
movq -0x44f0(%rbp), %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x3140
jmp 0x3e6e
jmp 0x3e70
movq -0x4438(%rbp), %rdi
movb $0x0, -0x3c1(%rbp)
xorl %esi, %esi
callq 0x4830
jmp 0x3e87
testb $0x1, -0x3a9(%rbp)
je 0x3ed5
movq -0x3c0(%rbp), %rdi
leaq -0x23c0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x3060
movl %eax, -0x4504(%rbp)
jmp 0x3eb0
movl -0x4504(%rbp), %eax
movl %eax, -0x23c4(%rbp)
jmp 0x3f04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x4164
movl -0xb4(%rbp), %edi
leaq -0x23c0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
xorl %ecx, %ecx
callq 0x30d0
movq %rax, -0x4510(%rbp)
jmp 0x3ef7
movq -0x4510(%rbp), %rax
movl %eax, -0x23c4(%rbp)
cmpl $0x0, -0x23c4(%rbp)
jle 0x3fc7
movslq -0x23c4(%rbp), %rax
movq %rax, -0x4520(%rbp)
leaq -0x23e9(%rbp), %rdi
movq %rdi, -0x4518(%rbp)
callq 0x3450
movq -0x4520(%rbp), %rdx
movq -0x4518(%rbp), %rcx
leaq -0x23e8(%rbp), %rdi
leaq -0x23c0(%rbp), %rsi
callq 0x3340
jmp 0x3f55
movq -0x4438(%rbp), %rdi
leaq -0x23e8(%rbp), %rsi
callq 0x5150
jmp 0x3f6a
leaq -0x23e8(%rbp), %rdi
callq 0x31a0
leaq -0x23e9(%rbp), %rdi
callq 0x3300
jmp 0x3fd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x3fb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x23e8(%rbp), %rdi
callq 0x31a0
leaq -0x23e9(%rbp), %rdi
callq 0x3300
jmp 0x4164
movq -0x4438(%rbp), %rax
movb $0x1, 0x122(%rax)
jmp 0x3fd7
movq -0x4438(%rbp), %rax
movb 0x122(%rax), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3fef
jmp 0x410b
testb $0x1, -0x3a9(%rbp)
je 0x4026
movq -0x3c0(%rbp), %rdi
leaq -0x43f0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
callq 0x3060
movl %eax, -0x4524(%rbp)
jmp 0x4018
movl -0x4524(%rbp), %eax
movl %eax, -0x43f4(%rbp)
jmp 0x4055
movl -0xb4(%rbp), %edi
leaq -0x43f0(%rbp), %rsi
movl $0x1fff, %edx           # imm = 0x1FFF
xorl %ecx, %ecx
callq 0x30d0
movq %rax, -0x4530(%rbp)
jmp 0x4048
movq -0x4530(%rbp), %rax
movl %eax, -0x43f4(%rbp)
movslq -0x43f4(%rbp), %rax
movq %rax, -0x4540(%rbp)
leaq -0x4419(%rbp), %rdi
movq %rdi, -0x4538(%rbp)
callq 0x3450
movq -0x4540(%rbp), %rdx
movq -0x4538(%rbp), %rcx
leaq -0x4418(%rbp), %rdi
leaq -0x43f0(%rbp), %rsi
callq 0x3340
jmp 0x4099
movq -0x4438(%rbp), %rdi
leaq -0x4418(%rbp), %rsi
callq 0x5150
jmp 0x40ae
leaq -0x4418(%rbp), %rdi
callq 0x31a0
leaq -0x4419(%rbp), %rdi
callq 0x3300
jmp 0x3fd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x40fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x4418(%rbp), %rdi
callq 0x31a0
leaq -0x4419(%rbp), %rdi
callq 0x3300
jmp 0x4164
movb $0x1, -0x3c1(%rbp)
testb $0x1, -0x3c1(%rbp)
jne 0x4127
movq -0x4438(%rbp), %rdi
callq 0x4280
leaq -0x3a8(%rbp), %rdi
callq 0x31a0
leaq -0x248(%rbp), %rdi
callq 0x4280
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0x80(%rbp), %rdi
callq 0x5e80
movq -0x4430(%rbp), %rax
addq $0x4540, %rsp           # imm = 0x4540
popq %rbp
retq
movq -0x4438(%rbp), %rdi
callq 0x4280
leaq -0x3a8(%rbp), %rdi
callq 0x31a0
leaq -0x248(%rbp), %rdi
callq 0x4280
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0x80(%rbp), %rdi
callq 0x5e80
movq -0xa8(%rbp), %rdi
callq 0x3440
nopl (%rax)