// File: /workspace/github_cpp_makefile_star2_O3/jliesch[P]ofxget/ofxget_main.cc
// Function: main
int main(int argc, char** argv) {
  CmdArgStr request_filename('r', "request", "request_file", "Request file name under the requests directory. See investment.txt for an example.");
  CmdArgStr passwords_filename('r', "passwords", "passwords_file", "Optional passwords file. If used, supplies passwords for an institution. See example_passwords.txt. Storing passwords in plain text is not safe. This file should only be used for testing purposes.", CmdArg::isOPT);
  CmdArgInt institution('i', "institution", "institution_id", "Institution id. Chooses which institution to read from institutions.txt.");
  CmdLine cmd(argv[0], &request_filename, &institution, &passwords_filename, nullptr);
  cmd.parse(argc, argv);

  OfxGetContext ofxget;
  string request_template = ofxget.GetRequestTemplate("requests/" + string(request_filename));
  ofxget.AddApp("QuickBooks_2008").AddInstitution(institution)
      .AddRequestTemplate(request_template);
  if (passwords_filename.isFound()) {
    ofxget.AddPasswordsForTest(institution, passwords_filename);
  } else {
    ofxget.AddPasswordsForTest(institution, "passwords.txt");
  }

  vector<string> missing_vars = GetMissingRequestVars(request_template,
                                                      ofxget.vars_map_);
  if (!missing_vars.empty()) {
    cout << "Enter missing account info:" << endl;
  }
  for (const string& missing_var : missing_vars) {
    cout << missing_var << ": " << flush;
    string value;
    cin >> value;
    ofxget.vars_map_[missing_var] = value;
  }

  ofxget.PostRequest();
  if (ofxget.is_error()) {
    cout << "ERROR" << ofxget.error_string() << endl;
  } else {
    cout << "REQUEST" << endl << ofxget.request() << endl;
    cout << "RESPONSE" << endl << endl << ofxget.response() << endl;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %rbx
movl %edi, %ebp
xorl %r14d, %r14d
movq %r14, (%rsp)
leaq 0x1cfb(%rip), %rdx      # 0x315cf
leaq 0x6df5(%rip), %rcx      # 0x366d0
leaq 0x6dfb(%rip), %r8       # 0x366dd
leaq 0x1a0(%rsp), %rdi
movl $0x72, %esi
movl $0xa, %r9d
callq 0x1b056
movq %r14, (%rsp)
leaq 0x6e2b(%rip), %rdx      # 0x36730
leaq 0x6e2e(%rip), %rcx      # 0x3673a
leaq 0x6e36(%rip), %r8       # 0x36749
leaq 0x168(%rsp), %rdi
movl $0x72, %esi
movl $0x1, %r9d
callq 0x1b056
movl $0x0, (%rsp)
leaq 0x177e(%rip), %rdx      # 0x310b7
leaq 0x6ece(%rip), %rcx      # 0x3680e
leaq 0x6ed6(%rip), %r8       # 0x3681d
leaq 0x130(%rsp), %rdi
movl $0x69, %esi
movl $0xa, %r9d
callq 0x1ad54
movq (%rbx), %rsi
leaq 0x78(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
leaq 0x130(%rsp), %rcx
leaq 0x168(%rsp), %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1c334
leaq 0x78(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c7e2
leaq 0xa0(%rsp), %rdi
callq 0x8758
leaq 0x1a0(%rsp), %rdi
callq 0x1b110
leaq 0x38(%rsp), %rdi
leaq 0x17(%rsp), %rdx
movq %rax, %rsi
callq 0x66d0
leaq 0x6e9b(%rip), %rcx      # 0x36866
leaq 0x38(%rsp), %rdi
movl $0x9, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x6110
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2fa06
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
jmp 0x2fa0d
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x91c8
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2fa4a
callq 0x63c0
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fa5d
callq 0x63c0
leaq 0x18(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x15fb(%rip), %rsi      # 0x31067
leaq 0x1603(%rip), %rdx      # 0x31076
callq 0xa256
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x88b6
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x1ae90
movq %rbx, %rdi
movl %eax, %esi
callq 0x8a6e
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x93c8
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2fac0
callq 0x63c0
leaq 0x168(%rsp), %rdi
callq 0x1ad28
testb %al, %al
je 0x2fb01
leaq 0x130(%rsp), %rdi
callq 0x1ae90
movl %eax, %ebx
leaq 0x168(%rsp), %rdi
callq 0x1b110
leaq 0xa0(%rsp), %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x8f38
jmp 0x2fb24
leaq 0x130(%rsp), %rdi
callq 0x1ae90
leaq 0x6d5b(%rip), %rdx      # 0x36870
leaq 0xa0(%rsp), %rdi
movl %eax, %esi
callq 0x8f38
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x9bbe
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x2fc44
movq 0x1742e(%rip), %rbx     # 0x46f80
leaq 0x6d25(%rip), %rsi      # 0x3687e
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x66a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq 0x173fc(%rip), %rdi     # 0x46f80
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq 0x38(%rsp), %r14
movq 0x40(%rsp), %r12
cmpq %r12, %r14
je 0x2fc44
movq 0x1740d(%rip), %r13     # 0x46fb8
leaq 0x18(%rsp), %rbp
leaq 0xa0(%rsp), %rbx
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x173ba(%rip), %rdi     # 0x46f80
callq 0x66a0
movq %rax, %r15
movl $0x2, %edx
movq %rax, %rdi
leaq 0x18c4(%rip), %rsi      # 0x314a1
callq 0x66a0
movq %r15, %rdi
callq 0x6350
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x62c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9fac
movq %rax, %rdi
movq %rbp, %rsi
callq 0x67e0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2fc37
callq 0x63c0
addq $0x20, %r14
cmpq %r12, %r14
jne 0x2fbb8
leaq 0xa0(%rsp), %rdi
leaq 0x78(%rsp), %r14
callq 0x9610
cmpq $0x0, 0xd8(%rsp)
je 0x2fcb1
movq 0x17318(%rip), %rdi     # 0x46f80
leaq 0x6c2b(%rip), %rsi      # 0x3689a
movl $0x5, %edx
callq 0x66a0
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq 0x172f0(%rip), %rdi     # 0x46f80
callq 0x66a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
jmp 0x2fdfb
movq 0x172c8(%rip), %rbx     # 0x46f80
leaq 0x6be1(%rip), %rsi      # 0x368a0
movl $0x7, %edx
movq %rbx, %rdi
callq 0x66a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq 0x17296(%rip), %rdi     # 0x46f80
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x93e2
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rdi
leaq 0x28(%rsp), %r15
callq 0x66a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq %rbx, %rdi
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2fd5c
callq 0x63c0
movq 0x1721d(%rip), %rbx     # 0x46f80
leaq 0x6b3e(%rip), %rsi      # 0x368a8
movl $0x8, %edx
movq %rbx, %rdi
callq 0x66a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq 0x171eb(%rip), %rdi     # 0x46f80
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq %rbx, %rdi
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq %rax, %rdi
callq 0x66a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
movsbl %al, %esi
movq %rbx, %rdi
callq 0x63d0
movq %rax, %rdi
callq 0x6350
leaq 0x38(%rsp), %rdi
callq 0xa040
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fe2b
callq 0x63c0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fe41
callq 0x63c0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fe57
callq 0x63c0
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fe6d
callq 0x63c0
leaq 0xa0(%rsp), %rdi
callq 0xa0d2
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fe94
movq (%rdi), %rbx
callq 0x63c0
movq %rbx, %rdi
cmpq %r14, %rbx
jne 0x2fe84
leaq 0x130(%rsp), %rdi
callq 0x1acbe
leaq 0x168(%rsp), %rdi
callq 0x1b0a2
leaq 0x1a0(%rsp), %rdi
callq 0x1b0a2
xorl %eax, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ff4c
jmp 0x2ff31
jmp 0x2ff31
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2feec
callq 0x63c0
jmp 0x2feec
movq %rax, %r14
leaq 0x48(%rsp), %rax
jmp 0x2ff77
jmp 0x2fef8
movq %rax, %r14
jmp 0x2ff85
jmp 0x2ff02
movq %rax, %r14
jmp 0x2ff92
movq %rax, %r14
jmp 0x2ffb1
movq %rax, %r14
jmp 0x2ffbe
movq %rax, %r14
jmp 0x2ffcb
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
jne 0x2ff63
jmp 0x2ff68
movq %rax, %r14
jmp 0x2ff72
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ff72
callq 0x63c0
jmp 0x2ff72
jmp 0x2ff4c
movq %rax, %r14
jmp 0x2ff68
movq %rax, %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2ff68
callq 0x63c0
leaq 0x38(%rsp), %rdi
callq 0xa040
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ff85
callq 0x63c0
leaq 0xa0(%rsp), %rdi
callq 0x2ffe0
movq 0x78(%rsp), %rdi
leaq 0x78(%rsp), %r15
cmpq %r15, %rdi
je 0x2ffb1
movq (%rdi), %rbx
callq 0x63c0
movq %rbx, %rdi
cmpq %r15, %rbx
jne 0x2ffa1
leaq 0x130(%rsp), %rdi
callq 0x1acbe
leaq 0x168(%rsp), %rdi
callq 0x1b0a2
leaq 0x1a0(%rsp), %rdi
callq 0x1b0a2
movq %r14, %rdi
callq 0x6440