// File: Kyle-Alvares[P]SQA1/user.cpp
// Function: User::getUserData(int)
void User::getUserData(int accountNumber) {
    this->accountNumber = accountNumber;
    
    ifstream ifs("./users/" + to_string(accountNumber) + ".txt");
    if(ifs.fail()){
        cerr << "Error. Unable to load user." << endl;
        exit(1);
    }
    string line;
    ifs >> line;
    firstName = line;
    ifs >> line;
    middleName = line;
    ifs >> line;
    lastName = line;
    ifs >> line;
    password = line;
    ifs >> line;
    isAdminAccount = stoi(line);
    while(ifs >> line) {
        account acc;
        int index = line.find("$");
        acc.disabled = line.substr(0,1).compare("0") != 0;
        acc.isStudentPlan = line.substr(1,1).compare("0") != 0;
        acc.accountName = line.substr(2, index-2);
        acc.balance = stoi(line.substr(index+1)); 
        accounts.push_back(acc);
    }
    ifs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x370(%rbp)
movl -0xc(%rbp), %ecx
movl %ecx, 0x18(%rax)
movl -0xc(%rbp), %esi
leaq -0x278(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x6930
movq -0x368(%rbp), %rdx
leaq 0x7db3(%rip), %rsi      # 0xd13a
leaq -0x258(%rbp), %rdi
callq 0x68e0
jmp 0x5395
leaq 0x7da7(%rip), %rdx      # 0xd143
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x6890
jmp 0x53b1
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
movl $0x8, %edx
callq 0x3490
jmp 0x53cb
leaq -0x238(%rbp), %rdi
callq 0x31f0
leaq -0x258(%rbp), %rdi
callq 0x31f0
leaq -0x278(%rbp), %rdi
callq 0x31f0
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x371(%rbp)
jmp 0x540f
movb -0x371(%rbp), %al
testb $0x1, %al
jne 0x541e
jmp 0x54d3
movq 0xdbcb(%rip), %rdi      # 0x12ff0
leaq 0x7d70(%rip), %rsi      # 0xd19c
callq 0x32d0
movq %rax, -0x380(%rbp)
jmp 0x543a
movq -0x380(%rbp), %rdi
movq 0xdb58(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x544f
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x54ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x549f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x31f0
leaq -0x258(%rbp), %rdi
callq 0x31f0
leaq -0x278(%rbp), %rdi
callq 0x31f0
jmp 0x587a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x586e
leaq -0x2a8(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x3400
movq -0x388(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x33b0
jmp 0x54fb
movq -0x370(%rbp), %rdi
addq $0x20, %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3060
jmp 0x5514
leaq -0x218(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x33b0
jmp 0x5529
movq -0x370(%rbp), %rdi
addq $0x40, %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3060
jmp 0x5542
leaq -0x218(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x33b0
jmp 0x5557
movq -0x370(%rbp), %rdi
addq $0x60, %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3060
jmp 0x5570
leaq -0x218(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x33b0
jmp 0x5585
movq -0x370(%rbp), %rdi
addq $0x88, %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3060
jmp 0x55a1
leaq -0x218(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x33b0
jmp 0x55b6
xorl %eax, %eax
movl %eax, %esi
leaq -0x2a8(%rbp), %rdi
movl $0xa, %edx
callq 0x6ae0
movl %eax, -0x38c(%rbp)
jmp 0x55d3
movq -0x370(%rbp), %rax
movl -0x38c(%rbp), %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movb %cl, 0x80(%rax)
leaq -0x218(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x33b0
movq %rax, -0x398(%rbp)
jmp 0x560b
movq -0x398(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33a0
movb %al, -0x399(%rbp)
jmp 0x5629
movb -0x399(%rbp), %al
testb $0x1, %al
jne 0x5638
jmp 0x5833
leaq -0x2d8(%rbp), %rdi
callq 0x6a50
leaq 0x7ecc(%rip), %rsi      # 0xd517
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x3a8(%rbp)
leaq -0x2a8(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x3550
movq -0x3b0(%rbp), %rsi
movq -0x3a8(%rbp), %rdx
movl %eax, -0x2dc(%rbp)
leaq -0x300(%rbp), %rdi
movl $0x1, %ecx
callq 0x3300
jmp 0x5690
leaq 0x7b59(%rip), %rsi      # 0xd1f0
leaq -0x300(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x30f0
movq -0x3b8(%rbp), %rdi
testl %eax, %eax
setne -0x2d8(%rbp)
callq 0x31f0
leaq -0x320(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
movl $0x1, %ecx
movq %rcx, %rdx
callq 0x3300
jmp 0x56dc
leaq 0x7b0d(%rip), %rsi      # 0xd1f0
leaq -0x320(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x30f0
movq -0x3c0(%rbp), %rdi
testl %eax, %eax
setne -0x2d7(%rbp)
callq 0x31f0
movl -0x2dc(%rbp), %eax
addl $-0x2, %eax
movslq %eax, %rcx
leaq -0x340(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
movl $0x2, %edx
callq 0x3300
jmp 0x5731
leaq -0x2d0(%rbp), %rdi
leaq -0x340(%rbp), %rsi
movq %rsi, -0x3c8(%rbp)
callq 0x3380
movq -0x3c8(%rbp), %rdi
callq 0x31f0
movl -0x2dc(%rbp), %eax
incl %eax
movslq %eax, %rdx
leaq -0x360(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
movq $-0x1, %rcx
callq 0x3300
jmp 0x577e
xorl %eax, %eax
movl %eax, %esi
leaq -0x360(%rbp), %rdi
movl $0xa, %edx
callq 0x6ae0
movl %eax, -0x3cc(%rbp)
jmp 0x579b
movl -0x3cc(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x2b0(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x31f0
movq -0x370(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x6a70
jmp 0x57ce
leaq -0x2d8(%rbp), %rdi
callq 0x4c20
jmp 0x55ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x5862
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x5825
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x31f0
leaq -0x2d8(%rbp), %rdi
callq 0x4c20
jmp 0x5862
leaq -0x218(%rbp), %rdi
callq 0x30a0
jmp 0x5841
leaq -0x2a8(%rbp), %rdi
callq 0x31f0
leaq -0x218(%rbp), %rdi
callq 0x30c0
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
leaq -0x2a8(%rbp), %rdi
callq 0x31f0
leaq -0x218(%rbp), %rdi
callq 0x30c0
movq -0x280(%rbp), %rdi
callq 0x34c0
nopw %cs:(%rax,%rax)