// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xcdf0(%rip), %rax      # 0xe100
movq (%rax), %rsi
leaq 0x8d0e(%rip), %rdi      # 0xa028
movb $0x0, %al
callq 0x1030
cmpl $0x2, -0x8(%rbp)
jg 0x134b
movq 0xccaa(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
leaq 0x8d16(%rip), %rsi      # 0xa04e
movb $0x0, %al
callq 0x1180
movl $0x1, -0x4(%rbp)
jmp 0x162f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x1760
leaq 0x8cfa(%rip), %rax      # 0xa070
movq %rax, -0x50(%rbp)
leaq 0x2bf(%rip), %rax       # 0x1640
movq %rax, -0x88(%rbp)
movb $0x0, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x90(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
callq 0x17d0
leaq -0xc8(%rbp), %rdi
callq 0x1680
testb $0x1, %al
jne 0x13bc
jmp 0x1601
movl -0xa4(%rbp), %esi
leaq 0x8caa(%rip), %rdi      # 0xa073
movb $0x0, %al
callq 0x1030
movl $0x1, -0xcc(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq -0xa0(%rbp), %rcx
movslq -0xa4(%rbp), %rdx
imulq $0xe8, %rdx, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
je 0x15ff
movl -0xcc(%rbp), %esi
movq -0xd8(%rbp), %rax
movq (%rax), %rdx
movq -0xd8(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0xd8(%rbp), %rax
movq 0x38(%rax), %r8
movq -0xd8(%rbp), %rax
movl 0xb0(%rax), %r9d
leaq 0x8c39(%rip), %rdi      # 0xa084
movb $0x0, %al
callq 0x1030
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
movq -0xd8(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
je 0x1489
movq -0xd8(%rbp), %rax
movq 0xd0(%rax), %rax
movq %rax, -0xf0(%rbp)
jmp 0x1499
leaq 0x8c1e(%rip), %rax      # 0xa0ae
movq %rax, -0xf0(%rbp)
jmp 0x1499
movq -0xf0(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xd8(%rbp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x14cf
movq -0xd8(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x100(%rbp)
jmp 0x14df
leaq 0x8bd8(%rip), %rax      # 0xa0ae
movq %rax, -0x100(%rbp)
jmp 0x14df
movq -0xf8(%rbp), %rsi
movq -0x100(%rbp), %rdx
movq -0xd8(%rbp), %rax
movl 0xb4(%rax), %ecx
leaq 0x8bae(%rip), %rdi      # 0xa0af
movb $0x0, %al
callq 0x1030
movq -0xd8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd 0x18(%rax), %xmm1
callq 0x16b0
testb $0x1, %al
jne 0x1524
jmp 0x154a
movq -0xd8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0xd8(%rbp), %rax
movsd 0x18(%rax), %xmm1
leaq 0x8b99(%rip), %rdi      # 0xa0dc
movb $0x2, %al
callq 0x1030
movq -0xd8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x15a5
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm0
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movsd 0x18(%rax), %xmm1
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm2
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm3
leaq 0x8b56(%rip), %rdi      # 0xa0f4
movb $0x4, %al
callq 0x1030
movq -0xd8(%rbp), %rdi
leaq 0x8b82(%rip), %rsi      # 0xa135
leaq -0xd9(%rbp), %rdx
callq 0x1e70
movq %rax, -0xe8(%rbp)
testb $0x1, -0xd9(%rbp)
je 0x15e4
movq -0xe8(%rbp), %rsi
leaq 0x8b81(%rip), %rdi      # 0xa15e
movb $0x0, %al
callq 0x1030
jmp 0x15e6
movq -0xd8(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0xd8(%rbp)
jmp 0x13e8
jmp 0x161c
movl -0xc8(%rbp), %esi
movq -0xc0(%rbp), %rdx
leaq 0x8b63(%rip), %rdi      # 0xa178
movb $0x0, %al
callq 0x1030
leaq -0xc8(%rbp), %rdi
callq 0x1d80
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)