// File: /workspace/github_c_makefile_star2_O2/sgsfak[P]c-ocgeo/src/example.c
// Function: main
int main(int argc, char* argv[])
{
    printf("Using version '%s' of the ocgeo lib.\n", ocgeo_version);

    if (argc <= 2) {
        fprintf(stderr, "Usage: example <api-key> <query>\n");
        return 1;
    }
    const char* api_key = argv[1];
    const char* query = argv[2];

    /* Initialize parameters with the default values: */
    struct ocgeo_params params = ocgeo_default_params();
    /* and then overwrite them if you wish: */
    params.language = "en";
    // params.min_confidence = 3;
    params.dbg_callback = debug;
    params.no_annotations = false;

    /* Make a (forward) request to the API using the API key you have: */
    struct ocgeo_response response;
    ocgeo_forward(query, api_key, &params, &response);

    /* Check the response : */
    if (ocgeo_response_ok(&response)) {
        /* Retrieve the response information: */
        printf("Got %d results:\n", response.total_results);
        int i=1;
        ocgeo_result_t* result;
        foreach_ocgeo_result(result, &response) {
            printf("%2d. %s (type: %s, category: %s, conf:%d)\n", i,
                result->formatted, result->type, result->category, result->confidence);
            ++i;
            printf("\tGeohash=%s, what3words=%s, calling code=%d\n",
                result->geohash != NULL ? result->geohash : "",
                result->what3words != NULL ? result->what3words : "",
                result->callingcode);
            if (ocgeo_is_valid_latlng(result->geometry))
                printf("\tGeometry: (%.7f,%.7f)\n", 
                    result->geometry.lat, result->geometry.lng);

            if (result->bounds)
                printf("\tBounding box: SW(lat,lon)=(%.7f,%.7f) NE(lat,lon)=(%.7f, %.7f)\n", 
                    result->bounds->southwest.lat, result->bounds->southwest.lng,
                    result->bounds->northeast.lat, result->bounds->northeast.lng);
            bool ok;
            const char* curr = ocgeo_response_get_str(result, "annotations.currency.alternate_symbols.0", &ok);
            if (ok) {
                printf("\t(First) Alt Currency:%s\n", curr);
            }
        }
    }
    else {
        /* Request failed, print error message: */
        printf("Request failed with status: %d Message: %s\n", response.status.code, response.status.message);
    }
    /* Finally "cleanup" the response (free its memory): */
    ocgeo_response_cleanup(&response);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x8def(%rip), %rax      # 0xa108
movq (%rax), %rsi
leaq 0x4d0d(%rip), %rdi      # 0x6030
xorl %eax, %eax
callq 0x1030
cmpl $0x2, %ebp
jle 0x1513
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rbx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x1550
leaq 0x4d29(%rip), %rax      # 0x6078
movq %rax, 0x40(%r15)
leaq 0x1da(%rip), %rax       # 0x1534
movq %rax, 0x8(%r15)
movb $0x0, 0x50(%r15)
leaq 0x10(%rsp), %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x1585
movl (%r12), %esi
cmpl $0xc8, %esi
jne 0x14e2
movl 0x34(%rsp), %esi
leaq 0x4ce7(%rip), %rdi      # 0x607b
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %rbx
movq 0x38(%rsp), %rax
leaq 0x4d0c(%rip), %r14      # 0x60b6
leaq 0x4d06(%rip), %r15      # 0x60b7
leaq 0x4d85(%rip), %r13      # 0x613d
leaq 0xf(%rsp), %rbp
movq %rax, %r12
movslq 0x34(%rsp), %rcx
imulq $0xe8, %rcx, %rcx
addq %rax, %rcx
cmpq %rcx, %r12
je 0x14f5
movq (%r12), %rdx
movq 0x30(%r12), %rcx
movq 0x38(%r12), %r8
movl 0xb0(%r12), %r9d
leaq 0x4c97(%rip), %rdi      # 0x608c
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
movq 0xd0(%r12), %rsi
testq %rsi, %rsi
cmoveq %r14, %rsi
movq 0xd8(%r12), %rdx
testq %rdx, %rdx
cmoveq %r14, %rdx
movl 0xb4(%r12), %ecx
movq %r15, %rdi
xorl %eax, %eax
callq 0x1030
movsd 0x10(%r12), %xmm0
movapd %xmm0, %xmm1
andpd 0x4bcf(%rip), %xmm1     # 0x6010
movsd 0x4bd7(%rip), %xmm2     # 0x6020
ucomisd %xmm1, %xmm2
jb 0x147e
movsd 0x18(%r12), %xmm1
movapd %xmm1, %xmm2
andpd 0x4bae(%rip), %xmm2     # 0x6010
movsd 0x4bbe(%rip), %xmm3     # 0x6028
ucomisd %xmm2, %xmm3
jb 0x147e
leaq 0x4c6d(%rip), %rdi      # 0x60e4
movb $0x2, %al
callq 0x1030
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x14a9
movsd 0x10(%rax), %xmm0
movsd 0x18(%rax), %xmm1
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm3
leaq 0x4c5a(%rip), %rdi      # 0x60fc
movb $0x4, %al
callq 0x1030
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x21ec
cmpb $0x1, 0xf(%rsp)
jne 0x14cf
leaq 0x4ca1(%rip), %rdi      # 0x6166
movq %rax, %rsi
xorl %eax, %eax
callq 0x1030
addq $0xe8, %r12
movq 0x38(%rsp), %rax
incl %ebx
jmp 0x13c0
movq 0x18(%rsp), %rdx
leaq 0x4c92(%rip), %rdi      # 0x6180
xorl %eax, %eax
callq 0x1030
leaq 0x10(%rsp), %rdi
callq 0x2156
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8abe(%rip), %rax      # 0x9fd8
movq (%rax), %rcx
leaq 0x4b32(%rip), %rdi      # 0x6056
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
pushq $0x1
popq %rax
jmp 0x1501