// File: Kyle-Alvares[P]SQA1/user.cpp
// Function: User::saveUserData()
void User::saveUserData() {
    ofstream ofs("./users/" + to_string(accountNumber) + ".txt");
    if(ofs.fail()) {
        cerr << "Error! Unable to save user data!";
        exit(1);
    }
    ofs << firstName << endl;
    ofs << middleName << endl;
    ofs << lastName << endl;
    ofs << password << endl;
    ofs << isAdminAccount << endl;
    for(int i = 0; i < accounts.size(); i++) {
        ofs << accounts[i].disabled << accounts[i].isStudentPlan << accounts[i].accountName 
            << "$" << accounts[i].balance << endl;
    }
    accounts.clear();
    ofs.close(); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x288(%rbp)
movl 0x18(%rax), %esi
leaq -0x268(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x6930
movq -0x280(%rbp), %rdx
leaq 0x734c(%rip), %rsi      # 0xd13a
leaq -0x248(%rbp), %rdi
callq 0x68e0
jmp 0x5dfc
leaq 0x7340(%rip), %rdx      # 0xd143
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x6890
jmp 0x5e18
leaq -0x208(%rbp), %rdi
leaq -0x228(%rbp), %rsi
movl $0x10, %edx
callq 0x3520
jmp 0x5e32
leaq -0x228(%rbp), %rdi
callq 0x31f0
leaq -0x248(%rbp), %rdi
callq 0x31f0
leaq -0x268(%rbp), %rdi
callq 0x31f0
movq -0x208(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x208(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x289(%rbp)
jmp 0x5e76
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x5e85
jmp 0x5f2a
movq 0xd164(%rip), %rdi      # 0x12ff0
leaq 0x7325(%rip), %rsi      # 0xd1b8
callq 0x32d0
jmp 0x5e9a
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x5ef6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x5eea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31f0
leaq -0x248(%rbp), %rdi
callq 0x31f0
leaq -0x268(%rbp), %rdi
callq 0x31f0
jmp 0x61a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x3440
jmp 0x61a2
movq -0x288(%rbp), %rsi
addq $0x20, %rsi
leaq -0x208(%rbp), %rdi
callq 0x32a0
movq %rax, -0x298(%rbp)
jmp 0x5f4a
movq -0x298(%rbp), %rdi
movq 0xd048(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x5f5f
movq -0x288(%rbp), %rsi
addq $0x40, %rsi
leaq -0x208(%rbp), %rdi
callq 0x32a0
movq %rax, -0x2a0(%rbp)
jmp 0x5f7f
movq -0x2a0(%rbp), %rdi
movq 0xd013(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x5f94
movq -0x288(%rbp), %rsi
addq $0x60, %rsi
leaq -0x208(%rbp), %rdi
callq 0x32a0
movq %rax, -0x2a8(%rbp)
jmp 0x5fb4
movq -0x2a8(%rbp), %rdi
movq 0xcfde(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x5fc9
movq -0x288(%rbp), %rsi
addq $0x88, %rsi
leaq -0x208(%rbp), %rdi
callq 0x32a0
movq %rax, -0x2b0(%rbp)
jmp 0x5fec
movq -0x2b0(%rbp), %rdi
movq 0xcfa6(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x6001
movq -0x288(%rbp), %rax
movzbl 0x80(%rax), %esi
andl $0x1, %esi
leaq -0x208(%rbp), %rdi
callq 0x34e0
movq %rax, -0x2b8(%rbp)
jmp 0x6027
movq -0x2b8(%rbp), %rdi
movq 0xcf6b(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x603c
movl $0x0, -0x278(%rbp)
movq -0x288(%rbp), %rdi
movslq -0x278(%rbp), %rax
movq %rax, -0x2c0(%rbp)
callq 0x4520
movq %rax, %rcx
movq -0x2c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x6173
movq -0x288(%rbp), %rdi
movslq -0x278(%rbp), %rsi
callq 0x6b20
movzbl (%rax), %esi
andl $0x1, %esi
leaq -0x208(%rbp), %rdi
callq 0x34e0
movq %rax, -0x2c8(%rbp)
jmp 0x60a1
movq -0x288(%rbp), %rdi
movslq -0x278(%rbp), %rsi
callq 0x6b20
movq -0x2c8(%rbp), %rdi
movzbl 0x1(%rax), %esi
andl $0x1, %esi
callq 0x34e0
movq %rax, -0x2d0(%rbp)
jmp 0x60d0
movq -0x288(%rbp), %rdi
movslq -0x278(%rbp), %rsi
callq 0x6b20
movq -0x2d0(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x32a0
movq %rax, -0x2d8(%rbp)
jmp 0x60ff
movq -0x2d8(%rbp), %rdi
leaq 0x740a(%rip), %rsi      # 0xd517
callq 0x32d0
movq %rax, -0x2e0(%rbp)
jmp 0x611b
movq -0x288(%rbp), %rdi
movslq -0x278(%rbp), %rsi
callq 0x6b20
movq -0x2e0(%rbp), %rdi
movsd 0x28(%rax), %xmm0
callq 0x3500
movq %rax, -0x2e8(%rbp)
jmp 0x6148
movq -0x2e8(%rbp), %rdi
movq 0xce4a(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0x615d
jmp 0x615f
movl -0x278(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x278(%rbp)
jmp 0x6046
movq -0x288(%rbp), %rdi
callq 0x6b40
leaq -0x208(%rbp), %rdi
callq 0x3410
jmp 0x618d
leaq -0x208(%rbp), %rdi
callq 0x3440
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq -0x270(%rbp), %rdi
callq 0x34c0
nop