// File: /workspace/github_cpp_makefile_star2_O1/Kyle-Alvares[P]SQA1/session.cpp
// Function: Session::payBill()
void Session::payBill() {
    cout << endl << "============PAYBILL===========" << endl;
    // cin.ignore(); // clears buffer from cin for getline
    int numCompanies = sizeof(companyAcc) / sizeof(int);
    string company;
    int accountNumber;
    bool validCompany = false;
    while(!validCompany) {
        cout << "Companies: " << endl;
        for(int i = 0; i < numCompanies; i++)
            cout << companies[i] + " (" + companyAbbrv[i] << ")" << endl;
        cout << "Enter company name: ";
        cin >> company;
        for(int i = 0; i < numCompanies; i++) {
            if(company.compare(companyAbbrv[i]) == 0) {
                accountNumber = companyAcc[i];
                validCompany = true;
            }
        }
        if (!validCompany)
            cerr << "Error: Invalid company name!" << endl;
    }
    cout << "Choose account to use to pay bill." << endl;
    double amount = withdraw(2000, false);
    User other(accountNumber);
    other.deposit("chequings", amount);
    other.saveUserData();
    transactions.push_back("03" + username + to_string(amount));
    cout << endl <<  "Bill paid successfully!" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x78(%rsp)
movq 0x7af7(%rip), %rbx      # 0xdfc8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq %rax, %rbx
leaq 0x3f3e(%rip), %rsi      # 0xa440
movl $0x1e, %edx
movq %rax, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xd0(%rsp), %r13
movq $0x0, 0x28(%rsp)
leaq 0x7cce(%rip), %rbx      # 0xe230
leaq 0x8(%rsp), %r12
leaq 0x7d22(%rip), %r14      # 0xe290
movl $0xb, %edx
movq 0x7a4e(%rip), %rdi      # 0xdfc8
leaq 0x3ede(%rip), %rsi      # 0xa45f
callq 0x2270
movq 0x7a3b(%rip), %rcx      # 0xdfc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x7a1d(%rip), %rdi      # 0xdfc8
callq 0x2030
movq %rax, %rdi
callq 0x2180
movl $0x8, %r15d
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq -0x8(%r15,%rbx), %rsi
movq (%r15,%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3450
movq %r12, %rdi
leaq 0x3e85(%rip), %rsi      # 0xa46b
callq 0x23d0
movq -0x8(%r15,%r14), %rsi
movq (%r15,%r14), %rdx
movq %r12, %rdi
callq 0x20c0
movq %r13, 0xc0(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6628
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0x6630
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0xc8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x7966(%rip), %rdi      # 0xdfc8
callq 0x2270
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3df5(%rip), %rsi      # 0xa46e
callq 0x2270
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq 0xc0(%rsp), %rdi
cmpq %r13, %rdi
je 0x66c3
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x66df
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
addq $0x20, %r15
cmpq $0x68, %r15
jne 0x65be
movl $0x14, %edx
movq 0x78cf(%rip), %rdi      # 0xdfc8
leaq 0x3d70(%rip), %rsi      # 0xa470
callq 0x2270
movq 0x78cc(%rip), %rdi      # 0xdfd8
leaq 0x58(%rsp), %rsi
callq 0x22b0
movq %r14, %rbp
xorl %r15d, %r15d
leaq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x2040
testl %eax, %eax
jne 0x6743
leaq 0x3c00(%rip), %rax      # 0xa334
movl (%r15,%rax), %eax
movl %eax, 0x34(%rsp)
movb $0x1, %al
movq %rax, 0x28(%rsp)
addq $0x4, %r15
addq $0x20, %rbp
cmpq $0xc, %r15
jne 0x671c
testb $0x1, 0x28(%rsp)
jne 0x67a2
movl $0x1c, %edx
movq 0x788c(%rip), %rdi      # 0xdff0
leaq 0x3d1a(%rip), %rsi      # 0xa485
callq 0x2270
movq 0x7879(%rip), %rcx      # 0xdff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x785b(%rip), %rdi      # 0xdff0
callq 0x2030
movq %rax, %rdi
callq 0x2180
testb $0x1, 0x28(%rsp)
je 0x656e
movq 0x7814(%rip), %rbx      # 0xdfc8
leaq 0x3ce7(%rip), %rsi      # 0xa4a2
movl $0x22, %edx
movq %rbx, %rdi
callq 0x2270
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x77e2(%rip), %rbx      # 0xdfc8
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movsd 0x3b02(%rip), %xmm0     # 0xa300
movq 0x78(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x58ca
movsd %xmm0, 0x28(%rsp)
leaq 0xc0(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x3622
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x395b(%rip), %rsi      # 0xa192
leaq 0x395d(%rip), %rdx      # 0xa19b
leaq 0xa0(%rsp), %rdi
callq 0x353c
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movsd 0x28(%rsp), %xmm0
callq 0x471e
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x6883
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xc0(%rsp), %rdi
callq 0x4200
leaq 0xa8(%r15), %rdx
leaq 0x3c27(%rip), %rsi      # 0xa4c5
leaq 0x80(%rsp), %rdi
callq 0x85a5
movq 0x76fe(%rip), %rsi      # 0xdfb0
leaq 0x3e28(%rip), %rcx      # 0xa6e1
leaq 0x38(%rsp), %rdi
movl $0x148, %edx            # imm = 0x148
movsd 0x28(%rsp), %xmm0
movb $0x1, %al
callq 0x8946
leaq 0x90(%rsp), %r14
movq -0x10(%r14), %rcx
movq -0x8(%r14), %r8
movq 0x40(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r14, %rcx
je 0x68fb
movq 0x90(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x691a
leaq 0x48(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x6915
movq 0x48(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x692e
movq 0x38(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x20c0
jmp 0x693c
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2260
leaq 0x18(%rsp), %rsi
movq %rsi, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x6961
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x6967
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
addq $0xc8, %r15
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x89f8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x69b4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x69cf
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x69ec
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2230
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x75be(%rip), %rdi      # 0xdfc8
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq %rax, %rbx
leaq 0x3aa7(%rip), %rsi      # 0xa4c8
movl $0x17, %edx
movq %rax, %rdi
callq 0x2270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6a76
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6a97
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6ab8
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6ad9
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xc0(%rsp), %rdi
callq 0x32e6
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6b02
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2230
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6b38
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x6b38
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6b58
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x6b58
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6ba2
movq 0x90(%rsp), %rsi
jmp 0x6b8d
jmp 0x6b9f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x6ba2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x6ba2
jmp 0x6b9f
jmp 0x6bbc
jmp 0x6bbc
jmp 0x6bbc
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x3138
jmp 0x6bfd
jmp 0x6bbc
jmp 0x6bbc
jmp 0x6bb7
movq %rax, %rbx
jmp 0x6be1
movq %rax, %rbx
jmp 0x6bfd
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r13, %rdi
je 0x6be1
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6bfd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6c19
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x23b0
nop