// File: /workspace/github_cpp_makefile_star2_O3/sagardoshi[P]NegotiationsEncounter/src/GameMaster.cpp
// Function: GameMaster::savePlayerInventory()
void GameMaster::savePlayerInventory() {
    map<string, int>::iterator it;
    string item = "";
    string amountText = "";

    ofstream out;
    out.open(INV_FILEPATH);

    for (it = player->inventory.begin(); it != player->inventory.end(); it++) {
        item = it->first;
        amountText = to_string(it->second);
        out << item << DIVIDER << amountText << endl; // Saves each line
    }

    out.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdi, %rbp
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xbe98(%rip), %r14      # 0xf3fc
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x290e
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x290e
leaq 0x68(%rsp), %rdi
callq 0x2370
leaq 0x28(%rbp), %rsi
leaq 0x68(%rsp), %rdi
movl $0x10, %edx
callq 0x2120
movq 0x90(%rbp), %rax
movq 0x50(%rax), %r14
addq $0x40, %rax
cmpq %rax, %r14
je 0x370a
leaq 0x58(%rsp), %r13
leaq 0x48(%rsp), %rbx
movq %rbp, 0x40(%rsp)
leaq 0x20(%r14), %rsi
leaq 0x20(%rsp), %rdi
callq 0x2140
movl 0x40(%r14), %r15d
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %ebp
cmpl $0xa, %r12d
jb 0x3639
movl $0x4, %ebp
movl %r12d, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x3632
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x3637
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x3639
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebp
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x3604
addl $-0x3, %ebp
jmp 0x3639
addl $-0x2, %ebp
jmp 0x3639
decl %ebp
shrl $0x1f, %r15d
leal (%r15,%rbp), %esi
movq %r13, 0x48(%rsp)
movq %rbx, %rdi
movl $0x2d, %edx
callq 0x2270
addq 0x48(%rsp), %r15
movq %r15, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x69ca
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x2280
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x3687
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0x2260
movq 0x40(%rsp), %rbp
movq 0x48(%rbp), %rsi
movq 0x50(%rbp), %rdx
movq %rax, %rdi
callq 0x2260
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x2260
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2170
movq %r14, %rdi
callq 0x2180
movq %rax, %r14
movq 0x90(%rbp), %rax
addq $0x40, %rax
cmpq %rax, %r14
jne 0x35d0
leaq 0x68(%rsp), %rdi
callq 0x22c0
movq 0x118ad(%rip), %rax     # 0x14fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x70(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x68(%rsp,%rcx)
callq 0x21c0
leaq 0x160(%rsp), %rdi
callq 0x20e0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
leaq 0x30(%rsp), %rbx
je 0x3766
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0x377d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2210
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x37b4
movq %rax, %rbx
jmp 0x37ca
jmp 0x379d
jmp 0x379d
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x2300
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x37ca
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37e1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2390
nop