// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: InitEmulator()
int InitEmulator()
{
	for (int y = 0; y < 18; ++y)
		for (int x = 0; x < 32; ++x)
		{
			PaintCell(x, y);
		}
	debuglog[debuglogstart].entrytype = dletype::LT_START;
	hookexternal((void*)LogStep);
	keypressregister = 0;
	{
		unsigned int uebase = SDL_RegisterEvents(1);
		UE_RESETCPU = uebase;
	}
	{
		SDL_Event newevent;
		newevent.type = UE_RESETCPU;
		SDL_PushEvent(&newevent);
	}
	soundfreqregister[0] = 0;
	soundfreqregister[1] = 0;
	soundfreqregister[2] = 0;
	soundfreqregister[3] = 0;
	soundvolregister[0] = 0x00;
	soundvolregister[1] = 0x00;
	soundvolregister[2] = 0x00;
	soundvolregister[3] = 0x00;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0x800, %r15d           # imm = 0x800
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbx
xorl %eax, %eax
movq %r12, 0x8(%rsp)
andq $-0x20, %r12
addq $0xa40, %r12            # imm = 0xA40
leal (,%rax,4), %ebp
andl $0x4, %ebp
movq %rax, (%rsp)
movzbl %al, %r14d
xorl %r13d, %r13d
movq 0x1093b(%rip), %rdx     # 0x1c460
leaq (%rdx,%r15), %r10
addq %r12, %rdx
movzbl (%r13,%rdx), %r8d
movl %ebp, %ecx
shrl %cl, %r8d
movzbl 0x120(%r13,%rdx), %esi
shrl %cl, %esi
movzbl 0x240(%r13,%rdx), %edi
shrl %cl, %edi
movzbl 0x360(%r13,%rdx), %eax
shrl %cl, %eax
movzbl 0x480(%r13,%rdx), %r9d
shrl %cl, %r9d
movzbl (%r13,%r10), %edx
movl %r8d, %ecx
andl $0x1, %ecx
movl %esi, %r10d
andl $0x1, %r10d
leal (%rcx,%r10,2), %ecx
movl %edi, %r10d
andl $0x1, %r10d
leal (%rcx,%r10,4), %ecx
movl %eax, %r10d
andl $0x1, %r10d
leal (%rcx,%r10,8), %ecx
movl %r9d, %r10d
shll $0x4, %r10d
andl $0x10, %r10d
orl %ecx, %r10d
movb %r10b, 0x10(%rsp)
movl %r8d, %ecx
shrl %ecx
andl $0x1, %ecx
movl %esi, %r10d
andl $0x2, %r10d
orl %ecx, %r10d
movl %edi, %ecx
andl $0x2, %ecx
leal (%r10,%rcx,2), %ecx
movl %eax, %r10d
andl $0x2, %r10d
leal (%rcx,%r10,4), %ecx
movl %r9d, %r10d
andl $0x2, %r10d
leal (%rcx,%r10,8), %ecx
movb %cl, 0x11(%rsp)
movl %r8d, %ecx
shrl $0x2, %ecx
andl $0x1, %ecx
movl %esi, %r10d
shrl %r10d
andl $0x2, %r10d
orl %ecx, %r10d
movl %edi, %ecx
andl $0x4, %ecx
orl %r10d, %ecx
movl %eax, %r10d
andl $0x4, %r10d
leal (%rcx,%r10,2), %ecx
movl %r9d, %r10d
andl $0x4, %r10d
leal (%rcx,%r10,4), %ecx
movb %cl, 0x12(%rsp)
shrl $0x3, %r8d
andl $0x1, %r8d
shrl $0x2, %esi
andl $0x2, %esi
orl %r8d, %esi
shrl %edi
andl $0x4, %edi
orl %esi, %edi
andl $0x8, %eax
orl %edi, %eax
andl $0x8, %r9d
leal (%rax,%r9,2), %eax
movb %al, 0x13(%rsp)
movzbl %r13b, %edi
movl %r14d, %esi
movq %rbx, %rcx
callq 0xcf6b
incq %r13
cmpq $0x20, %r13
jne 0xbb1e
movq (%rsp), %rax
incq %rax
addq $0x20, %r15
movq 0x8(%rsp), %r12
addq $0x10, %r12
cmpq $0x12, %rax
jne 0xbaf9
movslq 0x810bb5(%rip), %rax    # 0x81c830
shlq $0x4, %rax
leaq 0x10baa(%rip), %rcx     # 0x1c830
xorl %ebx, %ebx
movb %bl, (%rax,%rcx)
leaq 0x4d(%rip), %rdi        # 0xbcdf
callq 0x11995
movb %bl, 0x10a27(%rip)      # 0x1c6c4
movl $0x1, %edi
callq 0x6370
movl %eax, 0x814677(%rip)    # 0x820324
leaq 0x10(%rsp), %rdi
movl %eax, (%rdi)
callq 0x6540
movq $0x0, 0x10a04(%rip) # 0x1c6c8
movl $0x0, 0x10a02(%rip)     # 0x1c6d0
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq