// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %r14
callq 0x66c0
testq %rax, %rax
je 0x9f33
movq %rax, %rbx
movq (%r14), %rsi
movl 0x8(%r14), %edx
movq %rax, %rdi
callq 0x6510
movq %rax, %r14
leaq 0x20764(%rip), %rsi     # 0x2a5ac
movq %rsp, %rdi
leaq 0x40(%rsp), %rdx
callq 0x66e0
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
movq %r14, %rdx
callq 0xa192
movq %rsp, %rdi
callq 0x6890
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x2077c(%rip), %rdx     # 0x2a601
movq %rbx, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x6610
leaq -0xe1d(%rip), %rdx      # 0x907e
movq %rbx, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x6610
movq %rsp, %rdx
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
xorl %eax, %eax
callq 0x6610
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
movl $0x75a8, %esi           # imm = 0x75A8
xorl %eax, %eax
callq 0x6610
movq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x271f, %esi           # imm = 0x271F
xorl %eax, %eax
callq 0x6610
movq %rbx, %rdi
callq 0x64c0
movl %eax, %ebp
testl %eax, %eax
jne 0x9f68
movq %r14, %rdi
callq 0x6030
movq %rbx, %rdi
callq 0x60b0
leaq 0x2072e(%rip), %rsi     # 0x2a637
movq %rsp, %rbx
movq %rbx, %rdi
callq 0xa1b1
movl %eax, %ebp
movq %rbx, %rdi
callq 0x6890
leaq 0x20(%rsp), %rdi
callq 0x6890
movl %ebp, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x20
popq %rdi
callq 0x6250
movq %rax, %r14
leaq 0x20212(%rip), %rsi     # 0x2a157
leaq 0x20(%rsp), %rdx
movq %rax, %rdi
callq 0x66e0
leaq 0x385c7(%rip), %rsi     # 0x42520
movq 0x39048(%rip), %rdx     # 0x42fa8
movq %r14, %rdi
callq 0x6440
pushq $0x20
popq %rdi
callq 0x6250
movq %rax, %r14
leaq 0x40(%rsp), %rdi
movl %ebp, %esi
callq 0x81e2
movb $0x1, %bpl
leaq 0x20227(%rip), %rsi     # 0x2a1b0
leaq 0x40(%rsp), %rdx
movq %r14, %rdi
callq 0x8335
xorl %ebp, %ebp
leaq 0x38581(%rip), %rsi     # 0x42520
movq 0x39002(%rip), %rdx     # 0x42fa8
movq %r14, %rdi
callq 0x6440
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x6890
testb %bpl, %bpl
jne 0x9fc5
jmp 0x9fee
movq %rax, %rbx
movq %r14, %rdi
callq 0x6630
jmp 0x9fee
movq %rax, %rbx
movq %r14, %rdi
callq 0x6630
jmp 0xa000
movq %rax, %rbx
movq %rsp, %rdi
jmp 0x9ffb
movq %rax, %rbx
jmp 0xa000
jmp 0x9feb
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6890
leaq 0x20(%rsp), %rdi
callq 0x6890
movq %rbx, %rdi
callq 0x6460