// File: /workspace/github_cpp_makefile_star2_O2/jliesch[P]ofxget/ofxget.cc
// Function: ofxget::OfxGetContext::AddInstitution(int)
OfxGetContext& OfxGetContext::AddInstitution(int id) {
  if (is_error()) return *this;
  std::string id_str = std::to_string(id);
  string filename = "institutions.txt";
  pugi::xml_document doc;
  pugi::xml_parse_result result = doc.load_file(filename.c_str());
  if (!result) {
    error_string_ = "Could not parse " + filename;
    return *this;
  }
  auto inst = doc.find_child_by_attribute("institution", "id", id_str.c_str());
  if (inst.empty()) {
    error_string_ = "Could not find institution " + id_str;
    return *this;
  }
  std::vector<string> var_names {"org", "fid", "brokerid", "bankid", "url"};
  for (string name : var_names) {
    auto var = inst.child(name.c_str());
    if (var) {
      for (std::size_t i = 0; i < name.size(); i++) {
        name[i] = toupper(name[i]);
      }
      vars_map_[name] = var.child_value();
    }
  }
  return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, %r13
cmpq $0x0, 0x38(%rdi)
jne 0x755e
leaq 0x50(%rsp), %rdi
callq 0x81e2
leaq 0x22d85(%rip), %rsi     # 0x2a095
leaq 0x30(%rsp), %rdi
leaq 0x128(%rsp), %rdx
callq 0x66e0
leaq 0x128(%rsp), %rdi
callq 0x1c754
movq 0x30(%rsp), %rdx
leaq 0x110(%rsp), %rdi
leaq 0x128(%rsp), %rsi
pushq $0x74
popq %rcx
xorl %r8d, %r8d
callq 0x1d378
leaq 0x110(%rsp), %rdi
callq 0x1c72c
testb %al, %al
je 0x73a9
movq 0x50(%rsp), %rcx
leaq 0x22d4b(%rip), %rsi     # 0x2a0b7
leaq 0x22d71(%rip), %rdx     # 0x2a0e4
leaq 0x128(%rsp), %rdi
callq 0x1b544
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1882e
testb %al, %al
je 0x73dd
leaq 0x22d2b(%rip), %rsi     # 0x2a0c3
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x816c
jmp 0x73bf
leaq 0x22cf6(%rip), %rsi     # 0x2a0a6
leaq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x816c
leaq 0x30(%r13), %rdi
leaq 0x70(%rsp), %r14
movq %r14, %rsi
callq 0x6380
movq %r14, %rdi
callq 0x6890
jmp 0x753d
leaq 0x22cfb(%rip), %rsi     # 0x2a0df
leaq 0x70(%rsp), %r14
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x66e0
leaq 0x90(%rsp), %r15
leaq 0x22cde(%rip), %rsi     # 0x2a0e3
leaq 0x7(%rsp), %rdx
movq %r15, %rdi
callq 0x66e0
leaq 0xb0(%rsp), %r15
leaq 0x22cc6(%rip), %rsi     # 0x2a0e7
leaq 0x6(%rsp), %rdx
movq %r15, %rdi
callq 0x66e0
leaq 0xd0(%rsp), %r15
leaq 0x22cb3(%rip), %rsi     # 0x2a0f0
leaq 0x5(%rsp), %rdx
movq %r15, %rdi
callq 0x66e0
leaq 0xf0(%rsp), %r15
leaq 0x22d14(%rip), %rsi     # 0x2a16d
leaq 0x4(%rsp), %rdx
movq %r15, %rdi
callq 0x66e0
leaq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x5
popq %rdx
leaq 0x3(%rsp), %rcx
callq 0x823c
movl $0x80, %r14d
leaq (%rsp,%r14), %rdi
addq $0x70, %rdi
callq 0x6890
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x7483
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r12
leaq 0x70(%rsp), %r15
cmpq %r12, %r14
je 0x7533
movq %r15, %rdi
movq %r14, %rsi
callq 0x63c0
movq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x1878a
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x186e0
testq %rax, %rax
je 0x7522
xorl %ebp, %ebp
cmpq 0x78(%rsp), %rbp
jae 0x74ff
movq 0x70(%rsp), %rbx
movsbl (%rbx,%rbp), %edi
callq 0x6110
movb %al, (%rbx,%rbp)
incq %rbp
jmp 0x74e2
leaq 0x8(%rsp), %rdi
callq 0x18afc
movq %rax, %rbp
movq %r13, %rdi
movq %r15, %rsi
callq 0x8276
movq %rax, %rdi
movq %rbp, %rsi
callq 0x6840
movq %r15, %rdi
callq 0x6890
addq $0x20, %r14
jmp 0x74a9
leaq 0x18(%rsp), %rdi
callq 0x82dc
leaq 0x128(%rsp), %rdi
callq 0x1c7de
leaq 0x30(%rsp), %rdi
callq 0x6890
leaq 0x50(%rsp), %rdi
callq 0x6890
movq %r13, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x80, %r14d
leaq (%rsp,%r14), %rdi
addq $0x70, %rdi
callq 0x6890
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x757c
jmp 0x75e4
jmp 0x759b
jmp 0x759b
jmp 0x759b
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x6890
cmpq %r14, %r15
jne 0x759e
jmp 0x75e4
jmp 0x75c3
jmp 0x75c3
jmp 0x75c3
jmp 0x75c3
movq %rax, %rbx
jmp 0x75f1
movq %rax, %rbx
jmp 0x75fb
movq %rax, %rbx
jmp 0x75e4
movq %rax, %rbx
jmp 0x75da
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x6890
leaq 0x18(%rsp), %rdi
callq 0x82dc
leaq 0x128(%rsp), %rdi
callq 0x1c7de
leaq 0x30(%rsp), %rdi
callq 0x6890
leaq 0x50(%rsp), %rdi
callq 0x6890
movq %rbx, %rdi
callq 0x6460
nop