// File: /workspace/github_cpp_makefile_star2_O1/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 0x1380(%rip), %rsi      # 0x422c
leaq 0x137a(%rip), %rdx      # 0x422d
leaq -0x88(%rbp), %rdi
callq 0x3eee
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 0x3de1
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r8
movq -0xa0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq -0x78(%rbp), %rdi
cmpq %rdi, %rcx
je 0x2f33
movq -0x78(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x2f52
movl $0xf, %esi
cmpq %r13, -0xa8(%rbp)
je 0x2f4d
movq -0x98(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x2f67
movq -0xa8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x20d0
jmp 0x2f77
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 0x2f98
movq %rsi, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x2f9e
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 0x1262(%rip), %rsi      # 0x422e
leaq 0x125f(%rip), %rdx      # 0x4232
leaq -0xc8(%rbp), %rdi
callq 0x3eee
leaq -0x38(%rbp), %r12
movq -0x10(%r12), %rcx
movq -0x8(%r12), %r8
movq -0xc0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x3006
movq -0x38(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x3025
movl $0xf, %esi
cmpq %r15, -0xc8(%rbp)
je 0x3020
movq -0xb8(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x3037
movq -0xc8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x3047
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 0x3068
movq %rsi, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x306e
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 0x30a5
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x30ba
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x30d5
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x30f1
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 0x1128(%rip), %rsi      # 0x4233
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 0x313e
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 0x31ec
movq -0x58(%rbp), %rsi
jmp 0x31df
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x318d
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x318d
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x31ab
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31ab
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x31cb
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31cb
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x31ec
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x31ec
movq %rax, %rbx
movq %rbx, %rdi
callq 0x22d0