// File: /workspace/github_c_makefile_star2_O1/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 0x9daf(%rip), %rax      # 0xb108
movq (%rax), %rsi
leaq 0x5ccd(%rip), %rdi      # 0x7030
xorl %eax, %eax
callq 0x1030
cmpl $0x2, %ebp
jle 0x154d
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rbx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x155c
leaq 0x5ce9(%rip), %rax      # 0x7078
movq %rax, 0x40(%r15)
leaq -0x18a(%rip), %rax      # 0x1210
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 0x1591
movl (%r12), %esi
cmpl $0xc8, %esi
jne 0x151c
movl 0x34(%rsp), %esi
leaq 0x5ca7(%rip), %rdi      # 0x707b
xorl %eax, %eax
callq 0x1030
cmpl $0x0, 0x34(%rsp)
je 0x152f
movl $0x1, %ebx
movq 0x38(%rsp), %r14
leaq 0x5cbf(%rip), %r15      # 0x70b6
leaq 0x5cb9(%rip), %r12      # 0x70b7
leaq 0x5d38(%rip), %rbp      # 0x713d
leaq 0xf(%rsp), %r13
movq (%r14), %rdx
movq 0x30(%r14), %rcx
movq 0x38(%r14), %r8
movl 0xb0(%r14), %r9d
leaq 0x5c69(%rip), %rdi      # 0x708c
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
movq 0xd0(%r14), %rsi
testq %rsi, %rsi
cmoveq %r15, %rsi
movq 0xd8(%r14), %rdx
testq %rdx, %rdx
cmoveq %r15, %rdx
movl 0xb4(%r14), %ecx
movq %r12, %rdi
xorl %eax, %eax
callq 0x1030
movsd 0x10(%r14), %xmm0
movapd %xmm0, %xmm1
andpd 0x5ba5(%rip), %xmm1     # 0x7010
movsd 0x5bad(%rip), %xmm2     # 0x7020
ucomisd %xmm1, %xmm2
jb 0x14a7
movsd 0x18(%r14), %xmm1
movapd %xmm1, %xmm2
andpd 0x5b85(%rip), %xmm2     # 0x7010
movsd 0x5b95(%rip), %xmm3     # 0x7028
ucomisd %xmm2, %xmm3
jb 0x14a7
leaq 0x5c44(%rip), %rdi      # 0x70e4
movb $0x2, %al
callq 0x1030
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x14d1
movsd 0x10(%rax), %xmm0
movsd 0x18(%rax), %xmm1
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm3
leaq 0x5c32(%rip), %rdi      # 0x70fc
movb $0x4, %al
callq 0x1030
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1a79
cmpb $0x1, 0xf(%rsp)
jne 0x14f7
leaq 0x5c79(%rip), %rdi      # 0x7166
movq %rax, %rsi
xorl %eax, %eax
callq 0x1030
addq $0xe8, %r14
movslq 0x34(%rsp), %rax
imulq $0xe8, %rax, %rax
addq 0x38(%rsp), %rax
incl %ebx
cmpq %rax, %r14
jne 0x140a
jmp 0x152f
movq 0x18(%rsp), %rdx
leaq 0x5c58(%rip), %rdi      # 0x7180
xorl %eax, %eax
callq 0x1030
leaq 0x10(%rsp), %rdi
callq 0x19da
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x122b
movl $0x1, %eax
jmp 0x153b
nopl (%rax)