// File: nurseiit[P]cpp-server/client.cpp
// Function: main
int main(int argc, char *argv[]) {
  try {
    if (argc != 3) {
      std::cout << "Usage: " << argv[0] << " <url> <port>\n";
      std::cout << "Examples:\n";
      std::cout << "  " << argv[0] << " www.example.com 80\n";
      std::cout << "  " << argv[0] << " www.google.com/test.html 80\n";
      return EXIT_FAILURE;
    }

    std::string hostname = hostname_from_url(argv[1]);
    std::string path = path_from_url(argv[1]);
    std::string port = argv[2];

    asio::io_context io_context;

    // Get endpoints for server name
    tcp::resolver resolver(io_context);
    tcp::resolver::results_type endpoints = resolver.resolve(hostname, port);

    // Find first successful endpoint
    tcp::socket socket(io_context);
    asio::connect(socket, endpoints);

    // Set bare minimum request headers for GET to work
    // https://stackoverflow.com/questions/6686261/what-at-the-bare-minimum-is-required-for-an-http-request
    asio::streambuf request;
    std::ostream request_stream(&request);
    request_stream << "GET " << path << " HTTP/1.0\r\n";
    request_stream << "Host: " << hostname << "\r\n";
    // Set "Connection: close" so server ends response with EOF
    request_stream << "Connection: close\r\n\r\n";

    // Send request
    asio::write(socket, request);

    // Read response status line
    asio::streambuf response;
    asio::read_until(socket, response, "\r\n");

    // Check response
    std::istream response_stream(&response);
    std::string http_version;
    response_stream >> http_version;
    unsigned int status_code;
    response_stream >> status_code;
    std::string status_message;
    std::getline(response_stream, status_message);

    if (!response_stream || http_version.substr(0, 5) != "HTTP/") {
      std::cout << "Invalid response\n";
      return EXIT_FAILURE;
    }

    std::cout << "STATUS CODE: " << status_code << std::endl;

    // Read & Print to console response headers
    asio::read_until(socket, response, "\r\n\r\n");

    std::string header;
    while (std::getline(response_stream, header) && header != "\r")
      std::cout << header << "\n";
    std::cout << "\n";

    // Read and print response till EOF
    if (response.size() > 0)
      std::cout << &response;

    asio::error_code error;
    while (asio::read(socket, response, asio::transfer_at_least(1), error))
      std::cout << &response;

    // If read throws EOF, it's expected
    if (error != asio::error::eof)
      throw asio::system_error(error);
  } catch (std::exception &e) {
    std::cout << "ERROR: " << e.what() << "\n";
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6b0, %rsp            # imm = 0x6B0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x5dcc
movq 0x1e30e(%rip), %rdi     # 0x23fc8
leaq 0x12397(%rip), %rsi     # 0x18058
callq 0x5380
movq %rax, -0x5a0(%rbp)
jmp 0x5ccf
movq -0x5a0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x5380
movq %rax, -0x5a8(%rbp)
jmp 0x5ceb
movq -0x5a8(%rbp), %rdi
leaq 0x12367(%rip), %rsi     # 0x18060
callq 0x5380
jmp 0x5d00
movq 0x1e2c1(%rip), %rdi     # 0x23fc8
leaq 0x12361(%rip), %rsi     # 0x1806f
callq 0x5380
jmp 0x5d15
movq 0x1e2ac(%rip), %rdi     # 0x23fc8
leaq 0x12357(%rip), %rsi     # 0x1807a
callq 0x5380
movq %rax, -0x5b0(%rbp)
jmp 0x5d31
movq -0x5b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x5380
movq %rax, -0x5b8(%rbp)
jmp 0x5d4d
movq -0x5b8(%rbp), %rdi
leaq 0x12322(%rip), %rsi     # 0x1807d
callq 0x5380
jmp 0x5d62
movq 0x1e25f(%rip), %rdi     # 0x23fc8
leaq 0x1230a(%rip), %rsi     # 0x1807a
callq 0x5380
movq %rax, -0x5c0(%rbp)
jmp 0x5d7e
movq -0x5c0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x5380
movq %rax, -0x5c8(%rbp)
jmp 0x5d9a
movq -0x5c8(%rbp), %rdi
leaq 0x122ea(%rip), %rsi     # 0x18092
callq 0x5380
jmp 0x5daf
movl $0x1, -0x4(%rbp)
jmp 0x6976
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x68c9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x5d8(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x5d0(%rbp)
callq 0x5690
movq -0x5d8(%rbp), %rsi
movq -0x5d0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x54d0
jmp 0x5e04
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5c20
jmp 0x5e13
leaq -0x60(%rbp), %rdi
callq 0x5270
leaq -0x61(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x5e8(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x5e0(%rbp)
callq 0x5690
movq -0x5e8(%rbp), %rsi
movq -0x5e0(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x54d0
jmp 0x5e63
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5b50
jmp 0x5e78
leaq -0xa8(%rbp), %rdi
callq 0x5270
leaq -0xa9(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x5f8(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x5f0(%rbp)
callq 0x5690
movq -0x5f8(%rbp), %rsi
movq -0x5f0(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
callq 0x54d0
jmp 0x5ece
leaq -0xd1(%rbp), %rdi
callq 0x53c0
leaq -0xe8(%rbp), %rdi
callq 0x6aa0
jmp 0x5ee8
xorl %eax, %eax
movl %eax, %edx
leaq -0x110(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x6b50
jmp 0x5f01
leaq -0x128(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
callq 0x6ba0
jmp 0x5f21
xorl %eax, %eax
movl %eax, %edx
leaq -0x158(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x6be0
jmp 0x5f3a
xorl %eax, %eax
movl %eax, %ecx
leaq -0x174(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x6c10
jmp 0x5f5a
callq 0x6c70
movq %rax, -0x608(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x600(%rbp)
callq 0x5690
movq -0x608(%rbp), %rsi
movq -0x600(%rbp), %rdx
leaq -0x1d8(%rbp), %rdi
callq 0x6c80
jmp 0x5f95
leaq -0x1d9(%rbp), %rdi
callq 0x53c0
leaq -0x2f0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x5190
jmp 0x5fb6
leaq 0x120f3(%rip), %rsi     # 0x180b0
leaq -0x2f0(%rbp), %rdi
callq 0x5380
movq %rax, -0x610(%rbp)
jmp 0x5fd2
movq -0x610(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5340
movq %rax, -0x618(%rbp)
jmp 0x5fee
movq -0x618(%rbp), %rdi
leaq 0x120b9(%rip), %rsi     # 0x180b5
callq 0x5380
jmp 0x6003
leaq 0x120b7(%rip), %rsi     # 0x180c1
leaq -0x2f0(%rbp), %rdi
callq 0x5380
movq %rax, -0x620(%rbp)
jmp 0x601f
movq -0x620(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5340
movq %rax, -0x628(%rbp)
jmp 0x6038
movq -0x628(%rbp), %rdi
leaq 0x12095(%rip), %rsi     # 0x180db
callq 0x5380
jmp 0x604d
leaq 0x12074(%rip), %rsi     # 0x180c8
leaq -0x2f0(%rbp), %rdi
callq 0x5380
jmp 0x6062
leaq -0x158(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x6e00
jmp 0x6077
callq 0x6c70
movq %rax, -0x638(%rbp)
leaq -0x351(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x5690
movq -0x638(%rbp), %rsi
movq -0x630(%rbp), %rdx
leaq -0x350(%rbp), %rdi
callq 0x6c80
jmp 0x60b2
leaq -0x351(%rbp), %rdi
callq 0x53c0
leaq -0x379(%rbp), %rdi
movq %rdi, -0x640(%rbp)
callq 0x5690
movq -0x640(%rbp), %rdx
leaq 0x11ffc(%rip), %rsi     # 0x180db
leaq -0x378(%rbp), %rdi
callq 0x54d0
jmp 0x60ed
leaq -0x158(%rbp), %rdi
leaq -0x350(%rbp), %rsi
leaq -0x378(%rbp), %rdx
callq 0x6e40
jmp 0x6109
leaq -0x378(%rbp), %rdi
callq 0x5270
leaq -0x379(%rbp), %rdi
callq 0x53c0
leaq -0x498(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x5700
jmp 0x6136
leaq -0x4b8(%rbp), %rdi
movq %rdi, -0x648(%rbp)
callq 0x54f0
movq -0x648(%rbp), %rsi
leaq -0x498(%rbp), %rdi
callq 0x5450
jmp 0x615e
leaq -0x498(%rbp), %rdi
leaq -0x4bc(%rbp), %rsi
callq 0x5060
jmp 0x6173
leaq -0x4e0(%rbp), %rdi
movq %rdi, -0x650(%rbp)
callq 0x54f0
movq -0x650(%rbp), %rsi
leaq -0x498(%rbp), %rdi
callq 0x5090
jmp 0x619b
movq -0x498(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x498(%rbp,%rax), %rdi
movb $0x0, -0x501(%rbp)
callq 0x51d0
movb %al, -0x651(%rbp)
jmp 0x61c2
movb -0x651(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x652(%rbp)
jne 0x6225
jmp 0x61d7
xorl %eax, %eax
movl %eax, %edx
leaq -0x500(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
movl $0x5, %ecx
callq 0x53a0
jmp 0x61f5
movb $0x1, -0x501(%rbp)
leaq 0x11edb(%rip), %rsi     # 0x180de
leaq -0x500(%rbp), %rdi
callq 0x6e90
movb %al, -0x653(%rbp)
jmp 0x6217
movb -0x653(%rbp), %al
movb %al, -0x652(%rbp)
jmp 0x6225
movb -0x652(%rbp), %al
movb %al, -0x654(%rbp)
testb $0x1, -0x501(%rbp)
jne 0x623c
jmp 0x6248
leaq -0x500(%rbp), %rdi
callq 0x5270
movb -0x654(%rbp), %al
testb $0x1, %al
jne 0x6257
jmp 0x644a
movq 0x1dd6a(%rip), %rdi     # 0x23fc8
leaq 0x11e7f(%rip), %rsi     # 0x180e4
callq 0x5380
jmp 0x626c
movl $0x1, -0x4(%rbp)
movl $0x1, -0x508(%rbp)
jmp 0x6775
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5270
leaq -0x61(%rbp), %rdi
callq 0x53c0
jmp 0x68c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5270
leaq -0xa9(%rbp), %rdi
callq 0x53c0
jmp 0x68c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xd1(%rbp), %rdi
callq 0x53c0
jmp 0x68b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x68a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x689c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6890
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6884
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x1d9(%rbp), %rdi
callq 0x53c0
jmp 0x6878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x686c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6860
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x351(%rbp), %rdi
callq 0x53c0
jmp 0x6860
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x63de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x5270
leaq -0x379(%rbp), %rdi
callq 0x53c0
jmp 0x6854
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6854
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x683c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6830
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
testb $0x1, -0x501(%rbp)
jne 0x6439
jmp 0x6445
leaq -0x500(%rbp), %rdi
callq 0x5270
jmp 0x6830
movq 0x1db77(%rip), %rdi     # 0x23fc8
leaq 0x11c9e(%rip), %rsi     # 0x180f6
callq 0x5380
movq %rax, -0x660(%rbp)
jmp 0x6466
movq -0x660(%rbp), %rdi
movl -0x4bc(%rbp), %esi
callq 0x54a0
movq %rax, -0x668(%rbp)
jmp 0x6481
movq -0x668(%rbp), %rdi
movq 0x1db09(%rip), %rsi     # 0x23f98
callq 0x53b0
jmp 0x6496
leaq -0x529(%rbp), %rdi
movq %rdi, -0x670(%rbp)
callq 0x5690
movq -0x670(%rbp), %rdx
leaq 0x11c22(%rip), %rsi     # 0x180d9
leaq -0x528(%rbp), %rdi
callq 0x54d0
jmp 0x64c5
leaq -0x158(%rbp), %rdi
leaq -0x350(%rbp), %rsi
leaq -0x528(%rbp), %rdx
callq 0x6e40
jmp 0x64e1
leaq -0x528(%rbp), %rdi
callq 0x5270
leaq -0x529(%rbp), %rdi
callq 0x53c0
leaq -0x550(%rbp), %rdi
callq 0x54f0
leaq -0x498(%rbp), %rdi
leaq -0x550(%rbp), %rsi
callq 0x5090
movq %rax, -0x678(%rbp)
jmp 0x6521
movq -0x678(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x5440
movb %al, -0x679(%rbp)
jmp 0x653f
movb -0x679(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x67a(%rbp)
jne 0x6554
jmp 0x657d
leaq 0x11ba9(%rip), %rsi     # 0x18104
leaq -0x550(%rbp), %rdi
callq 0x6e90
movb %al, -0x67b(%rbp)
jmp 0x656f
movb -0x67b(%rbp), %al
movb %al, -0x67a(%rbp)
jmp 0x657d
movb -0x67a(%rbp), %al
testb $0x1, %al
jne 0x6589
jmp 0x6607
movq 0x1da38(%rip), %rdi     # 0x23fc8
leaq -0x550(%rbp), %rsi
callq 0x5340
movq %rax, -0x688(%rbp)
jmp 0x65a5
movq -0x688(%rbp), %rdi
leaq 0x11b29(%rip), %rsi     # 0x180dc
callq 0x5380
jmp 0x65ba
jmp 0x6505
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x65e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x528(%rbp), %rdi
callq 0x5270
leaq -0x529(%rbp), %rdi
callq 0x53c0
jmp 0x6830
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6824
movq 0x1d9ba(%rip), %rdi     # 0x23fc8
leaq 0x11ac7(%rip), %rsi     # 0x180dc
callq 0x5380
jmp 0x661c
leaq -0x350(%rbp), %rdi
callq 0x6ec0
cmpq $0x0, %rax
jbe 0x6645
movq 0x1d993(%rip), %rdi     # 0x23fc8
leaq -0x350(%rbp), %rsi
callq 0x50a0
jmp 0x6643
jmp 0x6645
leaq -0x560(%rbp), %rdi
callq 0x6f10
movl $0x1, %edi
callq 0x6fa0
movq %rax, -0x690(%rbp)
jmp 0x6664
movq -0x690(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rdx
leaq -0x158(%rbp), %rdi
leaq -0x350(%rbp), %rsi
leaq -0x560(%rbp), %rcx
callq 0x6f40
movq %rax, -0x698(%rbp)
jmp 0x669c
movq -0x698(%rbp), %rax
cmpq $0x0, %rax
je 0x66c0
movq 0x1d918(%rip), %rdi     # 0x23fc8
leaq -0x350(%rbp), %rsi
callq 0x50a0
jmp 0x66be
jmp 0x6651
leaq -0x578(%rbp), %rdi
movl $0x2, %esi
callq 0x7000
leaq -0x560(%rbp), %rdi
leaq -0x578(%rbp), %rsi
callq 0x6fd0
testb $0x1, %al
jne 0x66ea
jmp 0x675f
movl $0x20, %edi
callq 0x51f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x6a0(%rbp)
movups -0x560(%rbp), %xmm0
movaps %xmm0, -0x590(%rbp)
movl -0x590(%rbp), %esi
movq -0x588(%rbp), %rdx
callq 0x7050
jmp 0x6723
movq -0x6a0(%rbp), %rdi
movq 0x1d857(%rip), %rsi     # 0x23f88
movq 0x1d878(%rip), %rdx     # 0x23fb0
callq 0x5640
jmp 0x6993
movq -0x6a0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x52b0
jmp 0x6824
leaq -0x550(%rbp), %rdi
callq 0x5270
movl $0x0, -0x508(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x5270
leaq -0x4b8(%rbp), %rdi
callq 0x5270
leaq -0x498(%rbp), %rdi
callq 0x5630
leaq -0x350(%rbp), %rdi
callq 0x70e0
leaq -0x2f0(%rbp), %rdi
callq 0x55e0
leaq -0x1d8(%rbp), %rdi
callq 0x70e0
leaq -0x158(%rbp), %rdi
callq 0x7130
leaq -0x128(%rbp), %rdi
callq 0x7150
leaq -0x110(%rbp), %rdi
callq 0x7170
leaq -0xe8(%rbp), %rdi
callq 0x71a0
leaq -0xd0(%rbp), %rdi
callq 0x5270
leaq -0x88(%rbp), %rdi
callq 0x5270
leaq -0x40(%rbp), %rdi
callq 0x5270
movl -0x508(%rbp), %eax
testl %eax, %eax
je 0x681f
jmp 0x681a
jmp 0x6976
jmp 0x696f
leaq -0x550(%rbp), %rdi
callq 0x5270
leaq -0x4e0(%rbp), %rdi
callq 0x5270
leaq -0x4b8(%rbp), %rdi
callq 0x5270
leaq -0x498(%rbp), %rdi
callq 0x5630
leaq -0x350(%rbp), %rdi
callq 0x70e0
leaq -0x2f0(%rbp), %rdi
callq 0x55e0
leaq -0x1d8(%rbp), %rdi
callq 0x70e0
leaq -0x158(%rbp), %rdi
callq 0x7130
leaq -0x128(%rbp), %rdi
callq 0x7150
leaq -0x110(%rbp), %rdi
callq 0x7170
leaq -0xe8(%rbp), %rdi
callq 0x71a0
leaq -0xd0(%rbp), %rdi
callq 0x5270
leaq -0x88(%rbp), %rdi
callq 0x5270
leaq -0x40(%rbp), %rdi
callq 0x5270
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x6982
movq -0x18(%rbp), %rdi
callq 0x51a0
movq %rax, -0x598(%rbp)
movq 0x1d6d8(%rip), %rdi     # 0x23fc8
leaq 0x1180f(%rip), %rsi     # 0x18106
callq 0x5380
movq %rax, -0x6a8(%rbp)
jmp 0x6905
movq -0x598(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x6a8(%rbp), %rdi
movq %rax, %rsi
callq 0x5380
movq %rax, -0x6b0(%rbp)
jmp 0x692d
movq -0x6b0(%rbp), %rdi
leaq 0x117a1(%rip), %rsi     # 0x180dc
callq 0x5380
jmp 0x6942
movl $0x1, -0x4(%rbp)
movl $0x1, -0x508(%rbp)
callq 0x5610
jmp 0x6976
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x5610
jmp 0x696d
jmp 0x6982
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x6b0, %rsp            # imm = 0x6B0
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x5660
movq %rax, %rdi
callq 0x71c0
nopw %cs:(%rax,%rax)
nopl (%rax)