// File: /workspace/github_cpp_makefile_star2_O1/jliesch[P]ofxget/ofxhome.cc
// Function: ofxget::ValidateApiKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool ValidateApiKey(const string& api_key) {
    CURL *curl = curl_easy_init();
    if (! curl) {
      throw string("Could not initialize curl");
    }

    char *api_key_output = curl_easy_escape(curl, api_key.c_str(), api_key.size());
    string output = string("api_key=") + api_key_output;
    string response;
#ifdef OFXHOME_DEBUG
    curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/ofxhome/index.php/api/checkApiKey");
#else
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.ofxhome.com/beta/index.php/api/checkApiKey");
#endif
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToString);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, (long) output.size());
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, output.c_str());

    CURLcode res = curl_easy_perform(curl);
    if (res != CURLE_OK) {
        throw "Curl error: " + std::to_string(res);
    }

    curl_free(api_key_output);
    curl_easy_cleanup(curl);

    return response == "success";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %r14
callq 0x66a0
testq %rax, %rax
je 0xc227
movq %rax, %rbx
movq (%r14), %rsi
movl 0x8(%r14), %edx
movq %rax, %rdi
callq 0x64e0
movq %rax, %r14
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x254f1(%rip), %rsi     # 0x315cc
leaq 0x254f2(%rip), %rdx     # 0x315d4
movq %rsp, %rdi
callq 0xa06a
movq %rsp, %rdi
movq %r14, %rsi
callq 0x6460
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc11d
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0xc125
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xc14b
callq 0x63b0
movq %r15, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0x254bd(%rip), %rdx     # 0x31621
movq %rbx, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x65e0
leaq -0x148b(%rip), %rdx     # 0xacef
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x65e0
movq %rsp, %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x65e0
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
movl $0x75a8, %esi           # imm = 0x75A8
xorl %eax, %eax
callq 0x65e0
movq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x271f, %esi           # imm = 0x271F
xorl %eax, %eax
callq 0x65e0
movq %rbx, %rdi
callq 0x6490
movl %eax, %ebp
testl %eax, %eax
jne 0xc26e
movq %r14, %rdi
callq 0x6040
movq %rbx, %rdi
callq 0x60c0
leaq 0x2546b(%rip), %rsi     # 0x31657
movq %rsp, %r14
movq %r14, %rdi
callq 0x6630
movl %eax, %ebx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0xc206
callq 0x63b0
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xc215
callq 0x63b0
testl %ebx, %ebx
sete %al
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x6260
movq %rax, %r14
addq $0x10, %rax
movq %rax, (%r14)
movb $0x1, %bpl
leaq 0x24f12(%rip), %rsi     # 0x31157
leaq 0x24f24(%rip), %rdx     # 0x31170
movq %r14, %rdi
callq 0xa06a
xorl %ebp, %ebp
leaq 0x3a293(%rip), %rsi     # 0x464f0
movq 0x3ad34(%rip), %rdx     # 0x46f98
movq %r14, %rdi
callq 0x6420
jmp 0xc2b6
movl $0x20, %edi
callq 0x6260
movq %rax, %r14
leaq 0x40(%rsp), %rdi
movl %ebp, %esi
callq 0xc3a2
movb $0x1, %bpl
leaq 0x24f1f(%rip), %rsi     # 0x311b0
leaq 0x40(%rsp), %rdx
movq %r14, %rdi
callq 0xc332
xorl %ebp, %ebp
leaq 0x3a249(%rip), %rsi     # 0x464f0
movq 0x3acea(%rip), %rdx     # 0x46f98
movq %r14, %rdi
callq 0x6420
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc2d4
callq 0x63b0
jmp 0xc2d4
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0xc30d
movq %r14, %rdi
callq 0x6600
jmp 0xc30d
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0xc325
jmp 0xc32a
movq %rax, %rbx
jmp 0xc32a
movq %rax, %rbx
testb %bpl, %bpl
je 0xc32a
movq %r14, %rdi
callq 0x6600
jmp 0xc32a
jmp 0xc30a
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xc31b
callq 0x63b0
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xc32a
callq 0x63b0
movq %rbx, %rdi
callq 0x6430