// File: 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
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq 0xa39f(%rip), %rdi      # 0x12fc0
movq 0xa378(%rip), %rsi      # 0x12fa0
callq 0x3310
movq %rax, %rdi
leaq 0x47f2(%rip), %rsi      # 0xd429
callq 0x32d0
movq %rax, %rdi
movq 0xa35a(%rip), %rsi      # 0x12fa0
callq 0x3310
movl $0x3, -0xc(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3400
movb $0x0, -0x35(%rbp)
movb -0x35(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x8c6d
jmp 0x8e84
movq 0xa34c(%rip), %rdi      # 0x12fc0
leaq 0x47cd(%rip), %rsi      # 0xd448
callq 0x32d0
movq %rax, -0x1d8(%rbp)
jmp 0x8c89
movq -0x1d8(%rbp), %rdi
movq 0xa309(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x8c9e
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8dae
movslq -0x48(%rbp), %rax
shlq $0x5, %rax
leaq 0xa630(%rip), %rsi      # 0x132f0
addq %rax, %rsi
leaq 0x478a(%rip), %rdx      # 0xd454
leaq -0x88(%rbp), %rdi
callq 0xa790
jmp 0x8cd8
movslq -0x48(%rbp), %rax
shlq $0x5, %rax
leaq 0xa669(%rip), %rdx      # 0x13350
addq %rax, %rdx
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xa740
jmp 0x8cfc
movq 0xa2bd(%rip), %rdi      # 0x12fc0
leaq -0x68(%rbp), %rsi
callq 0x32a0
movq %rax, -0x1e0(%rbp)
jmp 0x8d15
movq -0x1e0(%rbp), %rdi
leaq 0x4734(%rip), %rsi      # 0xd457
callq 0x32d0
movq %rax, -0x1e8(%rbp)
jmp 0x8d31
movq -0x1e8(%rbp), %rdi
movq 0xa261(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x8d46
leaq -0x68(%rbp), %rdi
callq 0x31f0
leaq -0x88(%rbp), %rdi
callq 0x31f0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x8ca5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x910b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8d9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x31f0
leaq -0x88(%rbp), %rdi
callq 0x31f0
jmp 0x910b
movq 0xa20b(%rip), %rdi      # 0x12fc0
leaq 0x469d(%rip), %rsi      # 0xd459
callq 0x32d0
jmp 0x8dc3
movq 0xa20e(%rip), %rdi      # 0x12fd8
leaq -0x30(%rbp), %rsi
callq 0x33b0
jmp 0x8dd5
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8e46
movslq -0x8c(%rbp), %rax
shlq $0x5, %rax
leaq 0xa554(%rip), %rsi      # 0x13350
addq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x3050
movl %eax, -0x1ec(%rbp)
jmp 0x8e10
movl -0x1ec(%rbp), %eax
cmpl $0x0, %eax
jne 0x8e33
movslq -0x8c(%rbp), %rcx
leaq 0x48a7(%rip), %rax      # 0xd6d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movb $0x1, -0x35(%rbp)
jmp 0x8e35
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x8ddf
testb $0x1, -0x35(%rbp)
jne 0x8e7f
movq 0xa19d(%rip), %rdi      # 0x12ff0
leaq 0x4614(%rip), %rsi      # 0xd46e
callq 0x32d0
movq %rax, -0x1f8(%rbp)
jmp 0x8e68
movq -0x1f8(%rbp), %rdi
movq 0xa12a(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x8e7d
jmp 0x8e7f
jmp 0x8c5f
movq 0xa135(%rip), %rdi      # 0x12fc0
leaq 0x45f9(%rip), %rsi      # 0xd48b
callq 0x32d0
movq %rax, -0x200(%rbp)
jmp 0x8ea0
movq -0x200(%rbp), %rdi
movq 0xa0f2(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x8eb5
movq -0x1d0(%rbp), %rdi
movsd 0x443c(%rip), %xmm0     # 0xd300
xorl %esi, %esi
callq 0x8250
movsd %xmm0, -0x208(%rbp)
jmp 0x8ed5
movsd -0x208(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x34(%rbp), %esi
leaq -0x140(%rbp), %rdi
callq 0x5280
jmp 0x8ef6
leaq -0x161(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x34d0
movq -0x210(%rbp), %rdx
leaq 0x427b(%rip), %rsi      # 0xd192
leaq -0x160(%rbp), %rdi
callq 0x4160
jmp 0x8f25
movsd -0x98(%rbp), %xmm0
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x6240
jmp 0x8f42
leaq -0x160(%rbp), %rdi
callq 0x31f0
leaq -0x161(%rbp), %rdi
callq 0x3330
leaq -0x140(%rbp), %rdi
callq 0x5db0
jmp 0x8f68
movq -0x1d0(%rbp), %rdx
movq %rdx, %rax
addq $0xc8, %rax
movq %rax, -0x218(%rbp)
addq $0xa8, %rdx
leaq 0x4521(%rip), %rsi      # 0xd4ae
leaq -0x1a8(%rbp), %rdi
callq 0xa5e0
jmp 0x8f9b
movsd -0x98(%rbp), %xmm0
leaq -0x1c8(%rbp), %rdi
callq 0xa6f0
jmp 0x8fb1
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdx
callq 0xa4a0
jmp 0x8fcd
movq -0x218(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0xa5b0
jmp 0x8fe2
leaq -0x188(%rbp), %rdi
callq 0x31f0
leaq -0x1c8(%rbp), %rdi
callq 0x31f0
leaq -0x1a8(%rbp), %rdi
callq 0x31f0
movq 0x9fb3(%rip), %rdi      # 0x12fc0
movq 0x9f8c(%rip), %rsi      # 0x12fa0
callq 0x3310
movq %rax, -0x220(%rbp)
jmp 0x9022
movq -0x220(%rbp), %rdi
leaq 0x4481(%rip), %rsi      # 0xd4b1
callq 0x32d0
movq %rax, -0x228(%rbp)
jmp 0x903e
movq -0x228(%rbp), %rdi
movq 0x9f54(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x9053
leaq -0x140(%rbp), %rdi
callq 0x4330
leaq -0x30(%rbp), %rdi
callq 0x31f0
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9097
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x31f0
leaq -0x161(%rbp), %rdi
callq 0x3330
jmp 0x90ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x90ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x90f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x90e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x31f0
leaq -0x1c8(%rbp), %rdi
callq 0x31f0
leaq -0x1a8(%rbp), %rdi
callq 0x31f0
leaq -0x140(%rbp), %rdi
callq 0x4330
leaq -0x30(%rbp), %rdi
callq 0x31f0
movq -0x40(%rbp), %rdi
callq 0x34c0
nopl (%rax)