// File: /workspace/github_cpp_makefile_star2_O3/TNanukem[P]chip8-emulator/emulator.cpp
// Function: emulator::saveGame(unsigned char, chip8*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void emulator::saveGame(uint8_t SaveStateSlot, chip8 *Chip8, std::string game){
	FILE* saveGame;

	std::string extension = std::string("_") + std::to_string(SaveStateSlot)
							+ std::string(".sav");
	game.append(extension);

	saveGame = fopen(game.c_str(),"wb");

	fwrite(Chip8, sizeof(chip8), 1, saveGame);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r15d
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2364(%rip), %rsi      # 0x522c
leaq 0x235e(%rip), %rdx      # 0x522d
leaq -0x88(%rbp), %rdi
callq 0x3f24
cmpb $0x64, %r15b
movl $0x3, %eax
sbbl $0x0, %eax
cmpb $0xa, %r15b
movl $0x1, %r12d
cmovael %eax, %r12d
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
movl $0x2d, %edx
callq 0x2200
movzbl %r15b, %edx
movq -0xa8(%rbp), %rdi
movl %r12d, %esi
callq 0x3e14
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r8
movq -0xa0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
leaq -0x78(%rbp), %rsi
cmpq %rsi, %rcx
je 0x2f4f
movq -0x78(%rbp), %rdi
movq -0xa8(%rbp), %rsi
cmpq %rdi, %rax
jbe 0x2f71
movl $0xf, %edi
cmpq %r13, %rsi
je 0x2f6c
movq -0x98(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x2f7f
leaq -0x88(%rbp), %rdi
callq 0x20d0
jmp 0x2f8f
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
leaq -0x38(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x2fb0
movq %rsi, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x2fb6
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x224a(%rip), %rsi      # 0x522e
leaq 0x2247(%rip), %rdx      # 0x5232
leaq -0xc8(%rbp), %rdi
callq 0x3f24
leaq -0x38(%rbp), %r12
movq -0x10(%r12), %rcx
movq -0x8(%r12), %r8
movq -0xc0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r12, %rcx
je 0x301e
movq -0x38(%rbp), %rdi
movq -0xc8(%rbp), %rsi
cmpq %rdi, %rax
jbe 0x3040
movl $0xf, %edi
cmpq %r15, %rsi
je 0x303b
movq -0xb8(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x304b
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x305b
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
leaq -0x58(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x307c
movq %rsi, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x3082
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x60(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x30b9
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x30ce
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x30e9
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x3105
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %r14, %rdi
callq 0x20d0
movq (%r14), %rdi
leaq 0x2114(%rip), %rsi      # 0x5233
callq 0x2210
movl $0x3050, %esi           # imm = 0x3050
movl $0x1, %edx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x2320
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3152
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3200
movq -0x58(%rbp), %rsi
jmp 0x31f3
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x31a1
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31a1
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x31bf
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31bf
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x31df
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31df
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x3200
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3200
movq %rax, %rbx
movq %rbx, %rdi
callq 0x22d0