// File: Kyle-Alvares[P]SQA1/session.cpp
// Function: Session::save()
void Session::save() {
    user.saveUserData();
    time_t rawtime;
    time (&rawtime);
    ofstream ofs("./transactions/" + to_string(user.getAccountNumber()) + ".txt", ios::app);
    if(ofs.fail()) {
        cerr << "Error! Unable to save transactions!";
        exit(1);
    }
    ofs << endl;
    ofs << ctime (&rawtime) << endl;
    for(int i = 0; i < transactions.size(); i++) {
        ofs << transactions[i] << endl;
    }
    ofs.close();
    transactions.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x5db0
leaq -0x10(%rbp), %rdi
callq 0x32b0
movq -0x290(%rbp), %rdi
callq 0x5890
movl %eax, %esi
leaq -0x270(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x6930
movq -0x288(%rbp), %rdx
leaq 0x352f(%rip), %rsi      # 0xd696
leaq -0x250(%rbp), %rdi
callq 0x68e0
jmp 0xa175
leaq 0x2fc7(%rip), %rdx      # 0xd143
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x6890
jmp 0xa191
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rsi
movl $0x1, %edx
callq 0x3520
jmp 0xa1ab
leaq -0x230(%rbp), %rdi
callq 0x31f0
leaq -0x250(%rbp), %rdi
callq 0x31f0
leaq -0x270(%rbp), %rdi
callq 0x31f0
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x291(%rbp)
jmp 0xa1ef
movb -0x291(%rbp), %al
testb $0x1, %al
jne 0xa1fe
jmp 0xa2a3
movq 0x8deb(%rip), %rdi      # 0x12ff0
leaq 0x349a(%rip), %rsi      # 0xd6a6
callq 0x32d0
jmp 0xa213
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0xa26f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0xa263
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x31f0
leaq -0x250(%rbp), %rdi
callq 0x31f0
leaq -0x270(%rbp), %rdi
callq 0x31f0
jmp 0xa3bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x3440
jmp 0xa3bb
movq 0x8cf6(%rip), %rsi      # 0x12fa0
leaq -0x210(%rbp), %rdi
callq 0x3310
jmp 0xa2b8
leaq -0x10(%rbp), %rdi
callq 0x3130
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
callq 0x32d0
movq %rax, -0x2a0(%rbp)
jmp 0xa2d9
movq -0x2a0(%rbp), %rdi
movq 0x8cb9(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0xa2ee
movl $0x0, -0x280(%rbp)
movq -0x290(%rbp), %rdi
movslq -0x280(%rbp), %rax
movq %rax, -0x2a8(%rbp)
addq $0xc8, %rdi
callq 0xa850
movq %rax, %rcx
movq -0x2a8(%rbp), %rax
cmpq %rcx, %rax
jae 0xa385
movq -0x290(%rbp), %rdi
addq $0xc8, %rdi
movslq -0x280(%rbp), %rsi
callq 0xa870
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
callq 0x32a0
movq %rax, -0x2b0(%rbp)
jmp 0xa35a
movq -0x2b0(%rbp), %rdi
movq 0x8c38(%rip), %rsi      # 0x12fa0
callq 0x3310
jmp 0xa36f
jmp 0xa371
movl -0x280(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x280(%rbp)
jmp 0xa2f8
leaq -0x210(%rbp), %rdi
callq 0x3410
jmp 0xa393
movq -0x290(%rbp), %rdi
addq $0xc8, %rdi
callq 0xa890
leaq -0x210(%rbp), %rdi
callq 0x3440
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0x278(%rbp), %rdi
callq 0x34c0
nopw (%rax,%rax)