// File: 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
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x8740
leaq -0x31(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x3520
movq -0x2b0(%rbp), %rdx
leaq 0x173f7(%rip), %rsi     # 0x1c3c8
leaq -0x30(%rbp), %rdi
callq 0x3b80
jmp 0x4fdc
leaq -0x31(%rbp), %rdi
callq 0x3350
leaq -0x69(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x3520
movq -0x2c0(%rbp), %rdx
leaq 0x173c5(%rip), %rsi     # 0x1c3c8
leaq -0x68(%rbp), %rdi
callq 0x3b80
jmp 0x500e
leaq -0x69(%rbp), %rdi
callq 0x3350
leaq -0x270(%rbp), %rdi
callq 0x34f0
jmp 0x5025
movq -0x2b8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x270(%rbp), %rdi
movl $0x10, %edx
callq 0x31a0
jmp 0x5043
movq -0x2b8(%rbp), %rax
movq 0x90(%rax), %rdi
addq $0x38, %rdi
callq 0x8760
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x2b8(%rbp), %rax
movq 0x90(%rax), %rdi
addq $0x38, %rdi
callq 0x87c0
movq %rax, -0x280(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x8790
testb $0x1, %al
jne 0x50a3
jmp 0x51d0
leaq -0x10(%rbp), %rdi
callq 0x87f0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x3050
jmp 0x50ba
leaq -0x10(%rbp), %rdi
callq 0x87f0
movl 0x20(%rax), %esi
leaq -0x2a0(%rbp), %rdi
callq 0x8620
jmp 0x50d4
leaq -0x68(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
movq %rsi, -0x2d0(%rbp)
callq 0x3390
movq -0x2d0(%rbp), %rdi
callq 0x3200
leaq -0x270(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x32b0
movq %rax, -0x2c8(%rbp)
jmp 0x5110
movq -0x2c8(%rbp), %rdi
movq -0x2b8(%rbp), %rsi
addq $0x48, %rsi
callq 0x32b0
movq %rax, -0x2d8(%rbp)
jmp 0x5130
movq -0x2d8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x32b0
movq %rax, -0x2e0(%rbp)
jmp 0x5149
movq -0x2e0(%rbp), %rdi
movq 0x21e51(%rip), %rsi     # 0x26fa8
callq 0x3330
jmp 0x515e
jmp 0x5160
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x8810
movq %rax, -0x2a8(%rbp)
jmp 0x506c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3350
jmp 0x5217
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x3350
jmp 0x520e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5205
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x3460
jmp 0x5205
leaq -0x270(%rbp), %rdi
callq 0x3420
jmp 0x51de
leaq -0x270(%rbp), %rdi
callq 0x3460
leaq -0x68(%rbp), %rdi
callq 0x3200
leaq -0x30(%rbp), %rdi
callq 0x3200
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x3200
leaq -0x30(%rbp), %rdi
callq 0x3200
movq -0x40(%rbp), %rdi
callq 0x3510