// File: Thilotilo[P]DoaERando/Rom.cpp
// Function: DoaERando::ROM::WriteRom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int, int)
void ROM::WriteRom(std::string path, int major, int minor, int patch, int seed)
{
    ostringstream oss;
    oss << path << "/DoaERando_v" << major << "_" << minor << "_" << patch << "_seed" << seed << ".nes";
    cout << "Writing to file " << oss.str() << endl;
    ofstream fout(oss.str(), ios::out | ios::binary);
    if (fout.fail()) throw 0;
    fout.write((char*)myContents.data(), myContents.size());
    fout.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rsi, -0x3f8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq -0x198(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x4901c0
movq -0x400(%rbp), %rdi
movq -0x3f8(%rbp), %rsi
callq 0x49a9a0
movq %rax, -0x3f0(%rbp)
jmp 0x4048b2
movq -0x3f0(%rbp), %rdi
leaq 0x196744(%rip), %rsi    # 0x59b004
callq 0x487fa0
movq %rax, -0x410(%rbp)
jmp 0x4048ce
movq -0x410(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x488340
movq %rax, -0x418(%rbp)
jmp 0x4048e6
movq -0x418(%rbp), %rdi
leaq 0x19b190(%rip), %rsi    # 0x59fa84
callq 0x487fa0
movq %rax, -0x420(%rbp)
jmp 0x404902
movq -0x420(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x488340
movq %rax, -0x428(%rbp)
jmp 0x40491a
movq -0x428(%rbp), %rdi
leaq 0x19b15c(%rip), %rsi    # 0x59fa84
callq 0x487fa0
movq %rax, -0x430(%rbp)
jmp 0x404936
movq -0x430(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x488340
movq %rax, -0x438(%rbp)
jmp 0x40494e
movq -0x438(%rbp), %rdi
leaq 0x1966b5(%rip), %rsi    # 0x59b011
callq 0x487fa0
movq %rax, -0x440(%rbp)
jmp 0x40496a
movq -0x440(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x488340
movq %rax, -0x448(%rbp)
jmp 0x404982
movq -0x448(%rbp), %rdi
leaq 0x196b73(%rip), %rsi    # 0x59b503
callq 0x487fa0
jmp 0x404997
movq $0x6144a0, %rdi         # imm = 0x6144A0
leaq 0x196672(%rip), %rsi    # 0x59b017
callq 0x487fa0
movq %rax, -0x450(%rbp)
jmp 0x4049b3
leaq -0x1c8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x490eb0
jmp 0x4049c8
movq -0x450(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x49a9a0
movq %rax, -0x458(%rbp)
jmp 0x4049e4
movq -0x458(%rbp), %rdi
movq $0x487880, %rsi         # imm = 0x487880
callq 0x486a90
jmp 0x4049f9
leaq -0x1c8(%rbp), %rdi
callq 0x497ea0
leaq -0x3e8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x490eb0
jmp 0x404a1a
movl $0x10, %edi
movl $0x4, %esi
callq 0x404fd0
movl %eax, -0x45c(%rbp)
jmp 0x404a31
movl -0x45c(%rbp), %edx
leaq -0x3c8(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x4646e0
jmp 0x404a4c
leaq -0x3e8(%rbp), %rdi
callq 0x497ea0
movq -0x3c8(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x3c8(%rbp,%rax), %rdi
callq 0x468a90
movb %al, -0x45d(%rbp)
jmp 0x404a78
movb -0x45d(%rbp), %al
testb $0x1, %al
jne 0x404a87
jmp 0x404b2c
movl $0x4, %edi
callq 0x41e900
movq %rax, %rdi
movl $0x0, (%rdi)
movq $0x6096e8, %rsi         # imm = 0x6096E8
xorl %eax, %eax
movl %eax, %edx
callq 0x41f950
jmp 0x404baa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
jmp 0x404b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x497ea0
jmp 0x404b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x497ea0
jmp 0x404b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x465160
jmp 0x404b92
movq -0x408(%rbp), %rdi
callq 0x404ff0
movq -0x408(%rbp), %rdi
movq %rax, -0x468(%rbp)
callq 0x405010
movq -0x468(%rbp), %rsi
movq %rax, %rdx
leaq -0x3c8(%rbp), %rdi
callq 0x4876f0
jmp 0x404b63
leaq -0x3c8(%rbp), %rdi
callq 0x464f30
jmp 0x404b71
leaq -0x3c8(%rbp), %rdi
callq 0x465160
leaq -0x198(%rbp), %rdi
callq 0x48cac0
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
leaq -0x198(%rbp), %rdi
callq 0x48cac0
movq -0x1a0(%rbp), %rdi
callq 0x4c9ba0
nopw (%rax,%rax)