// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movl %edi, %r14d
movl %edi, %ebx
negl %ebx
cmovsl %edi, %ebx
movl $0x1, %r15d
cmpl $0xa, %ebx
jb 0xac41
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xac38
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xac3e
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xac41
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xac05
addl $-0x3, %r15d
jmp 0xac41
addl $-0x2, %r15d
jmp 0xac41
decl %r15d
shrl $0x1f, %r14d
leal (%r15,%r14), %esi
leaq 0x218(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x208(%rsp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x83d0
movq (%r12), %rdi
addq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0xc7e3
leaq 0x2893d(%rip), %rcx     # 0x335bf
movl $0x11, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8130
leaq 0x108(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xacc4
movq %rdx, 0xf8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x108(%rsp)
jmp 0xaccc
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0xf8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x288df(%rip), %rsi     # 0x335d1
callq 0x8450
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xad1e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xad24
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xad4e
callq 0x8350
movq 0x208(%rsp), %rdi
cmpq %rbp, %rdi
je 0xad60
callq 0x8350
movl $0x1, %r15d
cmpl $0xa, %ebx
jb 0xadb4
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0xadab
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xadb1
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xadb4
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xad78
addl $-0x3, %r15d
jmp 0xadb4
addl $-0x2, %r15d
jmp 0xadb4
decl %r15d
leal (%r14,%r15), %esi
leaq 0x208(%rsp), %rdi
movq %rbp, (%rdi)
movl $0x2d, %edx
callq 0x83d0
leaq 0x208(%rsp), %r12
addq (%r12), %r14
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0xc7e3
leaq 0x287d2(%rip), %rcx     # 0x335bf
movl $0x11, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8130
movq %r13, 0xf8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xae2b
movq %rdx, 0xf8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x108(%rsp)
jmp 0xae33
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0xf8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28794(%rip), %rsi     # 0x335ed
callq 0x8450
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xae85
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0xae8c
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xaeb6
callq 0x8350
movq 0x208(%rsp), %rdi
cmpq %rbp, %rdi
je 0xaec8
callq 0x8350
callq 0x8700
movq %rax, %rbx
movq 0x8(%rsp), %rdx
movq %rax, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
movl $0x71, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
movl $0xd, %esi
movl $0xa, %edx
xorl %eax, %eax
callq 0x85f0
movl $0x1, %edx
movq %rbx, %rdi
movl $0x34, %esi
xorl %eax, %eax
callq 0x85f0
xorl %eax, %eax
movq %rax, 0x40(%rsp)
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb $0x0, (%r15)
leaq -0x17c6(%rip), %rdx     # 0x977c
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x85f0
leaq 0x88(%rsp), %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
callq 0x8490
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x86d0
movq %rbx, %rdi
callq 0x80f0
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x25fa0
leaq 0xf8(%rsp), %rdi
callq 0x1b130
leaq 0xf8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
movl $0x1, %ecx
callq 0x1cd20
leaq 0x28639(%rip), %rsi     # 0x3360a
leaq 0xd0(%rsp), %rdi
callq 0x29bc0
movq %rax, %rdi
callq 0x241b0
movsd %xmm0, 0x30(%rsp)
callq 0x8700
movq %rax, %rbx
movq 0x48(%rsp), %rdx
movq %rax, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
movl $0x71, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
movl $0xd, %esi
movl $0xa, %edx
xorl %eax, %eax
callq 0x85f0
movl $0x1, %edx
movq %rbx, %rdi
movl $0x34, %esi
xorl %eax, %eax
callq 0x85f0
xorl %eax, %eax
movq %rax, 0x38(%rsp)
leaq 0x78(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
leaq -0x18ea(%rip), %rdx     # 0x977c
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x85f0
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x85f0
movq %rbx, %rdi
callq 0x8490
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x86d0
movq %rbx, %rdi
callq 0x80f0
leaq 0xa8(%rsp), %rdi
xorl %esi, %esi
callq 0x25fa0
leaq 0x208(%rsp), %rdi
callq 0x1b130
leaq 0x208(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movl $0x1, %ecx
callq 0x1cd20
leaq 0x2851b(%rip), %rsi     # 0x3360a
leaq 0xa8(%rsp), %rdi
callq 0x29bc0
movq %rax, %rdi
callq 0x241b0
movsd %xmm0, 0x28(%rsp)
leaq 0x300(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb120
callq 0x8350
leaq 0x2b8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb136
callq 0x8350
leaq 0x258(%rsp), %rdi
callq 0xc62a
leaq 0x208(%rsp), %rdi
callq 0xc7a0
leaq 0xa8(%rsp), %rdi
callq 0x274c0
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0xb16c
callq 0x8350
leaq 0x1f0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb182
callq 0x8350
leaq 0x1a8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb198
callq 0x8350
leaq 0x148(%rsp), %rdi
callq 0xc62a
leaq 0xf8(%rsp), %rdi
callq 0xc7a0
leaq 0xd0(%rsp), %rdi
callq 0x274c0
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0xb1d1
callq 0x8350
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0xb1e0
callq 0x8350
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xb1f4
callq 0x8350
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb29e
movq %rax, %rbx
jmp 0xb2ae
jmp 0xb2bf
jmp 0xb2d3
movq %rax, %rbx
jmp 0xb2e3
jmp 0xb2f2
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb250
callq 0x8350
jmp 0xb250
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %rbp, %rdi
jne 0xb316
jmp 0xb31b
movq %rax, %rbx
jmp 0xb31b
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb288
callq 0x8350
jmp 0xb288
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %rbp, %rdi
jne 0xb32a
jmp 0xb32f
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0xc00a
leaq 0xa8(%rsp), %rdi
callq 0x274c0
jmp 0xb2c2
jmp 0xb2d3
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0xb2d6
callq 0x8350
jmp 0xb2d6
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0xc00a
leaq 0xd0(%rsp), %rdi
callq 0x274c0
jmp 0xb2f5
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0xb30c
callq 0x8350
jmp 0xb30c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0xb31b
callq 0x8350
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xb32f
callq 0x8350
movq %rbx, %rdi
callq 0x8440