// File: sagardoshi[P]NegotiationsEncounter/src/GameMaster.cpp
// Function: GameMaster::loadPlayerSavedInventory()
void GameMaster::loadPlayerSavedInventory() {
    string line = "";
    string invItem = "";
    int invItemAmount = 0;
    int dividerPos = 0;
    int fromDividerToEnd = 0;

    ifstream in(INV_FILEPATH);
    while(getline(in, line)) {
        dividerPos = line.find(DIVIDER);
        fromDividerToEnd = line.length() - dividerPos;

        invItem = line.substr(0, dividerPos);
        invItemAmount = stoi(line.substr(dividerPos + 1, fromDividerToEnd));

        player->inventory[invItem] = invItemAmount;
    }
    in.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x3520
movq -0x2c0(%rbp), %rdx
leaq 0x16660(%rip), %rsi     # 0x1c3c8
leaq -0x28(%rbp), %rdi
callq 0x3b80
jmp 0x5d73
leaq -0x29(%rbp), %rdi
callq 0x3350
leaq -0x61(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x3520
movq -0x2d0(%rbp), %rdx
leaq 0x1662e(%rip), %rsi     # 0x1c3c8
leaq -0x60(%rbp), %rdi
callq 0x3b80
jmp 0x5da5
leaq -0x61(%rbp), %rdi
callq 0x3350
movq -0x2c8(%rbp), %rsi
movl $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
addq $0x28, %rsi
leaq -0x278(%rbp), %rdi
movl $0x8, %edx
callq 0x34b0
jmp 0x5de1
jmp 0x5de3
leaq -0x278(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x30b0
movq %rax, -0x2d8(%rbp)
jmp 0x5dfc
movq -0x2d8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33d0
movb %al, -0x2d9(%rbp)
jmp 0x5e1a
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x5e29
jmp 0x5fa4
movq -0x2c8(%rbp), %rsi
addq $0x48, %rsi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x2e8(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x3590
movq -0x2f0(%rbp), %rdi
movl %eax, -0x6c(%rbp)
callq 0x3470
movq -0x2f0(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
movl -0x6c(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x70(%rbp)
movslq -0x6c(%rbp), %rcx
leaq -0x298(%rbp), %rdi
callq 0x3310
jmp 0x5e86
leaq -0x60(%rbp), %rdi
leaq -0x298(%rbp), %rsi
movq %rsi, -0x2f8(%rbp)
callq 0x3390
movq -0x2f8(%rbp), %rdi
callq 0x3200
movl -0x6c(%rbp), %eax
incl %eax
movslq %eax, %rdx
movslq -0x70(%rbp), %rcx
leaq -0x2b8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3310
jmp 0x5ec7
xorl %eax, %eax
movl %eax, %esi
leaq -0x2b8(%rbp), %rdi
movl $0xa, %edx
callq 0x8850
movl %eax, -0x2fc(%rbp)
jmp 0x5ee4
movl -0x2fc(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x3200
movq -0x2c8(%rbp), %rax
movl -0x68(%rbp), %ecx
movl %ecx, -0x30c(%rbp)
movq 0x90(%rax), %rdi
addq $0x38, %rdi
leaq -0x60(%rbp), %rsi
callq 0x8890
movq %rax, -0x308(%rbp)
jmp 0x5f26
movq -0x308(%rbp), %rax
movl -0x30c(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5de3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x3350
jmp 0x5ff7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x3350
jmp 0x5fee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5fe5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5fd9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x3200
jmp 0x5fd9
leaq -0x278(%rbp), %rdi
callq 0x30c0
jmp 0x5fb2
leaq -0x278(%rbp), %rdi
callq 0x30f0
leaq -0x60(%rbp), %rdi
callq 0x3200
leaq -0x28(%rbp), %rdi
callq 0x3200
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
leaq -0x278(%rbp), %rdi
callq 0x30f0
leaq -0x60(%rbp), %rdi
callq 0x3200
leaq -0x28(%rbp), %rdi
callq 0x3200
movq -0x38(%rbp), %rdi
callq 0x3510