// File: /workspace/github_cpp_makefile_star2_O2/gualtieromalde[P]owmread/owmread.C
// Function: readCoord(int)
Coord readCoord(int port)
{
    const std::string url_lat = "http://localhost:" + std::to_string(port) + "/json/position/latitude-deg";
    const std::string url_lon = "http://localhost:" + std::to_string(port) + "/json/position/longitude-deg";

    CURL* curlLat = curl_easy_init();

    curl_easy_setopt(curlLat, CURLOPT_URL, url_lat.c_str());
    curl_easy_setopt(curlLat, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
    curl_easy_setopt(curlLat, CURLOPT_TIMEOUT, 10);
    curl_easy_setopt(curlLat, CURLOPT_FOLLOWLOCATION, 1L);
    long httpCode(0);
    std::string httpDataLat;
    curl_easy_setopt(curlLat, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curlLat, CURLOPT_WRITEDATA, &httpDataLat);
    curl_easy_perform(curlLat);
    curl_easy_getinfo(curlLat, CURLINFO_RESPONSE_CODE, &httpCode);
    curl_easy_cleanup(curlLat);
    Json::Value jsonDataLat;
    Json::Reader jsonReaderLat;
    jsonReaderLat.parse(httpDataLat, jsonDataLat);   
    double lat = jsonDataLat["value"].asDouble();	     
    
     CURL* curlLon = curl_easy_init();

    curl_easy_setopt(curlLon, CURLOPT_URL, url_lon.c_str());
    curl_easy_setopt(curlLon, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
    curl_easy_setopt(curlLon, CURLOPT_TIMEOUT, 10);
    curl_easy_setopt(curlLon, CURLOPT_FOLLOWLOCATION, 1L);
    long httpCodeLon(0);
    std::string httpDataLon;
    curl_easy_setopt(curlLon, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curlLon, CURLOPT_WRITEDATA, &httpDataLon);
    curl_easy_perform(curlLon);
    curl_easy_getinfo(curlLon, CURLINFO_RESPONSE_CODE, &httpCodeLon);
    curl_easy_cleanup(curlLon);
    Json::Value jsonDataLon;
    Json::Reader jsonReaderLon;
    jsonReaderLon.parse(httpDataLon, jsonDataLon);   
    double lon = jsonDataLon["value"].asDouble();	     
    
    
    
    return Coord(lat,lon);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movl %edi, %ebx
leaq 0x208(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0xad98
leaq 0x2672b(%rip), %rsi     # 0x305ab
leaq 0xf8(%rsp), %rdi
movq %r14, %rdx
callq 0xae44
leaq 0x26726(%rip), %rdx     # 0x305bd
leaq 0xd8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xadf1
leaq 0xf8(%rsp), %rdi
callq 0x8988
leaq 0x208(%rsp), %rdi
callq 0x8988
leaq 0x208(%rsp), %rdi
movl %ebx, %esi
callq 0xad98
leaq 0x266cf(%rip), %rsi     # 0x305ab
leaq 0xf8(%rsp), %rdi
leaq 0x208(%rsp), %rdx
callq 0xae44
leaq 0x266e1(%rip), %rdx     # 0x305d9
leaq 0xb8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xadf1
leaq 0xf8(%rsp), %rdi
callq 0x8988
leaq 0x208(%rsp), %rdi
callq 0x8988
callq 0x87b0
movq %rax, %rbx
movq 0xd8(%rsp), %rdx
movq %rax, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x86a0
pushq $0x71
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
pushq $0xd
popq %rsi
pushq $0xa
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
pushq $0x34
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
andq $0x0, 0x20(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xc27(%rip), %rdx      # 0x936d
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x86a0
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x86a0
movq %rbx, %rdi
callq 0x8510
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x8780
movq %rbx, %rdi
callq 0x8130
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x23040
leaq 0xf8(%rsp), %rdi
callq 0x181d0
leaq 0xf8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x90(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x19dc0
leaq 0x265db(%rip), %rsi     # 0x305f6
leaq 0x90(%rsp), %rdi
callq 0x26c60
movq %rax, %rdi
callq 0x21250
movsd %xmm0, 0x10(%rsp)
callq 0x87b0
movq %rax, %rbx
movq 0xb8(%rsp), %rdx
movq %rax, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x86a0
pushq $0x71
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
pushq $0xd
popq %rsi
pushq $0xa
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
pushq $0x34
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x86a0
andq $0x0, 0x18(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xd36(%rip), %rdx      # 0x936d
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x86a0
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x86a0
movq %rbx, %rdi
callq 0x8510
leaq 0x18(%rsp), %rdx
movq %rbx, %rdi
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x8780
movq %rbx, %rdi
callq 0x8130
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0x23040
leaq 0x208(%rsp), %rdi
callq 0x181d0
leaq 0x208(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x68(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x19dc0
leaq 0x264d2(%rip), %rsi     # 0x305f6
leaq 0x68(%rsp), %rdi
callq 0x26c60
movq %rax, %rdi
callq 0x21250
movsd %xmm0, 0x8(%rsp)
leaq 0x208(%rsp), %rdi
callq 0xac88
leaq 0x68(%rsp), %rdi
callq 0x24560
leaq 0x28(%rsp), %rdi
callq 0x8988
leaq 0xf8(%rsp), %rdi
callq 0xac88
leaq 0x90(%rsp), %rdi
callq 0x24560
leaq 0x48(%rsp), %rdi
callq 0x8988
leaq 0xb8(%rsp), %rdi
callq 0x8988
leaq 0xd8(%rsp), %rdi
callq 0x8988
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r14
retq
jmp 0xa216
movq %rax, %rbx
jmp 0xa226
jmp 0xa234
jmp 0xa243
movq %rax, %rbx
jmp 0xa253
jmp 0xa262
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x8988
jmp 0xa1e2
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
jmp 0xa277
movq %rax, %rbx
jmp 0xa27c
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x8988
jmp 0xa20c
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
jmp 0xa284
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0xac88
leaq 0x68(%rsp), %rdi
callq 0x24560
jmp 0xa237
jmp 0xa243
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x8988
jmp 0xa246
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0xac88
leaq 0x90(%rsp), %rdi
callq 0x24560
jmp 0xa265
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x8988
leaq 0xb8(%rsp), %rdi
callq 0x8988
leaq 0xd8(%rsp), %rdi
callq 0x8988
movq %rbx, %rdi
callq 0x84b0
movq %rax, %rbx
jmp 0xa26f