LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::receive(int)
MessageData* WrapperSocket::receive(int timeout) {
  if(timeout == TIMEOUT_ON) {
    struct pollfd fd;
    fd.fd = this->localSocketHandler;
    fd.events = POLLIN;
    int ret = poll(&fd, 1, 2000);
    switch(ret) {
      case -1:
        return NULL;
      case 0: printf("Timeout\n");
        return NULL;
      default: break;
    }
  }

  char* msg = new char[PACKET_LEN];
  memset(msg, 0, PACKET_LEN);
  bool receivedCorrectly = false;
  MessageData * data;
  while(!receivedCorrectly) {

    int msgSize = recvfrom(this->localSocketHandler, (void *) msg, 
      PACKET_LEN, 0, (struct sockaddr *) &this->remoteSocketAddr, &this->remoteSocketLen);
    if (msgSize < 0) {
      fprintf(stderr, "Error on receiving\n");
      exit(1);
    }

    data = (MessageData *) msg;

    if (data->type != TYPE_ACK && this->lastData != NULL && this->isEqual(this->lastData, data))
      continue;
    if (data->socketSeq == -1)
      break;
    if (data->socketSeq == 0)
      this->socketSeq = 0;
    if (data->socketSeq == this->socketSeq && data->type != TYPE_ACK) {
      MessageData message = make_packet(TYPE_ACK, data->seq, 1, -1, "");
      this->sendAck(&message);
      this->socketSeq = data->socketSeq + 1;
      break;
    }
  }

  this->lastData = data;
  // TODO delete msg
  return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xfe0, %rsp            # imm = 0xFE0
movq %rdi, %rbx
cmpl $0x1, %esi
jne 0xec85
movl (%rbx), %eax
leaq -0xff4(%rbp), %rdi
movl %eax, (%rdi)
movw $0x1, 0x4(%rdi)
movl $0x1, %esi
movl $0x7d0, %edx            # imm = 0x7D0
callq 0x34a0
cmpl $-0x1, %eax
je 0xec7d
testl %eax, %eax
jne 0xec85
leaq 0x19ea(%rip), %rdi      # 0x10662
callq 0x34d0
xorl %r14d, %r14d
jmp 0xed46
movl $0x1000, %edi           # imm = 0x1000
callq 0x3030
movq %rax, %r14
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rdi
xorl %esi, %esi
callq 0x3230
leaq 0x20(%rbx), %r15
leaq 0x40(%rbx), %r12
movl (%rbx), %edi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rsi
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %r9
callq 0x3290
testl %eax, %eax
js 0xed59
cmpl $0x1, (%r14)
je 0xece3
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0xece3
movq %r14, %rdx
callq 0xed5e
testb %al, %al
jne 0xeca9
movl 0x10(%r14), %eax
testl %eax, %eax
je 0xecf7
cmpl $-0x1, %eax
je 0xed42
cmpl 0x8(%rbx), %eax
jne 0xeca9
jmp 0xecfe
movl $0x0, 0x8(%rbx)
cmpl $0x1, (%r14)
je 0xeca9
movl 0x4(%r14), %edx
leaq 0x1926(%rip), %r9       # 0x10635
leaq -0xff4(%rbp), %r15
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x65b0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xef46
movl 0x10(%r14), %eax
incl %eax
movl %eax, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movq %r14, %rax
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x37ab
// File: /workspace/github_cpp_makefile_star2_O3/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::isEqual(Dropbox::_MessageData*, Dropbox::_MessageData*)
bool WrapperSocket::isEqual(MessageData * a, MessageData * b) {
  if (a->type != b->type || a->seq != b->seq || a->totalSize != b->totalSize)
    return false;
  if (a->len != b->len || a->socketSeq != b->socketSeq)
    return false;
  if (string(a->payload).compare(string(b->payload)) != 0)
    return false;
  if (string(a->username).compare(string(b->username)) != 0)
    return false;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl (%rsi), %eax
cmpl (%rdx), %eax
jne 0xeef6
movq %rdx, %rbx
movq %rsi, %r14
movl 0x4(%rsi), %eax
cmpl 0x4(%rdx), %eax
jne 0xeef6
movl 0x8(%r14), %eax
cmpl 0x8(%rbx), %eax
jne 0xeef6
movl 0xc(%r14), %eax
cmpl 0xc(%rbx), %eax
jne 0xeef6
movl 0x10(%r14), %eax
cmpl 0x10(%rbx), %eax
jne 0xeef6
leaq 0x14(%r14), %r15
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, %rdi
callq 0x3170
leaq (%r14,%rax), %rdx
addq $0x14, %rdx
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x630e
leaq 0x14(%rbx), %r15
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, %rdi
callq 0x3170
leaq (%rbx,%rax), %rdx
addq $0x14, %rdx
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x630e
movq -0x40(%rbp), %r12
movq -0x68(%rbp), %r15
movq -0x60(%rbp), %r13
cmpq %r12, %r13
movq %r12, %rdx
cmovbq %r13, %rdx
testq %rdx, %rdx
je 0xee32
movq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x3350
testl %eax, %eax
je 0xee32
xorl %r12d, %r12d
jmp 0xee39
cmpq %r13, %r12
sete %r12b
leaq -0x38(%rbp), %r13
leaq -0x58(%rbp), %rax
cmpq %rax, %r15
je 0xee4e
movq %r15, %rdi
callq 0x3320
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0xee5c
callq 0x3320
testb %r12b, %r12b
je 0xeef6
leaq 0xfb4(%r14), %r15
leaq -0x48(%rbp), %r12
movq %r13, (%r12)
movq %r15, %rdi
callq 0x3170
leaq (%r14,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
movq %r12, %rdi
movq %r15, %rsi
callq 0x630e
leaq 0xfb4(%rbx), %r14
leaq -0x68(%rbp), %r15
leaq -0x58(%rbp), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x3170
leaq (%rbx,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
movq %r15, %rdi
movq %r14, %rsi
callq 0x630e
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3050
testl %eax, %eax
sete %bl
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xeee6
callq 0x3320
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0xeef8
callq 0x3320
jmp 0xeef8
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xef27
callq 0x3320
jmp 0xef27
jmp 0xef24
jmp 0xef3b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xef3e
callq 0x3320
jmp 0xef3e
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3580
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: TextWidth(char const*)
int TextWidth(const char* text)
{
	int w = 0;
	while (*text)
	{
		w += hifont[(unsigned char)*text].w;
		++text;
	}
	return w;
}

// Assembly:
movb (%rdi), %dl
testb %dl, %dl
je 0x7d9c
incq %rdi
xorl %eax, %eax
leaq 0xc480(%rip), %rcx      # 0x14200
movzbl %dl, %edx
movl %edx, %esi
shll $0x5, %esi
leaq (%rsi,%rdx,2), %rdx
movzbl (%rcx,%rdx), %edx
addl %edx, %eax
movb (%rdi), %dl
incq %rdi
testb %dl, %dl
jne 0x7d80
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: DrawText(char const*, int&, int, unsigned char, unsigned char, SDL_Surface*)
void DrawText(const char* text, int &x, const int y0, unsigned char fg, unsigned char bg, SDL_Surface* destsurf)
{
	if (destsurf == nullptr)
		return;
	if (destsurf->pixels == nullptr)
		return;
	if (y0 >= destsurf->h)
		return;
	unsigned char c[2] = { bg, fg };
	int mingy = -y0;
	if (mingy < 0)
		mingy = 0;
	int maxgy = destsurf->h - y0;
	if (maxgy > 16)
		maxgy = 16;
	while (*text)
	{
		int gw = hifont[(unsigned char)*text].w;
		unsigned short gbits[16];
		for (unsigned short* src = (unsigned short*)hifont[(unsigned char)*text].bmp, * dst = gbits; src < hifont[(unsigned char)*text].bmp + 16; ++src, ++dst)
			*dst = *src;
		unsigned char* rowstart = (unsigned char*)destsurf->pixels + (long long)destsurf->pitch * y0 + x;
		int mingx = -x;
		int maxgx = destsurf->w - x;
		if (mingx < gw)
		{
			for (int gy = mingy; gy < maxgy; ++gy)
			{
				for (int gx = 0; gx < gw; ++gx)
				{
					if (gx >= mingx && gx < maxgx)
						rowstart[gx] = c[gbits[gy] & 1];
					gbits[gy] >>= 1;
				}
				rowstart += destsurf->pitch;
			}
		}
		if (maxgx <= 0)
			break;
		x += gw;
		++text;
	}
}

// Assembly:
testq %r9, %r9
je 0x7edc
cmpq $0x0, 0x20(%r9)
je 0x7edc
movl 0x14(%r9), %r11d
subl %edx, %r11d
jle 0x7edc
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movb %r8b, -0x32(%rsp)
movb %cl, -0x31(%rsp)
movb (%rdi), %r10b
testb %r10b, %r10b
je 0x7ed2
cmpl $0x10, %r11d
movl $0x10, %eax
cmovll %r11d, %eax
movslq %edx, %rcx
movq %rcx, -0x30(%rsp)
negl %edx
xorl %r8d, %r8d
testl %edx, %edx
cmovlel %r8d, %edx
movzbl %r10b, %r10d
movl %r10d, %r11d
shll $0x5, %r11d
leaq (%r11,%r10,2), %r11
leaq 0xc3eb(%rip), %rcx      # 0x14200
movzbl (%rcx,%r11), %r10d
movups 0x2(%rcx,%r11), %xmm0
movups 0x12(%rcx,%r11), %xmm1
movaps %xmm1, -0x18(%rsp)
movaps %xmm0, -0x28(%rsp)
movslq (%rsi), %r15
movq %r15, %r11
negq %r11
movslq 0x10(%r9), %rbx
subq %r15, %rbx
cmpl %r10d, %r11d
jge 0x7ebb
cmpl %eax, %edx
jge 0x7ebb
movslq 0x18(%r9), %r13
movq %r13, %r14
imulq -0x30(%rsp), %r14
addq 0x20(%r9), %r14
addq %r15, %r14
movl %r10d, %r15d
movq %rdx, %r12
testl %r10d, %r10d
je 0x7ead
movzwl -0x28(%rsp,%r12,2), %r13d
xorl %ebp, %ebp
cmpq %r11, %rbp
setge %cl
cmpq %rbx, %rbp
setl %r8b
andb %cl, %r8b
movzwl %r13w, %r13d
cmpb $0x1, %r8b
jne 0x7e98
movl %r13d, %ecx
andl $0x1, %ecx
movb -0x32(%rsp,%rcx), %cl
movb %cl, (%r14,%rbp)
shrl %r13d
incq %rbp
cmpq %rbp, %r15
jne 0x7e70
movw %r13w, -0x28(%rsp,%r12,2)
movl 0x18(%r9), %r13d
movslq %r13d, %rbp
addq %rbp, %r14
incq %r12
cmpq %rax, %r12
jne 0x7e63
testl %ebx, %ebx
jle 0x7ed2
addl %r10d, (%rsi)
movb 0x1(%rdi), %r10b
incq %rdi
testb %r10b, %r10b
jne 0x7dff
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: DrawLogo(int, int, SDL_Surface*)
void DrawLogo(int x0, int y0, SDL_Surface* destsurf) {
	char* sptr = (char*)aboutlogopixels;
	char* rptr = (char*)(destsurf->pixels) + y0 * (long long)destsurf->pitch + x0;
	for (int y = 0; y < 27; ++y)
	{
		char* dptr = rptr;
		for (int x = 0; x < 29; ++x)
		{
			*dptr++ = *sptr++;
		}
		rptr += destsurf->pitch;
	}
}

// Assembly:
movslq %esi, %rax
movslq 0x18(%rdx), %rcx
imulq %rax, %rcx
addq 0x20(%rdx), %rcx
movslq %edi, %rax
addq %rcx, %rax
leaq 0xb697(%rip), %rcx      # 0x13590
xorl %esi, %esi
xorl %edi, %edi
movb (%rcx,%rdi), %r8b
movb %r8b, (%rax,%rdi)
incq %rdi
cmpq $0x1d, %rdi
jne 0x7efd
movslq 0x18(%rdx), %r8
addq %r8, %rax
incl %esi
addq %rdi, %rcx
cmpl $0x1b, %esi
jne 0x7efb
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: LogStack(unsigned char)
dlogentry* ExtendLog(dletype etype)
{
	if (debuglogend == debuglogstart)
	{
		++debuglogstart;
		debuglogstart &= dlogidxmask;
	}
	debuglog[debuglogstart].entrytype = dletype::LT_START;
	debuglog[debuglogend].entrytype = etype;
	dlogentry* newentry = debuglog + debuglogend;
	++debuglogend;
	debuglogend &= dlogidxmask;
	return newentry;
}

// Assembly:
movslq 0xf4ba(%rip), %rcx      # 0x1c2f8
movl 0x80f9ec(%rip), %eax    # 0x81c830
leal 0x1(%rcx), %edx
andl $0x7ffff, %edx          # imm = 0x7FFFF
cmpl %eax, %ecx
jne 0xce59
movl %edx, 0x80f9d9(%rip)    # 0x81c830
movl %edx, %eax
movslq %eax, %rsi
shlq $0x4, %rsi
leaq 0xf9c9(%rip), %rax      # 0x1c830
movb $0x0, (%rsi,%rax)
shlq $0x4, %rcx
movb $0x8, (%rcx,%rax)
movl %edx, 0xf47f(%rip)      # 0x1c2f8
cmpb $0x0, 0xf841(%rip)      # 0x1c6c1
jne 0xcec1
addq %rcx, %rax
movzbl %dil, %ecx
incl %ecx
movq 0xf5ce(%rip), %rdx      # 0x1c460
xorl %esi, %esi
movl %ecx, %r8d
orq $0x100, %r8             # imm = 0x100
movb (%rdx,%r8), %r8b
movb %r8b, 0x5(%rax,%rsi)
incq %rsi
incl %ecx
movzbl %cl, %ecx
cmpq $0x7, %rsi
jne 0xce94
movb 0x80f97d(%rip), %cl     # 0x81c838
subb %dil, %cl
movb %cl, 0x4(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: StepSoundSchedules()
void StepSoundSchedules()
{
	bool shiftregister[4]{ false, false, false, false };
	bool scheduleisempty[2]{ false, false };
	for (int s = 0; s < 2; ++s)
	{
		if (!soundcndcounter[s])
		{
			for (int v = 0; v < 4; ++v)
			{
				if (soundscvmapregister & (1 << (4 * s + v)))
				{
					soundvolregister[v] = soundqueue[v][0].vol;
					soundfreqregister[v] = soundqueue[v][0].freq;
					soundcndcounter[s] = soundqueuedur[s][0];
					shiftregister[v] = true;
				}
			}
			for (int i = 0; i < 15; ++i)
				soundqueuedur[s][i] = soundqueuedur[s][i + 1];
			soundqueuedur[s][15] = 0xffff;
			++soundncounter[s];
			if (!soundncounter[s])
				scheduleisempty[s] = true;
		}
		--soundcndcounter[s];
	}
	for (int v = 0; v < 4; ++v)
	{
		if (shiftregister[v])
		{
			for (int i = 0; i < 15; ++i)
				soundqueue[v][i] = soundqueue[v][i + 1];
			soundqueue[v][15] = { 0, 0 };
		}
	}
	if (scheduleisempty[0] || scheduleisempty[1])
		; // TODO: trigger interrupt if appropriate flag (?) is set
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0x0, -0x4(%rsp)
movzbl 0x10d31(%rip), %eax     # 0x1c6d5
movb $0x1, %cl
xorl %edx, %edx
leaq 0x10e71(%rip), %rsi     # 0x1c820
leaq 0x10d2a(%rip), %rdi     # 0x1c6e0
leaq 0x10d65(%rip), %r9      # 0x1c722
leaq 0x10d0c(%rip), %r11     # 0x1c6d0
movzwl (%rsi,%rdx,2), %ebx
testw %bx, %bx
jne 0xba5b
leaq (,%rdx,4), %r12
movq %rdx, %r14
shlq $0x5, %r14
leaq (%rdi,%r14), %r15
xorl %ebx, %ebx
movq %r9, %r13
leaq 0x10cd8(%rip), %rbp     # 0x1c6c8
xorl %r8d, %r8d
leal (%r12,%r8), %r10d
btl %r10d, %eax
jae 0xba1d
movb -0x2(%r13), %r10b
movb %r10b, (%r8,%r11)
movzwl (%r13), %r10d
movw %r10w, (%rbp)
movzwl (%r15), %ebx
movw %bx, (%rsi,%rdx,2)
movb $0x1, -0x4(%rsp,%r8)
incq %r8
addq $0x2, %rbp
addq $0x40, %r13
cmpq $0x4, %r8
jne 0xb9f3
movl $0x1, %r8d
movzwl (%r15,%r8,2), %r10d
movw %r10w, -0x2(%r15,%r8,2)
incq %r8
cmpq $0x10, %r8
jne 0xba34
movw $0xffff, 0x1e(%r14,%rdi) # imm = 0xFFFF
leaq 0x10dcd(%rip), %r8      # 0x1c824
incb (%rdx,%r8)
decl %ebx
movw %bx, (%rsi,%rdx,2)
movl $0x1, %edx
testb $0x1, %cl
movl $0x0, %ecx
jne 0xb9c4
leaq 0x10ca5(%rip), %rax     # 0x1c720
xorl %ecx, %ecx
movq %rax, %rdx
cmpb $0x1, -0x4(%rsp,%rcx)
jne 0xbaaf
movl $0x1, %esi
movl (%rdx,%rsi,4), %edi
movl %edi, -0x4(%rdx,%rsi,4)
incq %rsi
cmpq $0x10, %rsi
jne 0xba8c
movq %rcx, %rsi
shlq $0x6, %rsi
movb $0x0, 0x3c(%rsi,%rax)
movw $0x0, 0x3e(%rsi,%rax)
incq %rcx
addq $0x40, %rdx
cmpq $0x4, %rcx
jne 0xba80
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: InitMemory()
int InitMemory()
{
	sysram = new unsigned char[0x10000];
	syspflags = new pageflags[0x100];
	if (!sysram || !syspflags)
	{
		SDL_Log("Could not allocate system address space");
		return -1;
	}
	for (int p = 0x00; p < 0x20; ++p)
		syspflags[p] = pageflags::PF_TRAM;
	{ // Initialize the builtin RAM with deterministic random data
		std::mt19937 gen(1); //TODO: seed with a hash of machine identifying info
		std::uniform_int_distribution<> dis(0x00, 0xFF);
		for (int a = 0x0000; a < 0x2000; ++a)
			sysram[a] = dis(gen);
	}
	for (int p = 0x20; p < 0x100; ++p)
		syspflags[p] = pageflags::PF_TFLOATING;
	syspflags[0x02] = pageflags::PF_INONLY;
	syspflags[0x03] = pageflags::PF_OUTONLY;
	floatgen.seed(seedgen());
	//InitVideoMem(); // no cheating!
	InstallROM();
	for (int p = 0xf0; p < 0x100; ++p)
		syspflags[p] = syspflags[p] | pageflags::PF_DONTLOG;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1390, %rsp           # imm = 0x1390
movl $0x10000, %edi          # imm = 0x10000
callq 0x6040
movq %rax, 0x1017a(%rip)     # 0x1c460
movl $0x100, %edi            # imm = 0x100
callq 0x6040
movq %rax, 0x10171(%rip)     # 0x1c468
movaps 0x6df2(%rip), %xmm0     # 0x130f0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movq $0x1, 0x8(%rsp)
movl $0x1, %eax
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x8(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0xc318
leaq 0x8(%rsp), %rbx
movq $0x270, 0x1380(%rbx) # imm = 0x270
movabsq $0xff00000000, %rax     # imm = 0xFF00000000
movq %rsp, %r14
movq %rax, (%r14)
xorl %r15d, %r15d
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11378
movq 0x100ee(%rip), %rcx     # 0x1c460
movb %al, (%rcx,%r15)
incq %r15
cmpq $0x2000, %r15           # imm = 0x2000
jne 0xc35d
movq 0x100df(%rip), %rbx     # 0x1c468
leaq 0x20(%rbx), %rdi
movl $0xe0, %edx
xorl %esi, %esi
callq 0x61e0
movw $0xa09, 0x2(%rbx)       # imm = 0xA09
leaq 0x8104aa(%rip), %rdi    # 0x81c850
callq 0x6480
movl %eax, %eax
movq %rax, 0x811824(%rip)    # 0x81dbd8
movl $0x1, %ecx
leaq 0x811818(%rip), %rdx    # 0x81dbd8
movq %rax, %rsi
shrq $0x1e, %rsi
xorl %eax, %esi
imull $0x6c078965, %esi, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, (%rdx,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0xc3c0
movq $0x270, 0x812b6c(%rip) # imm = 0x270
callq 0xc41c
movq 0x10070(%rip), %rax     # 0x1c468
movups 0xf0(%rax), %xmm0
orps 0x6cfa(%rip), %xmm0     # 0x13100
movups %xmm0, 0xf0(%rax)
xorl %eax, %eax
addq $0x1390, %rsp           # imm = 0x1390
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: InitSound()
int InitSound()
{
	SDL_AudioSpec desiredsoundspec;
	SDL_memset(&desiredsoundspec, 0, sizeof(desiredsoundspec));
	desiredsoundspec.freq = 44100;
	desiredsoundspec.format = AUDIO_U8;
	desiredsoundspec.channels = 2;
	desiredsoundspec.samples = 512;
	desiredsoundspec.callback = GenerateStereoAudio;
	sounddev = SDL_OpenAudioDevice(NULL, false, &desiredsoundspec, &soundspec, 0);
	if (!sounddev)
	{
		SDL_Log("Could not open sound device");
	}
	SDL_PauseAudioDevice(sounddev, 0);
	return 0;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rsp, %rbx
movl $0x20, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6180
movl $0xac44, (%rbx)         # imm = 0xAC44
movw $0x8, 0x4(%rbx)
movb $0x2, 0x6(%rbx)
movw $0x200, 0x8(%rbx)       # imm = 0x200
leaq -0x1695(%rip), %rax     # 0xb450
movq %rax, 0x10(%rbx)
leaq 0x813810(%rip), %rcx    # 0x820300
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x63f0
movl %eax, 0x81381b(%rip)    # 0x820320
testl %eax, %eax
jne 0xcb1d
leaq 0xa01f(%rip), %rdi      # 0x16b2f
xorl %eax, %eax
callq 0x6470
movl 0x813803(%rip), %eax    # 0x820320
movl %eax, %edi
xorl %esi, %esi
callq 0x6440
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: LogScanline(int)
void LogScanline(int scanline)
{
	if (debuglog[(debuglogend - 1) & dlogidxmask].entrytype == dletype::LT_SCANLINE)
	{
		debuglog[(debuglogend - 1) & dlogidxmask].scanline = scanline;
		return;
	}
	ExtendLog(dletype::LT_SCANLINE)->scanline = scanline;
}

// Assembly:
movslq 0xf521(%rip), %rax      # 0x1c2f8
leal -0x1(%rax), %edx
andl $0x7ffff, %edx          # imm = 0x7FFFF
movl %edx, %esi
shll $0x4, %esi
leaq 0xfa44(%rip), %rcx      # 0x1c830
cmpb $0x9, (%rsi,%rcx)
jne 0xcdf7
movq %rdx, %rax
jmp 0xce2e
movl 0x80fa33(%rip), %esi    # 0x81c830
leal 0x1(%rax), %edx
andl $0x7ffff, %edx          # imm = 0x7FFFF
cmpl %esi, %eax
jne 0xce12
movl %edx, 0x80fa20(%rip)    # 0x81c830
movl %edx, %esi
movslq %esi, %rsi
shlq $0x4, %rsi
movb $0x0, (%rsi,%rcx)
movq %rax, %rsi
shlq $0x4, %rsi
movb $0x9, (%rsi,%rcx)
movl %edx, 0xf4ca(%rip)      # 0x1c2f8
shlq $0x4, %rax
movl %edi, 0x4(%rax,%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: LogWrite(unsigned short, unsigned char)
void LogWrite(uint16_t address, uint8_t value)
{
	dlogentry* last = debuglog + ((debuglogend - 1) & dlogidxmask);
	if (suppresslogging && ((bool)(syspflags[address >> 8] & pageflags::PF_IO)
		|| ((syspflags[address >> 8] & pageflags::PF_TMASK) == pageflags::PF_TFLOATING)))
		return;
	if (last->entrytype == dletype::LT_PARTIALINST)
		last->entrytype = dletype::LT_INST;
	dlogentry* newentry = ExtendLog(dletype::LT_WRITE);
	newentry->mementry.address = address;
	newentry->mementry.value = value;
	newentry->mementry.memtype = syspflags[address >> 8];
}

// Assembly:
movslq 0xf42f(%rip), %rax      # 0x1c2f8
cmpb $0x1, 0xf7f1(%rip)      # 0x1c6c1
movzwl %di, %ecx
jne 0xcef9
movq 0xf58c(%rip), %rdx      # 0x1c468
movl %ecx, %edi
shrl $0x8, %edi
movb (%rdx,%rdi), %dl
movl %edx, %edi
andb $0x8, %dil
shrb $0x3, %dil
testb $0x3, %dl
sete %dl
orb %dil, %dl
jne 0xcf6a
leal -0x1(%rax), %edi
andl $0x7ffff, %edi          # imm = 0x7FFFF
shll $0x4, %edi
leaq 0xf924(%rip), %rdx      # 0x1c830
addq %rdx, %rdi
cmpb $0x6, (%rdi)
jne 0xcf17
movb $0x7, (%rdi)
movl 0x80f912(%rip), %r8d    # 0x81c830
leal 0x1(%rax), %edi
andl $0x7ffff, %edi          # imm = 0x7FFFF
cmpl %r8d, %eax
jne 0xcf35
movl %edi, 0x80f8fe(%rip)    # 0x81c830
movl %edi, %r8d
movslq %r8d, %r8
shlq $0x4, %r8
movb $0x0, (%r8,%rdx)
shlq $0x4, %rax
movb $0x3, (%rax,%rdx)
movl %edi, 0xf3a9(%rip)      # 0x1c2f8
movw %cx, 0x4(%rax,%rdx)
movb %sil, 0x6(%rax,%rdx)
movq 0xf508(%rip), %rsi      # 0x1c468
shrl $0x8, %ecx
movb (%rsi,%rcx), %cl
movb %cl, 0x7(%rax,%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: RandomBitFlip()
void RandomBitFlip()
{
	static std::mt19937 gen(0);
	static std::uniform_int_distribution<> dis(0x0800, 0x1FFF);
	if (dis(gen) & 0xf)
		return;
	int addr = dis(gen);
	int bit = dis(gen) & 7;
	write6502(addr, sysram[addr] ^ (1 << bit));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movb 0x814423(%rip), %al     # 0x821740
testb %al, %al
je 0xd39d
movb 0x814429(%rip), %al     # 0x821750
testb %al, %al
je 0xd3a7
leaq 0x813086(%rip), %rsi    # 0x8203b8
leaq 0x81440f(%rip), %rdi    # 0x821748
movq %rdi, %rdx
callq 0x11378
testb $0xf, %al
je 0xd34a
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x813067(%rip), %rbx    # 0x8203b8
leaq 0x8143f0(%rip), %r14    # 0x821748
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11378
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11378
andb $0x7, %al
movl $0x1, %edx
movl %eax, %ecx
shll %cl, %edx
movq 0xf0d8(%rip), %rax      # 0x1c460
movslq %ebp, %rcx
xorb (%rax,%rcx), %dl
movzbl %dl, %esi
movzwl %cx, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0xd3b1
callq 0x66e4
jmp 0xd321
callq 0x6743
jmp 0xd32b
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: RenderScanline(int, SDL_Surface*, SDL_Surface*)
void RenderScanline(int scanline, SDL_Surface* framebuffer, SDL_Surface* winsurface)
{
	if (!scanlinedirty[scanline])
		return;
	int y0 = scanline * winsurface->h / 576;
	int y1 = (scanline + 1) * winsurface->h / 576;
	unsigned char* src = (unsigned char*)(framebuffer->pixels) + (long long)framebuffer->pitch * y0;
	unsigned char* dst = (unsigned char*)(winsurface->pixels) + (long long)winsurface->pitch * y0;
	//pitch is assumed same for both surfaces
	unsigned char* stop = (unsigned char*)(framebuffer->pixels) + (long long)framebuffer->pitch * y1;
	while (src < stop)
	{
		*dst = *src;
		++src;
		++dst;
	}
	scanlinedirty[scanline] = false;
}

// Assembly:
movslq %edi, %rax
leaq 0xdb65(%rip), %rcx      # 0x1c480
cmpb $0x1, (%rax,%rcx)
jne 0xe9a7
movl 0x14(%rdx), %r8d
movl %r8d, %r9d
imull %edi, %r9d
movslq %r9d, %r9
imulq $0x38e38e39, %r9, %r9   # imm = 0x38E38E39
movq %r9, %r10
shrq $0x3f, %r10
sarq $0x27, %r9
addl %r10d, %r9d
incl %edi
imull %r8d, %edi
movslq %edi, %rdi
imulq $0x38e38e39, %rdi, %rdi # imm = 0x38E38E39
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x27, %rdi
addl %r8d, %edi
movslq 0x18(%rsi), %r8
movslq %r9d, %r9
movslq %edi, %rdi
imulq %r8, %rdi
imulq %r9, %r8
cmpq %rdi, %r8
jge 0xe9a3
movq 0x20(%rsi), %r10
addq %r10, %rdi
movslq 0x18(%rdx), %rsi
imulq %r9, %rsi
addq 0x20(%rdx), %rsi
addq %r10, %r8
movb (%r8), %dl
movb %dl, (%rsi)
incq %r8
incq %rsi
cmpq %rdi, %r8
jb 0xe993
movb $0x0, (%rax,%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: pull16
uint16_t pull16() {
    uint16_t temp16;
    temp16 = read6502(BASE_STACK + ((sp + 1) & 0xFF)) | ((uint16_t)read6502(BASE_STACK + ((sp + 2) & 0xFF)) << 8);
    sp += 2;
    return(temp16);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movb 0x8100ce(%rip), %al     # 0x82177c
incb %al
movzbl %al, %edi
movl $0x100, %ebx            # imm = 0x100
orl %ebx, %edi
callq 0xe9ae
movzbl %al, %ebp
movb 0x8100b4(%rip), %al     # 0x82177c
addb $0x2, %al
movzbl %al, %edi
orl %ebx, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %ebp, %eax
addb $0x2, 0x810099(%rip)    # 0x82177c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: reset6502
void reset6502() {
    pc = (uint16_t)read6502(0xFFFC) | ((uint16_t)read6502(0xFFFD) << 8);
    a = 0;
    x = 0;
    y = 0;
    sp = 0xFD;
    status |= FLAG_CONSTANT;
}

// Assembly:
pushq %rbx
movl $0xfffc, %edi           # imm = 0xFFFC
callq 0xe9ae
movzbl %al, %ebx
movl $0xfffd, %edi           # imm = 0xFFFD
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %ebx, %eax
movw %ax, 0x810051(%rip)     # 0x82177e
xorl %eax, %eax
movb %al, 0x81004b(%rip)     # 0x821780
movb %al, 0x810046(%rip)     # 0x821781
movb %al, 0x810041(%rip)     # 0x821782
movb $-0x3, 0x810034(%rip)   # 0x82177c
orb $0x20, 0x810034(%rip)   # 0x821783
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: nmi6502
void nmi6502() {
    push16(pc);
    push8(status);
    status |= FLAG_INTERRUPT;
    pc = (uint16_t)read6502(0xFFFA) | ((uint16_t)read6502(0xFFFB) << 8);
}

// Assembly:
pushq %rbx
movzwl 0x810025(%rip), %edi    # 0x82177e
callq 0x11648
movzbl 0x81001e(%rip), %esi    # 0x821783
movzbl 0x810010(%rip), %edi    # 0x82177c
leal -0x1(%rdi), %eax
movb %al, 0x810007(%rip)     # 0x82177c
orl $0x100, %edi            # imm = 0x100
callq 0xd3b1
orb $0x4, 0x80fffc(%rip)    # 0x821783
movl $0xfffa, %edi           # imm = 0xFFFA
callq 0xe9ae
movzbl %al, %ebx
movl $0xfffb, %edi           # imm = 0xFFFB
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %ebx, %eax
movw %ax, 0x80ffd1(%rip)     # 0x82177e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: irq6502
void irq6502() {
    push16(pc);
    push8(status);
    status |= FLAG_INTERRUPT;
    pc = (uint16_t)read6502(0xFFFE) | ((uint16_t)read6502(0xFFFF) << 8);
}

// Assembly:
pushq %rbx
movzwl 0x80ffc7(%rip), %edi    # 0x82177e
callq 0x11648
movzbl 0x80ffc0(%rip), %esi    # 0x821783
movzbl 0x80ffb2(%rip), %edi    # 0x82177c
leal -0x1(%rdi), %eax
movb %al, 0x80ffa9(%rip)     # 0x82177c
orl $0x100, %edi            # imm = 0x100
callq 0xd3b1
orb $0x4, 0x80ff9e(%rip)    # 0x821783
movl $0xfffe, %edi           # imm = 0xFFFE
callq 0xe9ae
movzbl %al, %ebx
movl $0xffff, %edi           # imm = 0xFFFF
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %ebx, %eax
movw %ax, 0x80ff73(%rip)     # 0x82177e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: exec6502
void exec6502(uint32_t tickcount) {
    clockgoal6502 += tickcount;
    while ((clockticks6502 - clockgoal6502) & 0x80000000) {
        // MDPKH: while condition changed to account for overflow / wraparound
        opcode = read6502(pc++);
        status |= FLAG_CONSTANT;

        penaltyop = 0;
        penaltyaddr = 0;

        (*addrtable[opcode])();
        (*optable[opcode])();
        clockticks6502 += ticktable[opcode];
        if (penaltyop && penaltyaddr) clockticks6502++;

        instructions++;

        if (callexternal) (*loopexternal)();
    }

}

// Assembly:
addl 0x80ff65(%rip), %edi    # 0x821778
movl %edi, 0x80ff5f(%rip)    # 0x821778
cmpl %edi, 0x80ff55(%rip)    # 0x821774
js 0x11822
retq
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0x957d(%rip), %r14      # 0x1adb0
leaq 0x9d76(%rip), %r15      # 0x1b5b0
leaq 0x54af(%rip), %r12      # 0x16cf0
movzwl 0x80ff36(%rip), %edi    # 0x82177e
leal 0x1(%rdi), %eax
movw %ax, 0x80ff2c(%rip)     # 0x82177e
callq 0xe9ae
orb $0x20, 0x80ff25(%rip)   # 0x821783
movb %al, 0x80ff21(%rip)     # 0x821785
movb %bl, 0x80ff1c(%rip)     # 0x821786
movb %bl, 0x80ff17(%rip)     # 0x821787
movzbl %al, %ecx
xorl %eax, %eax
callq *(%r14,%rcx,8)
movzbl 0x80ff05(%rip), %ecx    # 0x821785
xorl %eax, %eax
callq *(%r15,%rcx,8)
movzbl 0x80fef8(%rip), %ecx    # 0x821785
movl 0x80fee1(%rip), %eax    # 0x821774
addl (%r12,%rcx,4), %eax
movl %eax, 0x80fed7(%rip)    # 0x821774
cmpb %bl, 0x80fee3(%rip)     # 0x821786
je 0x118b6
cmpb $0x0, 0x80fedb(%rip)    # 0x821787
je 0x118b6
incl %eax
movl %eax, 0x80febe(%rip)    # 0x821774
incl 0x80feb4(%rip)          # 0x821770
cmpb $0x0, 0x80fec1(%rip)    # 0x821784
je 0x118d3
xorl %eax, %eax
callq *0x80febb(%rip)         # 0x821788
movl 0x80fea1(%rip), %eax    # 0x821774
cmpl 0x80fe9f(%rip), %eax    # 0x821778
js 0x11841
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: step6502
void step6502() {
    opcode = read6502(pc++);
    status |= FLAG_CONSTANT;

    penaltyop = 0;
    penaltyaddr = 0;

    (*addrtable[opcode])();
    (*optable[opcode])();
    clockticks6502 += ticktable[opcode];
    if (penaltyop && penaltyaddr) clockticks6502++;
    clockgoal6502 = clockticks6502;

    instructions++;

    if (callexternal) (*loopexternal)();
}

// Assembly:
pushq %rbx
movzwl 0x80fe8b(%rip), %edi    # 0x82177e
leal 0x1(%rdi), %eax
movw %ax, 0x80fe81(%rip)     # 0x82177e
callq 0xe9ae
movb %al, 0x80fe7d(%rip)     # 0x821785
orb $0x20, 0x80fe74(%rip)   # 0x821783
xorl %ebx, %ebx
movb %bl, 0x80fe6f(%rip)     # 0x821786
movb %bl, 0x80fe6a(%rip)     # 0x821787
movzbl %al, %ecx
leaq 0x9489(%rip), %rdx      # 0x1adb0
xorl %eax, %eax
callq *(%rdx,%rcx,8)
movzbl 0x80fe52(%rip), %ecx    # 0x821785
leaq 0x9c76(%rip), %rdx      # 0x1b5b0
xorl %eax, %eax
callq *(%rdx,%rcx,8)
movzbl 0x80fe3f(%rip), %ecx    # 0x821785
leaq 0x53a3(%rip), %rdx      # 0x16cf0
movl 0x80fe21(%rip), %eax    # 0x821774
addl (%rdx,%rcx,4), %eax
movl %eax, 0x80fe18(%rip)    # 0x821774
cmpb %bl, 0x80fe24(%rip)     # 0x821786
je 0x11975
cmpb $0x0, 0x80fe1c(%rip)    # 0x821787
je 0x11975
incl %eax
movl %eax, 0x80fdff(%rip)    # 0x821774
incl 0x80fdf5(%rip)          # 0x821770
movl %eax, 0x80fdf7(%rip)    # 0x821778
cmpb $0x0, 0x80fdfc(%rip)    # 0x821784
je 0x11993
xorl %eax, %eax
popq %rbx
jmpq *0x80fdf5(%rip)         # 0x821788
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: indy
static void indy() { // (indirect),Y
    uint16_t eahelp, eahelp2, startpage;
    eahelp = (uint16_t)read6502(pc++);
    eahelp2 = (eahelp & 0xFF00) | ((eahelp + 1) & 0x00FF); //zero-page wraparound
    ea = (uint16_t)read6502(eahelp) | ((uint16_t)read6502(eahelp2) << 8);
    startpage = ea & 0xFF00;
    ea += (uint16_t)y;

    if (startpage != (ea & 0xFF00)) { //one cycle penlty for page-crossing on some opcodes
        penaltyaddr = 1;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movzwl 0x80fcd3(%rip), %edi    # 0x82177e
leal 0x1(%rdi), %eax
movw %ax, 0x80fcc9(%rip)     # 0x82177e
callq 0xe9ae
movl %eax, %ebx
movzbl %al, %edi
incb %bl
callq 0xe9ae
movzbl %al, %ebp
movzbl %bl, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
movl %eax, %ecx
orl %ebp, %ecx
movzbl 0x80fca0(%rip), %edx    # 0x821782
addl %ecx, %edx
movw %dx, 0x80fca7(%rip)     # 0x821792
andl $0xff00, %edx           # imm = 0xFF00
cmpw %dx, %ax
je 0x11afd
movb $0x1, 0x80fc8a(%rip)    # 0x821787
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: absy
static void absy() { //absolute,Y
    uint16_t startpage;
    ea = ((uint16_t)read6502(pc) | ((uint16_t)read6502(pc+1) << 8));
    startpage = ea & 0xFF00;
    ea += (uint16_t)y;

    if (startpage != (ea & 0xFF00)) { //one cycle penlty for page-crossing on some opcodes
        penaltyaddr = 1;
    }

    pc += 2;
}

// Assembly:
pushq %rbx
movzwl 0x80fc49(%rip), %edi    # 0x82177e
callq 0xe9ae
movzbl %al, %ebx
movzwl 0x80fc3a(%rip), %eax    # 0x82177e
incl %eax
movzwl %ax, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
movl %eax, %ecx
orl %ebx, %ecx
movzbl 0x80fc23(%rip), %edx    # 0x821782
addl %ecx, %edx
movw %dx, 0x80fc2a(%rip)     # 0x821792
andl $0xff00, %edx           # imm = 0xFF00
cmpw %dx, %ax
je 0x11b7a
movb $0x1, 0x80fc0d(%rip)    # 0x821787
addw $0x2, 0x80fbfc(%rip)    # 0x82177e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: absx
static void absx() { //absolute,X
    uint16_t startpage;
    ea = ((uint16_t)read6502(pc) | ((uint16_t)read6502(pc+1) << 8));
    startpage = ea & 0xFF00;
    ea += (uint16_t)x;

    if (startpage != (ea & 0xFF00)) { //one cycle penlty for page-crossing on some opcodes
        penaltyaddr = 1;
    }

    pc += 2;
}

// Assembly:
pushq %rbx
movzwl 0x80fbf2(%rip), %edi    # 0x82177e
callq 0xe9ae
movzbl %al, %ebx
movzwl 0x80fbe3(%rip), %eax    # 0x82177e
incl %eax
movzwl %ax, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
movl %eax, %ecx
orl %ebx, %ecx
movzbl 0x80fbcb(%rip), %edx    # 0x821781
addl %ecx, %edx
movw %dx, 0x80fbd3(%rip)     # 0x821792
andl $0xff00, %edx           # imm = 0xFF00
cmpw %dx, %ax
je 0x11bd1
movb $0x1, 0x80fbb6(%rip)    # 0x821787
addw $0x2, 0x80fba5(%rip)    # 0x82177e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: ind
static void ind() { //indirect
    uint16_t eahelp, eahelp2;
    eahelp = (uint16_t)read6502(pc) | (uint16_t)((uint16_t)read6502(pc+1) << 8);
    eahelp2 = (eahelp & 0xFF00) | ((eahelp + 1) & 0x00FF); //replicate 6502 page-boundary wraparound bug
    ea = (uint16_t)read6502(eahelp) | ((uint16_t)read6502(eahelp2) << 8);
    pc += 2;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movzwl 0x80fb98(%rip), %edi    # 0x82177e
callq 0xe9ae
movzbl %al, %ebx
movzwl 0x80fb89(%rip), %edi    # 0x82177e
incl %edi
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
leal (%rax,%rbx), %edi
incl %ebx
movzbl %bl, %ebx
orl %eax, %ebx
andl %ebp, %edi
callq 0xe9ae
movzbl %al, %r14d
andl %ebp, %ebx
movl %ebx, %edi
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %r14d, %eax
movw %ax, 0x80fb5b(%rip)     # 0x821792
addw $0x2, 0x80fb3f(%rip)    # 0x82177e
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: brk
static void brk() {
    pc++;
    push16(pc); //push next instruction address onto stack
    push8(status | FLAG_BREAK); //push CPU status to stack
    setinterrupt(); //set interrupt flag
    pc = (uint16_t)read6502(0xFFFE) | ((uint16_t)read6502(0xFFFF) << 8);
}

// Assembly:
pushq %rbx
movzwl 0x80fb09(%rip), %eax    # 0x82177e
incl %eax
movw %ax, 0x80fb00(%rip)     # 0x82177e
movzwl %ax, %edi
callq 0x11648
movzbl 0x80faf6(%rip), %esi    # 0x821783
movzbl 0x80fae8(%rip), %edi    # 0x82177c
leal -0x1(%rdi), %eax
movb %al, 0x80fadf(%rip)     # 0x82177c
orl $0x100, %edi            # imm = 0x100
orl $0x10, %esi
callq 0xd3b1
orb $0x4, 0x80fad1(%rip)    # 0x821783
movl $0xfffe, %edi           # imm = 0xFFFE
callq 0xe9ae
movzbl %al, %ebx
movl $0xffff, %edi           # imm = 0xFFFF
callq 0xe9ae
movzbl %al, %eax
shll $0x8, %eax
orl %ebx, %eax
movw %ax, 0x80faa6(%rip)     # 0x82177e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: ora
static void ora() {
    penaltyop = 1;
    value = getvalue();
    result = (uint16_t)a | value;
   
    zerocalc(result);
    signcalc(result);
   
    saveaccum(result);
}

// Assembly:
movb $0x1, 0x80faa5(%rip)    # 0x821786
movzbl 0x80fa9d(%rip), %eax    # 0x821785
leaq 0x90c1(%rip), %rcx      # 0x1adb0
leaq -0x2c0(%rip), %rdx      # 0x11a36
cmpq %rdx, (%rcx,%rax,8)
je 0x11d15
pushq %rax
movzwl 0x80fa8e(%rip), %edi    # 0x821792
callq 0xe9ae
movb 0x80fa71(%rip), %cl     # 0x821780
addq $0x8, %rsp
jmp 0x11d1d
movb 0x80fa65(%rip), %cl     # 0x821780
movl %ecx, %eax
movzbl %al, %eax
movw %ax, 0x80fa6f(%rip)     # 0x821796
orb %cl, %al
movzbl %al, %eax
movw %ax, 0x80fa65(%rip)     # 0x821798
testb %al, %al
sete %cl
movb 0x80fa45(%rip), %dl     # 0x821783
andb $0x7d, %dl
addb %cl, %cl
movb %al, 0x80fa37(%rip)     # 0x821780
andb $-0x80, %al
orb %cl, %al
orb %dl, %al
movb %al, 0x80fa2e(%rip)     # 0x821783
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: asl
static void asl() {
    value = getvalue();
    result = value << 1;

    carrycalc(result);
    zerocalc(result);
    signcalc(result);
   
    putvalue(result);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movzbl 0x80f9db(%rip), %eax    # 0x821785
leaq 0x8fff(%rip), %rbx      # 0x1adb0
leaq -0x382(%rip), %r14      # 0x11a36
cmpq %r14, (%rbx,%rax,8)
je 0x11dda
movzwl 0x80f9cd(%rip), %edi    # 0x821792
callq 0xe9ae
movzbl 0x80f9b4(%rip), %ecx    # 0x821785
cmpq %r14, (%rbx,%rcx,8)
sete %cl
jmp 0x11de2
movb $0x1, %cl
movb 0x80f99e(%rip), %al     # 0x821780
movzbl %al, %edx
movw %dx, 0x80f9aa(%rip)     # 0x821796
leal (%rdx,%rdx), %eax
movw %ax, 0x80f9a2(%rip)     # 0x821798
movb 0x80f986(%rip), %sil    # 0x821783
andb $0x7c, %sil
testb $0x7f, %dl
sete %dil
addb %dil, %dil
rolb %dl
andb $-0x7f, %dl
orb %sil, %dl
orb %dil, %dl
movb %dl, 0x80f967(%rip)     # 0x821783
testb %cl, %cl
je 0x11e2e
movb %al, 0x80f95a(%rip)     # 0x821780
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzwl 0x80f95d(%rip), %edi    # 0x821792
movzbl %al, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd3b1
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bpl
static void bpl() {
    if ((status & FLAG_SIGN) == 0) {
        oldpc = pc;
        pc += reladdr;
        if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
            else clockticks6502++;
    }
}

// Assembly:
cmpb $0x0, 0x80f913(%rip)    # 0x821783
js 0x11ead
movzwl 0x80f905(%rip), %eax    # 0x82177e
movw %ax, 0x80f910(%rip)     # 0x821790
movzwl 0x80f90d(%rip), %ecx    # 0x821794
addw %ax, %cx
movw %cx, 0x80f8ed(%rip)     # 0x82177e
xorl %ecx, %eax
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
movl 0x80f8d3(%rip), %eax    # 0x821774
sbbl $0x0, %eax
addl $0x2, %eax
movl %eax, 0x80f8c7(%rip)    # 0x821774
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: and
static void and() {
    penaltyop = 1;
    value = getvalue();
    result = (uint16_t)a & value;
   
    zerocalc(result);
    signcalc(result);
   
    saveaccum(result);
}

// Assembly:
movb $0x1, 0x80f8a7(%rip)    # 0x821786
movzbl 0x80f89f(%rip), %eax    # 0x821785
leaq 0x8ec3(%rip), %rcx      # 0x1adb0
leaq -0x4be(%rip), %rdx      # 0x11a36
cmpq %rdx, (%rcx,%rax,8)
je 0x11f13
pushq %rax
movzwl 0x80f890(%rip), %edi    # 0x821792
callq 0xe9ae
movb 0x80f873(%rip), %cl     # 0x821780
addq $0x8, %rsp
jmp 0x11f1b
movb 0x80f867(%rip), %cl     # 0x821780
movl %ecx, %eax
movzbl %al, %eax
movw %ax, 0x80f871(%rip)     # 0x821796
andb %cl, %al
movzbl %al, %eax
movw %ax, 0x80f867(%rip)     # 0x821798
testb %al, %al
sete %cl
movb 0x80f847(%rip), %dl     # 0x821783
andb $0x7d, %dl
addb %cl, %cl
movb %al, 0x80f839(%rip)     # 0x821780
andb $-0x80, %al
orb %cl, %al
orb %dl, %al
movb %al, 0x80f830(%rip)     # 0x821783
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bit
static void bit() {
    value = getvalue();
    result = (uint16_t)a & value;
   
    zerocalc(result);
    status = (status & 0x3F) | (uint8_t)(value & 0xC0);
}

// Assembly:
movzbl 0x80f805(%rip), %eax    # 0x821785
leaq 0x8e29(%rip), %rcx      # 0x1adb0
leaq -0x558(%rip), %rdx      # 0x11a36
cmpq %rdx, (%rcx,%rax,8)
je 0x11fad
pushq %rax
movzwl 0x80f7f6(%rip), %edi    # 0x821792
callq 0xe9ae
movb 0x80f7d9(%rip), %cl     # 0x821780
addq $0x8, %rsp
jmp 0x11fb5
movb 0x80f7cd(%rip), %cl     # 0x821780
movl %ecx, %eax
movzbl %al, %eax
movw %ax, 0x80f7d7(%rip)     # 0x821796
andb %al, %cl
movzbl %cl, %ecx
movw %cx, 0x80f7cd(%rip)     # 0x821798
testb %cl, %cl
sete %cl
movb 0x80f7ad(%rip), %dl     # 0x821783
andb $0x3d, %dl
addb %cl, %cl
andb $-0x40, %al
orb %cl, %al
orb %dl, %al
movb %al, 0x80f79c(%rip)     # 0x821783
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: rol
static void rol() {
    value = getvalue();
    result = (value << 1) | (status & FLAG_CARRY);
   
    carrycalc(result);
    zerocalc(result);
    signcalc(result);
   
    putvalue(result);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movzbl 0x80f792(%rip), %eax    # 0x821785
leaq 0x8db6(%rip), %rbx      # 0x1adb0
leaq -0x5cb(%rip), %r14      # 0x11a36
cmpq %r14, (%rbx,%rax,8)
je 0x12023
movzwl 0x80f784(%rip), %edi    # 0x821792
callq 0xe9ae
movzbl 0x80f76b(%rip), %ecx    # 0x821785
cmpq %r14, (%rbx,%rcx,8)
sete %cl
jmp 0x1202b
movb $0x1, %cl
movb 0x80f755(%rip), %al     # 0x821780
movzbl %al, %edx
movw %dx, 0x80f761(%rip)     # 0x821796
movzbl 0x80f747(%rip), %esi    # 0x821783
movl %esi, %eax
andl $0x1, %eax
leal (%rax,%rdx,2), %eax
movw %ax, 0x80f74d(%rip)     # 0x821798
andb $0x7c, %sil
testb %al, %al
sete %dil
addb %dil, %dil
rolb %dl
andb $-0x7f, %dl
orb %sil, %dl
orb %dil, %dl
movb %dl, 0x80f71a(%rip)     # 0x821783
testb %cl, %cl
je 0x1207b
movb %al, 0x80f70d(%rip)     # 0x821780
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzwl 0x80f710(%rip), %edi    # 0x821792
movzbl %al, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd3b1
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bmi
static void bmi() {
    if ((status & FLAG_SIGN) == FLAG_SIGN) {
        oldpc = pc;
        pc += reladdr;
        if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
            else clockticks6502++;
    }
}

// Assembly:
cmpb $0x0, 0x80f6c4(%rip)    # 0x821783
js 0x120c2
retq
movzwl 0x80f6b5(%rip), %eax    # 0x82177e
movw %ax, 0x80f6c0(%rip)     # 0x821790
movzwl 0x80f6bd(%rip), %ecx    # 0x821794
addw %ax, %cx
movw %cx, 0x80f69d(%rip)     # 0x82177e
xorl %ecx, %eax
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
movl 0x80f683(%rip), %eax    # 0x821774
sbbl $0x0, %eax
addl $0x2, %eax
movl %eax, 0x80f677(%rip)    # 0x821774
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: lsr
static void lsr() {
    value = getvalue();
    result = value >> 1;
   
    if (value & 1) setcarry();
        else clearcarry();
    zerocalc(result);
    signcalc(result);
   
    putvalue(result);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movzbl 0x80f598(%rip), %eax    # 0x821785
leaq 0x8bbc(%rip), %rbx      # 0x1adb0
leaq -0x7c5(%rip), %r14      # 0x11a36
cmpq %r14, (%rbx,%rax,8)
je 0x1221d
movzwl 0x80f58a(%rip), %edi    # 0x821792
callq 0xe9ae
movzbl 0x80f571(%rip), %ecx    # 0x821785
cmpq %r14, (%rbx,%rcx,8)
sete %cl
jmp 0x12225
movb $0x1, %cl
movb 0x80f55b(%rip), %al     # 0x821780
movzbl %al, %edx
movw %dx, 0x80f567(%rip)     # 0x821796
movl %edx, %eax
shrl %eax
movw %ax, 0x80f55e(%rip)     # 0x821798
movl %edx, %esi
andb $0x1, %sil
movb 0x80f53c(%rip), %dil    # 0x821783
andb $0x7c, %dil
cmpb $0x2, %dl
setb %dl
addb %dl, %dl
orb %sil, %dl
orb %dil, %dl
movb %dl, 0x80f524(%rip)     # 0x821783
testb %cl, %cl
je 0x12271
movb %al, 0x80f517(%rip)     # 0x821780
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzwl 0x80f51a(%rip), %edi    # 0x821792
movzwl %ax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd3b1
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bvc
static void bvc() {
    if ((status & FLAG_OVERFLOW) == 0) {
        oldpc = pc;
        pc += reladdr;
        if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
            else clockticks6502++;
    }
}

// Assembly:
testb $0x40, 0x80f4c4(%rip)   # 0x821783
jne 0x122fc
movzwl 0x80f4b6(%rip), %eax    # 0x82177e
movw %ax, 0x80f4c1(%rip)     # 0x821790
movzwl 0x80f4be(%rip), %ecx    # 0x821794
addw %ax, %cx
movw %cx, 0x80f49e(%rip)     # 0x82177e
xorl %ecx, %eax
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
movl 0x80f484(%rip), %eax    # 0x821774
sbbl $0x0, %eax
addl $0x2, %eax
movl %eax, 0x80f478(%rip)    # 0x821774
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: ror
static void ror() {
    value = getvalue();
    result = (value >> 1) | ((status & FLAG_CARRY) << 7);
   
    if (value & 1) setcarry();
        else clearcarry();
    zerocalc(result);
    signcalc(result);
   
    putvalue(result);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movzbl 0x80f2be(%rip), %eax    # 0x821785
leaq 0x88e2(%rip), %rbx      # 0x1adb0
leaq -0xa9f(%rip), %r14      # 0x11a36
cmpq %r14, (%rbx,%rax,8)
je 0x124f7
movzwl 0x80f2b0(%rip), %edi    # 0x821792
callq 0xe9ae
movzbl 0x80f297(%rip), %ecx    # 0x821785
cmpq %r14, (%rbx,%rcx,8)
sete %cl
jmp 0x124ff
movb $0x1, %cl
movb 0x80f281(%rip), %al     # 0x821780
movzbl %al, %edx
movw %dx, 0x80f28d(%rip)     # 0x821796
movl %edx, %esi
shrl %esi
movb 0x80f26f(%rip), %dil    # 0x821783
movl %edi, %eax
shlb $0x7, %al
setne %r8b
movzbl %al, %eax
andb $0x1, %dl
andb $0x7c, %dil
orb %dl, %dil
orw %si, %ax
movw %ax, 0x80f264(%rip)     # 0x821798
sete %dl
addb %dl, %dl
shlb $0x7, %r8b
orb %dil, %r8b
orb %dl, %r8b
movb %r8b, 0x80f239(%rip)    # 0x821783
testb %cl, %cl
je 0x1255c
movb %al, 0x80f22c(%rip)     # 0x821780
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzwl 0x80f22f(%rip), %edi    # 0x821792
movzbl %al, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd3b1
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bvs
static void bvs() {
    if ((status & FLAG_OVERFLOW) == FLAG_OVERFLOW) {
        oldpc = pc;
        pc += reladdr;
        if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
            else clockticks6502++;
    }
}

// Assembly:
testb $0x40, 0x80f1c9(%rip)   # 0x821783
je 0x125f7
movzwl 0x80f1bb(%rip), %eax    # 0x82177e
movw %ax, 0x80f1c6(%rip)     # 0x821790
movzwl 0x80f1c3(%rip), %ecx    # 0x821794
addw %ax, %cx
movw %cx, 0x80f1a3(%rip)     # 0x82177e
xorl %ecx, %eax
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
movl 0x80f189(%rip), %eax    # 0x821774
sbbl $0x0, %eax
addl $0x2, %eax
movl %eax, 0x80f17d(%rip)    # 0x821774
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: bcc
static void bcc() {
    if ((status & FLAG_CARRY) == 0) {
        oldpc = pc;
        pc += reladdr;
        if ((oldpc & 0xFF00) != (pc & 0xFF00)) clockticks6502 += 2; //check if jump crossed a page boundary
            else clockticks6502++;
    }
}

// Assembly:
testb $0x1, 0x80f006(%rip)    # 0x821783
jne 0x127ba
movzwl 0x80eff8(%rip), %eax    # 0x82177e
movw %ax, 0x80f003(%rip)     # 0x821790
movzwl 0x80f000(%rip), %ecx    # 0x821794
addw %ax, %cx
movw %cx, 0x80efe0(%rip)     # 0x82177e
xorl %ecx, %eax
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
movl 0x80efc6(%rip), %eax    # 0x821774
sbbl $0x0, %eax
addl $0x2, %eax
movl %eax, 0x80efba(%rip)    # 0x821774
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: ldy
static void ldy() {
    penaltyop = 1;
    value = getvalue();
    y = (uint8_t)(value & 0x00FF);
   
    zerocalc(y);
    signcalc(y);
}

// Assembly:
movb $0x1, 0x80ef8e(%rip)    # 0x821786
movzbl 0x80ef86(%rip), %eax    # 0x821785
leaq 0x85aa(%rip), %rcx      # 0x1adb0
leaq -0xdd7(%rip), %rdx      # 0x11a36
cmpq %rdx, (%rcx,%rax,8)
je 0x12826
pushq %rax
movzwl 0x80ef77(%rip), %edi    # 0x821792
callq 0xe9ae
addq $0x8, %rsp
jmp 0x1282c
movb 0x80ef54(%rip), %al     # 0x821780
movzbl %al, %eax
movw %ax, 0x80ef60(%rip)     # 0x821796
movb %al, 0x80ef46(%rip)     # 0x821782
testb %al, %al
sete %cl
movb 0x80ef3c(%rip), %dl     # 0x821783
andb $0x7d, %dl
addb %cl, %cl
andb $-0x80, %al
orb %cl, %al
orb %dl, %al
movb %al, 0x80ef2b(%rip)     # 0x821783
retq
// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/fake6502.c
// Function: lda
static void lda() {
    penaltyop = 1;
    value = getvalue();
    a = (uint8_t)(value & 0x00FF);
   
    zerocalc(a);
    signcalc(a);
}

// Assembly:
movb $0x1, 0x80ef26(%rip)    # 0x821786
movzbl 0x80ef1e(%rip), %eax    # 0x821785
leaq 0x8542(%rip), %rcx      # 0x1adb0
leaq -0xe3f(%rip), %rdx      # 0x11a36
cmpq %rdx, (%rcx,%rax,8)
je 0x1288e
pushq %rax
movzwl 0x80ef0f(%rip), %edi    # 0x821792
callq 0xe9ae
addq $0x8, %rsp
jmp 0x12894
movb 0x80eeec(%rip), %al     # 0x821780
movzbl %al, %eax
movw %ax, 0x80eef8(%rip)     # 0x821796
movb %al, 0x80eedc(%rip)     # 0x821780
testb %al, %al
sete %cl
movb 0x80eed4(%rip), %dl     # 0x821783
andb $0x7d, %dl
addb %cl, %cl
andb $-0x80, %al
orb %cl, %al
orb %dl, %al
movb %al, 0x80eec3(%rip)     # 0x821783
retq