// File: /workspace/github_cpp_makefile_star2_O1/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 0x171b(%rip), %rdx      # 0x315cf
leaq 0x6a35(%rip), %rcx      # 0x368f0
leaq 0x6a3b(%rip), %r8       # 0x368fd
leaq 0x1a0(%rsp), %rdi
movl $0x72, %esi
movl $0xa, %r9d
callq 0x1af46
movq %r14, (%rsp)
leaq 0x6a6b(%rip), %rdx      # 0x36950
leaq 0x6a6e(%rip), %rcx      # 0x3695a
leaq 0x6a76(%rip), %r8       # 0x36969
leaq 0x168(%rsp), %rdi
movl $0x72, %esi
movl $0x1, %r9d
callq 0x1af46
movl $0x0, (%rsp)
leaq 0x119e(%rip), %rdx      # 0x310b7
leaq 0x6b0e(%rip), %rcx      # 0x36a2e
leaq 0x6b16(%rip), %r8       # 0x36a3d
leaq 0x130(%rsp), %rdi
movl $0x69, %esi
movl $0xa, %r9d
callq 0x1ac44
movq (%rbx), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
leaq 0x130(%rsp), %rcx
leaq 0x168(%rsp), %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1c230
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c6de
leaq 0xa0(%rsp), %rdi
callq 0x8570
leaq 0x1a0(%rsp), %rdi
callq 0x1b006
leaq 0x38(%rsp), %rdi
leaq 0x17(%rsp), %rdx
movq %rax, %rsi
callq 0x66d0
leaq 0x6ad8(%rip), %rcx      # 0x36a86
leaq 0x38(%rsp), %rdi
movl $0x9, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x6110
leaq 0x28(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ffe9
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
jmp 0x2fff1
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x8ffc
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x30031
callq 0x63c0
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30044
callq 0x63c0
leaq 0x18(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x1014(%rip), %rsi      # 0x31067
leaq 0x101c(%rip), %rdx      # 0x31076
callq 0xa07a
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x86ce
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x1ad80
movq %rbx, %rdi
movl %eax, %esi
callq 0x8886
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x91fc
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x300aa
callq 0x63c0
leaq 0x168(%rsp), %rdi
callq 0x1ac18
testb %al, %al
je 0x300eb
leaq 0x130(%rsp), %rdi
callq 0x1ad80
movl %eax, %ebx
leaq 0x168(%rsp), %rdi
callq 0x1b006
leaq 0xa0(%rsp), %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x8d6c
jmp 0x3010e
leaq 0x130(%rsp), %rdi
callq 0x1ad80
leaq 0x6991(%rip), %rdx      # 0x36a90
leaq 0xa0(%rsp), %rdi
movl %eax, %esi
callq 0x8d6c
leaq 0x38(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x9a0a
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x3017a
movq 0x16e45(%rip), %rbx     # 0x46f80
leaq 0x695c(%rip), %rsi      # 0x36a9e
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 0x16e13(%rip), %rdi     # 0x46f80
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq 0x38(%rsp), %r14
movq 0x40(%rsp), %r12
cmpq %r12, %r14
je 0x30220
leaq 0x18(%rsp), %rbp
leaq 0xa0(%rsp), %rbx
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x16dd8(%rip), %rdi     # 0x46f80
callq 0x66a0
movq %rax, %r15
movl $0x2, %edx
movq %rax, %rdi
leaq 0x12e2(%rip), %rsi      # 0x314a1
callq 0x66a0
movq %r15, %rdi
callq 0x6350
movq %r13, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq 0x16dd2(%rip), %rdi     # 0x46fb8
movq %rbp, %rsi
callq 0x62c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9dde
movq %rax, %rdi
movq %rbp, %rsi
callq 0x67e0
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x30213
callq 0x63c0
addq $0x20, %r14
cmpq %r12, %r14
jne 0x3019a
leaq 0xa0(%rsp), %rdi
leaq 0x58(%rsp), %r15
callq 0x945c
cmpq $0x0, 0xd8(%rsp)
je 0x3028d
movq 0x16d3c(%rip), %rdi     # 0x46f80
leaq 0x686f(%rip), %rsi      # 0x36aba
movl $0x5, %edx
callq 0x66a0
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq 0x16d14(%rip), %rdi     # 0x46f80
callq 0x66a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6740
jmp 0x303d2
movq 0x16cec(%rip), %rbx     # 0x46f80
leaq 0x6825(%rip), %rsi      # 0x36ac0
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 0x16cba(%rip), %rdi     # 0x46f80
callq 0x63d0
movq %rax, %rdi
callq 0x6350
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x9216
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %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
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x30333
callq 0x63c0
movq 0x16c46(%rip), %rbx     # 0x46f80
leaq 0x6787(%rip), %rsi      # 0x36ac8
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 0x16c14(%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 0x9e70
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30405
callq 0x63c0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3041b
callq 0x63c0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30431
callq 0x63c0
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30447
callq 0x63c0
leaq 0xa0(%rsp), %rdi
callq 0x9efc
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x3046e
movq (%rdi), %rbx
callq 0x63c0
movq %rbx, %rdi
cmpq %r15, %rbx
jne 0x3045e
leaq 0x130(%rsp), %rdi
callq 0x1abae
leaq 0x168(%rsp), %rdi
callq 0x1af92
leaq 0x1a0(%rsp), %rdi
callq 0x1af92
xorl %eax, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x30516
jmp 0x304f8
jmp 0x304f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x304c6
callq 0x63c0
jmp 0x304c6
movq %rax, %r14
leaq 0x48(%rsp), %rax
jmp 0x30544
jmp 0x304cf
movq %rax, %r14
jmp 0x30552
jmp 0x304d6
movq %rax, %r14
jmp 0x3055f
movq %rax, %r14
jmp 0x30579
movq %rax, %r14
jmp 0x30586
movq %rax, %r14
jmp 0x30593
jmp 0x3051b
movq %rax, %r14
jmp 0x3053c
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x3053c
callq 0x63c0
jmp 0x3053c
movq %rax, %r14
jmp 0x30532
movq %rax, %r14
jmp 0x3052d
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x3052d
callq 0x63c0
leaq 0x58(%rsp), %r15
leaq 0x38(%rsp), %rdi
callq 0x9e70
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30552
callq 0x63c0
leaq 0xa0(%rsp), %rdi
callq 0x305a8
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x30579
movq (%rdi), %rbx
callq 0x63c0
movq %rbx, %rdi
cmpq %r15, %rbx
jne 0x30569
leaq 0x130(%rsp), %rdi
callq 0x1abae
leaq 0x168(%rsp), %rdi
callq 0x1af92
leaq 0x1a0(%rsp), %rdi
callq 0x1af92
movq %r14, %rdi
callq 0x6440