LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/stv0g[P]c11-queues/spsc_queue.c
// Function: spsc_queue_get_many
int spsc_queue_get_many(struct spsc_queue *q, void **ptrs[], size_t cnt)
{
	if (q->capacity <= spsc_queue_available(q))
		cnt = 0;
	else if (cnt > q->capacity - spsc_queue_available(q))
		cnt = q->capacity - spsc_queue_available(q);
	
	/**@todo Is atomic_load_explicit needed here for loading q->_head? */
	for (int i = 0; i < cnt; i++)
		ptrs[i] = &(q->pointers[q->_head % (q->capacity + 1)]);
	
	return cnt;
}

// Assembly:
movq %rdx, %rcx
movq 0x48(%rdi), %rdx
movl 0x50(%rdi), %r8d
movl 0x94(%rdi), %r9d
movl 0x94(%rdi), %eax
cmpl %r9d, %r8d
jge 0x169e
movl 0x50(%rdi), %r8d
notl %r8d
addl %r8d, %eax
jmp 0x16a8
movl 0x50(%rdi), %r8d
subl %r8d, %eax
addl 0x48(%rdi), %eax
movslq %eax, %r8
xorl %eax, %eax
cmpq %r8, %rdx
jbe 0x175e
movq 0x48(%rdi), %rdx
movl 0x50(%rdi), %r9d
movl 0x94(%rdi), %r10d
movl 0x94(%rdi), %r8d
cmpl %r10d, %r9d
jge 0x16dd
movl 0x50(%rdi), %r9d
notl %r9d
addl %r9d, %r8d
jmp 0x16e8
movl 0x50(%rdi), %r9d
subl %r9d, %r8d
addl 0x48(%rdi), %r8d
movslq %r8d, %r8
subq %r8, %rdx
cmpq %rcx, %rdx
jae 0x1729
movq 0x48(%rdi), %rcx
movl 0x50(%rdi), %r8d
movl 0x94(%rdi), %r9d
movl 0x94(%rdi), %edx
cmpl %r9d, %r8d
jge 0x1719
movl 0x50(%rdi), %r8d
notl %r8d
addl %r8d, %edx
jmp 0x1723
movl 0x50(%rdi), %r8d
subl %r8d, %edx
addl 0x48(%rdi), %edx
movslq %edx, %rdx
subq %rdx, %rcx
testq %rcx, %rcx
je 0x175e
leaq 0x98(%rdi), %r8
xorl %r9d, %r9d
movl 0x94(%rdi), %eax
cltq
movq 0x48(%rdi), %r10
incq %r10
xorl %edx, %edx
divq %r10
leaq (%r8,%rdx,8), %rax
movq %rax, (%rsi,%r9,8)
incq %r9
cmpq %r9, %rcx
jne 0x1738
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/stv0g[P]c11-queues/spsc_queue.c
// Function: spsc_queue_available
int spsc_queue_available(struct spsc_queue *q)
{
	if (atomic_load_explicit(&q->_tail, memory_order_acquire) < atomic_load_explicit(&q->_head, memory_order_acquire))
		return q->_head - q->_tail - 1;
	else
		return q->_head + (q->capacity - q->_tail);
}

// Assembly:
movl 0x50(%rdi), %ecx
movl 0x94(%rdi), %edx
movl 0x94(%rdi), %eax
cmpl %edx, %ecx
jge 0x177a
movl 0x50(%rdi), %ecx
notl %ecx
addl %ecx, %eax
retq
movl 0x50(%rdi), %ecx
subl %ecx, %eax
addl 0x48(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O3/stv0g[P]c11-queues/spsc_queue.c
// Function: spsc_queue_push_many
int spsc_queue_push_many(struct spsc_queue *q, void *ptrs[], size_t cnt)
{
	//int free_slots = q->_tail < q->_head ? q->_head - q->_tail - 1 : q->_head + (q->capacity - q->_tail);
	size_t free_slots = spsc_queue_available(q);
	
	if (cnt > free_slots)
		cnt = free_slots;
	
	for (size_t i = 0; i < cnt; i++) {
		q->pointers[q->_tail] = ptrs[i];
		atomic_store_explicit(&q->_tail, (q->_tail + 1)%(q->capacity + 1), memory_order_release);
	}
	
	return cnt;
}

// Assembly:
movq %rdx, %rcx
movl 0x50(%rdi), %edx
movl 0x94(%rdi), %r8d
movl 0x94(%rdi), %eax
cmpl %r8d, %edx
jge 0x17a4
movl 0x50(%rdi), %edx
notl %edx
addl %edx, %eax
jmp 0x17ac
movl 0x50(%rdi), %edx
subl %edx, %eax
addl 0x48(%rdi), %eax
cltq
cmpq %rcx, %rax
cmovbq %rax, %rcx
testq %rcx, %rcx
je 0x17ee
xorl %r8d, %r8d
movq (%rsi,%r8,8), %rax
movl 0x50(%rdi), %edx
movslq %edx, %rdx
movq %rax, 0x98(%rdi,%rdx,8)
movl 0x50(%rdi), %eax
cltq
incq %rax
movq 0x48(%rdi), %r9
incq %r9
xorl %edx, %edx
divq %r9
movl %edx, 0x50(%rdi)
incq %r8
cmpq %r8, %rcx
jne 0x17bd
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/stv0g[P]c11-queues/spsc_queue.c
// Function: spsc_queue_pull_many
int spsc_queue_pull_many(struct spsc_queue *q, void **ptrs[], size_t cnt)
{
	if (q->capacity <= spsc_queue_available(q))
		cnt = 0;
	else if (cnt > q->capacity - spsc_queue_available(q))
		cnt = q->capacity - spsc_queue_available(q);
	
	for (size_t i = 0; i < cnt; i++) {
		*ptrs[i] = q->pointers[q->_head];
		atomic_store_explicit(&q->_head, (q->_head + 1)%(q->capacity + 1), memory_order_release);
	}
	
	return cnt;
}

// Assembly:
movq %rdx, %rcx
movq 0x48(%rdi), %rdx
movl 0x50(%rdi), %r8d
movl 0x94(%rdi), %r9d
movl 0x94(%rdi), %eax
cmpl %r9d, %r8d
jge 0x181a
movl 0x50(%rdi), %r8d
notl %r8d
addl %r8d, %eax
jmp 0x1824
movl 0x50(%rdi), %r8d
subl %r8d, %eax
addl 0x48(%rdi), %eax
movslq %eax, %r8
xorl %eax, %eax
cmpq %r8, %rdx
jbe 0x18eb
movq 0x48(%rdi), %rdx
movl 0x50(%rdi), %r9d
movl 0x94(%rdi), %r10d
movl 0x94(%rdi), %r8d
cmpl %r10d, %r9d
jge 0x1859
movl 0x50(%rdi), %r9d
notl %r9d
addl %r9d, %r8d
jmp 0x1864
movl 0x50(%rdi), %r9d
subl %r9d, %r8d
addl 0x48(%rdi), %r8d
movslq %r8d, %r8
subq %r8, %rdx
cmpq %rcx, %rdx
jae 0x18a5
movq 0x48(%rdi), %rcx
movl 0x50(%rdi), %r8d
movl 0x94(%rdi), %r9d
movl 0x94(%rdi), %edx
cmpl %r9d, %r8d
jge 0x1895
movl 0x50(%rdi), %r8d
notl %r8d
addl %r8d, %edx
jmp 0x189f
movl 0x50(%rdi), %r8d
subl %r8d, %edx
addl 0x48(%rdi), %edx
movslq %edx, %rdx
subq %rdx, %rcx
testq %rcx, %rcx
je 0x18eb
xorl %r8d, %r8d
movl 0x94(%rdi), %eax
cltq
movq 0x98(%rdi,%rax,8), %rax
movq (%rsi,%r8,8), %rdx
movq %rax, (%rdx)
movl 0x94(%rdi), %eax
cltq
incq %rax
movq 0x48(%rdi), %r9
incq %r9
xorl %edx, %edx
divq %r9
movl %edx, 0x94(%rdi)
incq %r8
cmpq %r8, %rcx
jne 0x18ad
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Audio.cpp
// Function: Audio::createWav(char const*)
bool Audio::createWav(const char *fileName)
{
	WAVHEADER wav = {
		'R','I','F','F',
		0,
		'W','A','V','E','f','m','t',' ',
		16,
		1,
		1,
		0,
		0,
		2,
		16,
		'd','a','t','a',
		0
	};

	wav.nSamplesPerSec = sampleFrq;
	wav.nAvgBytesPerSec = wav.nSamplesPerSec * wav.nChannels * (wav.nBitsPerSample/8);

	if ((wavFileHandle = std::fopen(fileName, "wb"))) {
		if (std::fwrite(&wav, sizeof(wav), 1, wavFileHandle)) {
			recording = true;
		} else {
			std::fclose(wavFileHandle);
		}
	}
	return recording;
}

// Assembly:
subq $0x38, %rsp
movq %rsi, %rax
movups 0xb7ac(%rip), %xmm0     # 0xf04c
movups %xmm0, 0x1c(%rsp)
movups 0xb794(%rip), %xmm0     # 0xf040
movaps %xmm0, 0x10(%rsp)
movups 0xb778(%rip), %xmm0     # 0xf030
movaps %xmm0, (%rsp)
movl 0xc(%rdi), %ecx
movl %ecx, 0x18(%rsp)
addl %ecx, %ecx
movl %ecx, 0x1c(%rsp)
leaq 0xb793(%rip), %rsi      # 0xf063
movq %rax, %rdi
callq 0x3270
movq %rax, 0x219c9(%rip)     # 0x252a8
testq %rax, %rax
je 0x3913
movq %rsp, %rdi
movl $0x2c, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x33b0
testq %rax, %rax
je 0x3907
movb $0x1, 0x2199c(%rip)     # 0x252a1
jmp 0x3913
movq 0x2199a(%rip), %rdi     # 0x252a8
callq 0x3220
movb 0x21988(%rip), %al      # 0x252a1
addq $0x38, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Audio.cpp
// Function: Audio::closeWav()
void Audio::closeWav()
{
	while (usingFileHandle);
	if (wavFileHandle) {
		unsigned int foo = (unsigned int)(ftell(wavFileHandle) - 8);
		// RIFF chunk size
		std::fseek(wavFileHandle, 4, SEEK_SET);
		std::fwrite(&foo, sizeof(foo), 1, wavFileHandle);

		// data chunk size
		foo = foo - sizeof(WAVHEADER) + 8;
		std::fseek(wavFileHandle, sizeof(WAVHEADER) - sizeof(unsigned long), SEEK_SET);
		std::fwrite(&foo, sizeof(foo), 1, wavFileHandle);

		std::fclose(wavFileHandle);
		wavFileHandle = 0;
	}
	recording = false;	
}

// Assembly:
movq 0x21983(%rip), %rdi     # 0x252a8
testq %rdi, %rdi
je 0x39b9
pushq %rbx
subq $0x10, %rsp
callq 0x3030
addl $-0x8, %eax
leaq 0xc(%rsp), %rbx
movl %eax, (%rbx)
movq 0x2195f(%rip), %rdi     # 0x252a8
movl $0x4, %esi
xorl %edx, %edx
callq 0x3250
movq 0x2194c(%rip), %rcx     # 0x252a8
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x33b0
addl $-0x24, (%rbx)
movq 0x21930(%rip), %rdi     # 0x252a8
movl $0x24, %esi
xorl %edx, %edx
callq 0x3250
movq 0x2191d(%rip), %rcx     # 0x252a8
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x33b0
movq 0x21904(%rip), %rdi     # 0x252a8
callq 0x3220
movq $0x0, 0x218f4(%rip) # 0x252a8
addq $0x10, %rsp
popq %rbx
movb $0x0, 0x218e1(%rip)     # 0x252a1
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/AudioSDL.cpp
// Function: AudioSDL::setSampleRate(unsigned int)
void AudioSDL::setSampleRate(unsigned int newSampleRate)
{
	if (audiohwspec) {
		SDL_PauseAudio(1);
		unsigned int fadeoutTime = 1000 * bufferLength / audiohwspec->samples;
		SDL_Delay(fadeoutTime);
		SDL_CloseAudio();

		SDL_AudioSpec *obtained = new SDL_AudioSpec;
		audiohwspec->samples = newSampleRate;
		try {
			SDL_OpenAudio(audiohwspec, obtained);
			if (obtained) {
				SDL_AudioSpec *temp = audiohwspec;
				audiohwspec = obtained;
				delete temp;
			}
			SDL_PauseAudio(0);
		} catch (char *txt) {
			std::cerr << "Exception occurred: " << txt << std::endl;
		}
	} else {
	}
	Audio::setSampleRate(newSampleRate);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
cmpq $0x0, 0x10(%rdi)
je 0x3a8b
movl $0x1, %edi
callq 0x3190
imull $0x3e8, 0x8(%r14), %eax # imm = 0x3E8
movq 0x10(%r14), %rcx
movzwl 0x8(%rcx), %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edi
callq 0x3170
callq 0x3140
movl $0x20, %edi
callq 0x3230
movq %rax, %r15
movq 0x10(%r14), %rdi
movw %bx, 0x8(%rdi)
movq %rax, %rsi
callq 0x3310
movq 0x10(%r14), %rdi
movq %r15, 0x10(%r14)
movl $0x20, %esi
callq 0x3240
xorl %edi, %edi
callq 0x3190
movl %ebx, 0xc(%r14)
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
cmpl $0x1, %edx
jne 0x3ae6
movq %r15, %rdi
callq 0x30e0
movq %rax, %r15
movq 0x11541(%rip), %rdi     # 0x14ff0
leaq 0xb5b0(%rip), %rsi      # 0xf066
movl $0x14, %edx
callq 0x3260
movq 0x11529(%rip), %rdi     # 0x14ff0
movq %r15, %rsi
callq 0x3210
movq %rax, %rdi
callq 0x3110
callq 0x3330
jmp 0x3a8b
movq %rax, %r15
callq 0x3330
movq %r15, %rdi
callq 0x3360
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/AudioSDL.cpp
// Function: AudioSDL::~AudioSDL()
AudioSDL::~AudioSDL()
{
    SDL_PauseAudio(1);
    SDL_Delay(20);
	SDL_CloseAudio();
	SDL_Quit();
	if (audiohwspec)
		delete audiohwspec;
	if (ringBuffer)
		delete [] ringBuffer;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x10d9b(%rip), %rax     # 0x14ae8
movq %rax, (%rdi)
movl $0x1, %edi
callq 0x3190
movl $0x14, %edi
callq 0x3170
callq 0x3140
callq 0x33c0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x3d81
movl $0x20, %esi
callq 0x3240
leaq 0x21500(%rip), %rax     # 0x25288
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3d96
popq %rbx
jmp 0x32a0
popq %rbx
retq
movq %rax, %rdi
callq 0x3db7
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Cpu.cpp
// Function: CPU::CPU(MemoryHandler*, unsigned char*, unsigned char*)
CPU::CPU( MemoryHandler *memhandler, unsigned char *irqreg, unsigned char *cpustack ) : mem(memhandler), irq_register(irqreg), stack(cpustack)
{
	irq_sequence = 0;
	IRQcount = 0;
	cpu_jammed = false;
	PC = 0xFFFF;
	for( int i=0; i<nr_of_bps; i++) {
		bp[i].address = 0x10000;
		bp[i].enabled = false;
		bp[i].slot_free = true;
	}
	nr_activebps = 0;
	memset( stats, 0, sizeof(stats));
}

// Assembly:
leaq 0x10a09(%rip), %rax     # 0x14be0
movq %rax, (%rdi)
movq %rdx, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movq %rsi, 0x40(%rdi)
xorl %eax, %eax
movb %al, 0x38(%rdi)
movl $0x0, 0x24(%rdi)
movb %al, 0xa4(%rdi)
movl $0xffff, 0x10(%rdi)     # imm = 0xFFFF
movl $0x10000, 0x48(%rdi,%rax,8) # imm = 0x10000
movw $0x100, 0x4c(%rdi,%rax,8) # imm = 0x100
incq %rax
cmpq $0xb, %rax
jne 0x41ff
movl $0x0, 0xa0(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/./Cpu.h
// Function: CPU::ADC(unsigned char)
inline void CPU::ADC(const unsigned char value)
{
	if (ST&0x08) {
		unsigned int bin_adc = AC + value + (ST&0x01);
		unsigned char AL, AH;

		AL=(AC&0x0F) + (value & 0x0F) + (ST&0x01);
		AH=(AC >> 4) + (value >> 4 ) ;
		// fix lower nybble
		if (AL>9) {
			AL+=6;
			AH++;
		}
		// zero bit depends on the normal ADC...
		(bin_adc)&0xFF ? ST&=0xFD : ST|=0x02;
		// negative flag also...
		( AH & 0x08 ) ? ST|=0x80 : ST&=0x7F; 
		// V flag
		((((AH << 4) ^ AC) & 0x80) && !((AC ^ value) & 0x80)) ? SetVFlag() : ClearVFlag();
		// fix upper nybble
		if (AH>9) 
			AH+=6;
		// set the Carry if the decimal add has an overflow
		(AH > 0x0f) ? ST|=0x01 : ST&=0xFE;
		// calculate new AC value
		AC = (AH<<4)|(AL & 0x0F);
	} else {
		unsigned int bin_adc = AC + value + (ST&0x01);
		(bin_adc>=0x100) ? ST|=0x01 : ST&=0xFE;
		(!((AC ^ value) & 0x80) && ((AC ^ bin_adc) & 0x80) ) ? SetVFlag() : ClearVFlag();
		AC=(unsigned char) bin_adc;
		SETFLAGS_ZN(AC);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x18(%rdi), %eax
movzbl 0x1c(%rdi), %ecx
movl %eax, %edx
andl $0x1, %edx
leal (%rsi,%rcx), %r14d
addl %edx, %r14d
testb $0x8, %al
jne 0x80e1
movl %eax, %edx
andl $0xf6, %edx
orl $0x1, %eax
cmpl $0x100, %r14d           # imm = 0x100
cmovbl %edx, %eax
movl %eax, 0x18(%rbx)
xorl %ecx, %esi
cmpl $0x7f, %esi
ja 0x80d0
xorb %r14b, %cl
js 0x8198
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl 0x18(%rbx), %eax
jmp 0x819b
movl %ecx, %edi
andl $0xf, %edi
movl %esi, %r8d
andl $0xf, %r8d
addl %r8d, %edx
leal (%rdx,%rdi), %r8d
movl %ecx, %r9d
shrb $0x4, %r9b
movl %esi, %r10d
shrb $0x4, %r10b
addb %r9b, %r10b
cmpl $0xa, %r8d
sbbb $-0x1, %r10b
cmpl $0xa, %r8d
leal 0x6(%rdi,%rdx), %ebp
cmovbl %r8d, %ebp
movl %eax, %edx
orl $0x2, %edx
andl $0xfd, %eax
testb %r14b, %r14b
cmovel %edx, %eax
movzbl %r10b, %r14d
movl %eax, %edi
andl $0x7f, %edi
movl $0x80, %edx
orl %edx, %eax
testb $0x8, %r14b
cmovel %edi, %eax
movl %eax, 0x18(%rbx)
xorl %ecx, %esi
cmpl $0x7f, %esi
ja 0x815b
movl %r14d, %esi
shll $0x4, %esi
xorl %ecx, %esi
andl %edx, %esi
je 0x815b
orl $0x40, %eax
jmp 0x8167
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl 0x18(%rbx), %eax
leal 0x6(%r14), %ecx
cmpb $0xa, %r14b
movzbl %cl, %ecx
cmovbl %r14d, %ecx
movl %eax, %edx
andl $0xfe, %edx
orl $0x1, %eax
cmpb $0x10, %cl
cmovbl %edx, %eax
movl %eax, 0x18(%rbx)
shll $0x4, %ecx
andl $0xf, %ebp
orl %ecx, %ebp
movb %bpl, 0x1c(%rbx)
jmp 0x81ba
orl $0x40, %eax
movb %r14b, 0x1c(%rbx)
andl $0x7d, %eax
xorl %ecx, %ecx
testb %r14b, %r14b
sete %cl
andl $0x80, %r14d
leal (%r14,%rcx,2), %ecx
orl %eax, %ecx
movl %ecx, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/./Cpu.h
// Function: CPU::SBC(unsigned char)
inline void CPU::SBC(const unsigned char value)
{
	if (ST&0x08) { // if in decimal mode
		unsigned int bin_sbc = (AC - value - (1-(ST&0x01)));
		unsigned int dec_sbc = (AC & 0x0F) - (value & 0x0F) - (1-(ST&0x01));
		// Calculate the upper nybble.
		// fix upper nybble
		if (dec_sbc&0x10)
			dec_sbc = ((dec_sbc-6)&0x0F) | ((AC&0xF0) - (value&0xF0) - 0x10);
		else
			dec_sbc = (dec_sbc&0x0F) | ((AC&0xF0) - (value&0xF0));
		
		if (dec_sbc&0x100)
			dec_sbc-= 0x60;

		// all flags depend on the normal SBC...
		(bin_sbc<0x100) ? ST|=0x01 : ST&=0xFE ; // carry flag
		SETFLAGS_ZN( bin_sbc & 0xFF );
		((AC^bin_sbc)&0x80 && (AC^value)&0x80 ) ? SetVFlag() : ClearVFlag(); // V flag

		AC=(unsigned char) dec_sbc;

	} else {
		unsigned int bin_sbc = (AC - value - (1-(ST&0x01)));
		(bin_sbc<0x100) ? ST|=0x01 : ST&=0xFE;
		(((AC ^ value) & 0x80) && ((AC ^ bin_sbc) & 0x80) ) ? SetVFlag() : ClearVFlag();
		AC=(unsigned char) bin_sbc;
		SETFLAGS_ZN(AC);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x18(%rdi), %eax
movzbl 0x1c(%rdi), %ecx
movl %eax, %edx
orl $-0x2, %edx
incl %edx
movl %edx, %r14d
subl %esi, %r14d
addl %ecx, %r14d
testb $0x8, %al
jne 0x821e
movl %eax, %edx
andl $0xf6, %edx
orl $0x1, %eax
cmpl $0x100, %r14d           # imm = 0x100
cmovael %edx, %eax
movl %eax, 0x18(%rbx)
xorl %ecx, %esi
cmpl $0x80, %esi
jb 0x820d
xorb %r14b, %cl
js 0x82c4
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl 0x18(%rbx), %eax
jmp 0x82c7
movl %ecx, %edi
andl $0xf, %edi
movl %esi, %r8d
andl $0xf, %r8d
subl %r8d, %edx
addl %edi, %edx
testb $0x10, %dl
jne 0x8247
movl %ecx, %edi
andl $-0x10, %edi
movl %esi, %r8d
andl $-0x10, %r8d
subl %r8d, %edi
addl %edi, %edx
jmp 0x8261
addl $0xa, %edx
andl $0xf, %edx
movl %ecx, %edi
andl $-0x10, %edi
movl %esi, %r8d
andl $-0x10, %r8d
subl %r8d, %edi
addl %edi, %edx
addl $-0x10, %edx
leal 0xa0(%rdx), %ebp
btl $0x8, %edx
cmovael %edx, %ebp
movl %eax, %edx
andl $0x7c, %edx
orl $0x1, %eax
cmpl $0x100, %r14d           # imm = 0x100
cmovael %edx, %eax
andl $0x7d, %eax
xorl %edx, %edx
testb %r14b, %r14b
sete %dl
movl $0x80, %edi
movl %r14d, %r8d
andl %edi, %r8d
leal (%r8,%rdx,2), %edx
orl %eax, %edx
movl %edx, 0x18(%rbx)
xorl %ecx, %esi
cmpl %edi, %esi
jb 0x82b5
xorl %ecx, %r14d
andl %edi, %r14d
je 0x82b5
orl $0x40, %edx
movl %edx, 0x18(%rbx)
jmp 0x82be
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movb %bpl, 0x1c(%rbx)
jmp 0x82e6
orl $0x40, %eax
movb %r14b, 0x1c(%rbx)
andl $0x7d, %eax
xorl %ecx, %ecx
testb %r14b, %r14b
sete %cl
andl $0x80, %r14d
leal (%r14,%rcx,2), %ecx
orl %eax, %ecx
movl %ecx, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Filter.cpp
// Function: Filter::Filter(unsigned int, unsigned int, unsigned int)
Filter::Filter(unsigned int cutoffFrq, unsigned int sampleFrq, unsigned int order) : 
	order_((order >> 1) << 1),
	sampleFrq_(sampleFrq),
	windowTable_(0),
	sampleHistory_(0),
	precision_(12),
	mixingVolume(2.0)
{
#if 1
	setCutoffFrq(double(cutoffFrq)/double(sampleFrq));
#else
	setCutoffFrq(.000001);
#endif
}

// Assembly:
leaq 0xc90d(%rip), %rax      # 0x14c10
movq %rax, (%rdi)
andl $-0x2, %ecx
movl %ecx, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x20(%rdi)
movl %edx, 0x3c(%rdi)
movl $0xc, 0x40(%rdi)
movl %esi, %eax
cvtsi2sd %rax, %xmm0
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movl %edx, %ecx
cvtsi2sd %rcx, %xmm1
movq %rax, 0x48(%rdi)
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rdi)
jmp 0x8354
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Sid.cpp
// Function: SIDsound::SIDsound(unsigned int, unsigned int)
SIDsound::SIDsound(unsigned int model, unsigned int chnlDisableMask) : enableDigiBlaster(false)
{
	unsigned int i;

	// Link voices together
	for (i=0; i<3; i++) {
		voice[i].index = i;
		voice[i].modulatedBy = &voice[(i+2)%3]; // previous voice
		voice[i].modulatesThis = &voice[(i+1)%3]; // next voice
		voice[i].disabled = !!((chnlDisableMask >> i) & 1);
	}

	filterCutoff = 0;
	setModel(model);
	setFrequency(0);
	reset();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xc00f(%rip), %rax      # 0x14c40
movq %rax, (%rdi)
movb $0x0, 0x41b5(%rdi)
leaq 0x8(%rdi), %rax
xorl %r8d, %r8d
movl $0x2, %ecx
movq %rax, %rdi
xorl %r9d, %r9d
leal -0x1(%r8), %r10d
testq %r8, %r8
cmoveq %rcx, %r10
imulq $0x78, %r10, %r10
addq %rax, %r10
incq %r9
cmpq $0x3, %r9
movl $0x0, %r11d
cmovneq %r9, %r11
imulq $0x78, %r11, %r11
addq %rax, %r11
leal -0x1(%r9), %ebp
movzbl %bpl, %ebp
btl %ebp, %edx
setb 0x6c(%rdi)
movl %r8d, (%rdi)
movq %r10, 0x10(%rdi)
movq %r11, 0x18(%rdi)
addq $0x78, %rdi
movq %r9, %r8
cmpq $0x3, %r9
jne 0x8c4d
movl $0x0, 0x198(%rbx)
movq %rbx, %rdi
callq 0x87b8
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x28(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *0x10(%rax)
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Sid.cpp
// Function: SIDsound::reset()
void SIDsound::reset(void)
{
	volume = masterVolume;

	lastByteWritten = 0;

	for (int v=0; v<3; v++) {
		voice[v].wave = WAVE_NONE;
		voice[v].egState = EG_FROZEN;
		voice[v].accu = 0;
		voice[v].freq = voice[v].pw = 0;
		voice[v].envCurrLevel = voice[v].envSustainLevel = 0;
		voice[v].gate = voice[v].ring = voice[v].test = 0;
		voice[v].filter = voice[v].sync = 0;
		voice[v].muted = 0;
		// Initial value of internal shift register
		voice[v].shiftReg = 0x7FFFFC;
		voice[v].envExpCounter = 0;
		voice[v].envAttackAdd = voice[v].envDecaySub = voice[v].envReleaseSub = 0;
		voice[v].envCounterCompare = 0;
		voice[v].envCounter = 0x7fff;
	}

	filterType = FILTER_NONE;
	filterCutoff = filterResonance = 0;

	Vhp = Vbp = Vlp = 0;
	setFilterCutoff();
	setResonance();

	dcDigiBlaster = 0;
	clockDeltaRemainder = 0;
}

// Assembly:
movl 0x1d740(%rip), %eax     # 0x26410
movl %eax, 0x170(%rdi)
movb $0x0, 0x41b4(%rdi)
leaq 0xc(%rdi), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movaps 0x7503(%rip), %xmm1     # 0x101f0
xorl %edx, %edx
movq %rcx, (%rax,%rdx)
movl %ecx, 0x1c(%rax,%rdx)
movl %ecx, 0x6c(%rax,%rdx)
movups %xmm0, 0x54(%rax,%rdx)
movl %ecx, 0x64(%rax,%rdx)
movl $0x7ffffc, 0x24(%rax,%rdx) # imm = 0x7FFFFC
movq %rcx, 0x4c(%rax,%rdx)
movups %xmm0, 0x2c(%rax,%rdx)
movups %xmm1, 0x3c(%rax,%rdx)
addq $0x78, %rdx
cmpq $0x168, %rdx            # imm = 0x168
jne 0x8cef
xorl %eax, %eax
movb %al, 0x194(%rdi)
movb %al, 0x19c(%rdi)
movl %eax, 0x198(%rdi)
movl %eax, 0x41b0(%rdi)
movq $0x0, 0x41a8(%rdi)
movl 0x41b8(%rdi), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movupd 0x1a0(%rdi), %xmm1
mulsd 0x72dd(%rip), %xmm0     # 0x10048
movsd 0x7335(%rip), %xmm2     # 0x100a8
minsd %xmm0, %xmm2
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
mulpd 0x745d(%rip), %xmm1     # 0x101e0
cvttpd2dq %xmm1, %xmm0
movd %xmm0, %ecx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %edx
cmpl %edx, %ecx
cmovgl %edx, %ecx
movl %ecx, 0x41a4(%rdi)
movl $0x5a8, 0x41a0(%rdi)    # imm = 0x5A8
movl %eax, 0x18c(%rdi)
movl %eax, 0x178(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Sid.cpp
// Function: SIDsound::getWaveSample(SIDsound::SIDVoice&)
inline int SIDsound::getWaveSample(SIDVoice &v)
{
	switch (v.wave) {
		case WAVE_TRI:
			return waveTriangle(v);
		case WAVE_SAW:
			return waveSaw(v);
		case WAVE_PULSE:
			return wavePulse(v);
		case WAVE_TRISAW:
			return waveTriSaw(v);
		case WAVE_TRIPULSE:
			return waveTriPulse(v);
		case WAVE_SAWPULSE:
			return waveSawPulse(v);
		case WAVE_TRISAWPULSE:
			return waveTriSawPulse(v);
		case WAVE_NOISE:
			return v.waveNoiseOut;
		case WAVE_NONE:
			if (v.accu) {
				int rv = (v.accu >> 12);
				//v.accu >>= 1;
				//return rv;
			}
		default:
			return 0x000;
	}
}

// Assembly:
movl 0x4(%rdi), %eax
decl %eax
cmpl $0x7, %eax
ja 0x96fb
leaq 0x6e07(%rip), %rcx      # 0x103fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x5c(%rdi)
movl 0x20(%rdi), %ecx
movl %ecx, %eax
je 0x9612
movq 0x10(%rdi), %rax
movl 0x20(%rax), %eax
xorl %ecx, %eax
shll $0x8, %eax
sarl $0x1f, %eax
xorl %ecx, %eax
shrl $0xb, %eax
andl $0xfff, %eax            # imm = 0xFFF
retq
cmpl $0x0, 0x5c(%rdi)
movl 0x20(%rdi), %eax
movl %eax, %ecx
je 0x9637
movq 0x10(%rdi), %rcx
movl 0x20(%rcx), %ecx
xorl %eax, %ecx
shll $0x8, %ecx
sarl $0x1f, %ecx
xorl %eax, %ecx
shrl $0xb, %ecx
xorl %edx, %edx
cmpl 0x34(%rdi), %eax
movl $0xfff, %eax            # imm = 0xFFF
cmovbl %edx, %eax
orl 0x60(%rdi), %eax
jmp 0x9676
cmpl $0x0, 0x5c(%rdi)
movl 0x20(%rdi), %eax
movl %eax, %ecx
je 0x9668
movq 0x10(%rdi), %rcx
movl 0x20(%rcx), %ecx
xorl %eax, %ecx
shll $0x8, %ecx
sarl $0x1f, %ecx
xorl %eax, %ecx
shrl $0xb, %ecx
shrl $0xc, %eax
andl %ecx, %eax
jmp 0x96ed
movl 0x20(%rdi), %eax
xorl %ecx, %ecx
cmpl 0x34(%rdi), %eax
movl $0xfff, %eax            # imm = 0xFFF
cmovbl %ecx, %eax
orl 0x60(%rdi), %eax
retq
movl 0x2c(%rdi), %eax
retq
movl 0x20(%rdi), %eax
shrl $0xc, %eax
retq
movl 0x20(%rdi), %eax
movl %eax, %ecx
shrl $0xc, %ecx
xorl %edx, %edx
cmpl 0x34(%rdi), %eax
movl $0xfff, %eax            # imm = 0xFFF
cmovbl %edx, %eax
orl 0x60(%rdi), %eax
andl %ecx, %eax
jmp 0x96f2
cmpl $0x0, 0x5c(%rdi)
movl 0x20(%rdi), %edx
movl %edx, %ecx
je 0x96c9
movq 0x10(%rdi), %rax
movl 0x20(%rax), %ecx
xorl %edx, %ecx
shll $0x8, %ecx
sarl $0x1f, %ecx
xorl %edx, %ecx
shrl $0xb, %ecx
movl %edx, %eax
shrl $0xc, %eax
xorl %esi, %esi
cmpl 0x34(%rdi), %edx
movl $0xfff, %edx            # imm = 0xFFF
cmovbl %esi, %edx
orl 0x60(%rdi), %edx
andl %ecx, %eax
andl %edx, %eax
andl $0xfff, %eax            # imm = 0xFFF
movl %eax, %ecx
shrl %ecx
addl %eax, %eax
andl %ecx, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/SIDSoundLib.cpp
// Function: SIDSoundLib::SIDSoundLib(unsigned int)
SIDSoundLib::SIDSoundLib(unsigned int model) : SIDsound(model, 0)
{
	if (!detected)
		connect();
	if (detected) {
		sidCreate(sidBaseFreq, model, sidBaseFreq);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
xorl %edx, %edx
callq 0x8c24
leaq 0xb363(%rip), %rax      # 0x14cb8
movq %rax, (%rbx)
movb 0x1caba(%rip), %al      # 0x26418
testb %al, %al
jne 0x996d
callq 0x9744
movb 0x1caab(%rip), %al      # 0x26418
testb $0x1, %al
je 0x9981
movl 0x41c0(%rbx), %edi
movl %ebp, %esi
movl %edi, %edx
callq *0x1caa7(%rip)          # 0x26428
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x95a8
movq %r14, %rdi
callq 0x3360
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/SIDSoundLib.cpp
// Function: SIDSoundLib::~SIDSoundLib()
SIDSoundLib::~SIDSoundLib()
{
	sidDestroy();
	CLOSE_LIBRARY(m_hDll);
	m_hDll = NULL;
	detected = false;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xb313(%rip), %rax      # 0x14cb8
movq %rax, (%rdi)
callq *0x1ca82(%rip)          # 0x26430
movq 0x1ca6b(%rip), %rdi     # 0x26420
callq 0x31a0
movq $0x0, 0x1ca5b(%rip) # 0x26420
movb $0x0, 0x1ca4c(%rip)     # 0x26418
movq %rbx, %rdi
popq %rbx
jmp 0x95a8
movq %rax, %rdi
callq 0x3db7
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/SIDSoundLib.cpp
// Function: SIDSoundLib::setModel(unsigned int)
void SIDSoundLib::setModel(unsigned int model)
{
	if (model_ != model) {
		sidSetModel(model);
		sidReset();
		model_ = model;
	}
}

// Assembly:
cmpl %esi, 0x41bc(%rdi)
je 0x9a31
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edi
callq *0x1ca23(%rip)          # 0x26440
callq *0x1ca25(%rip)          # 0x26448
movl %ebx, 0x41bc(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::enableSidCard(unsigned int, unsigned int)
unsigned int TED::enableSidCard(unsigned int sidEmuType_, unsigned int disableMask)
{
	if (sidEmuType_) {
		if (sidEmuType != sidEmuType_) {
			delete sidCard;
			sidCard = 0;
		} else
			return sidEmuType;
		if (sidEmuType_ == 2 && SIDSoundLib::connect()) {
			sidCard = new SIDSoundLib(SID8580);
			sidEmuType = 2;
		}
		else {
			sidCard = new SIDsound(SID8580, disableMask);
			sidEmuType = 1;
		}
		sidCard->setSampleRate(TED_SOUND_CLOCK);
	} else {
		if (!sidCard)
			return 0;
		delete sidCard;
		sidCard = 0;
		sidEmuType = 0;
	}
	return sidEmuType;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x9cbf
movl %esi, %r14d
cmpl %esi, 0xb71d8(%rbx)
je 0x9d30
movl %edx, %ebp
movq 0xb71d0(%rbx), %rdi
testq %rdi, %rdi
je 0x9c83
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0xb71d0(%rbx)
cmpl $0x2, %r14d
jne 0x9ceb
callq 0x9744
testb %al, %al
je 0x9ceb
movl $0x41c8, %edi           # imm = 0x41C8
callq 0x3230
movq %rax, %r14
movl $0x2, %r15d
movq %rax, %rdi
movl $0x1, %esi
callq 0x993e
jmp 0x9d0d
movq 0xb71d0(%rbx), %rdi
xorl %r14d, %r14d
testq %rdi, %rdi
je 0x9d30
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0xb71d0(%rbx)
movl $0x0, 0xb71d8(%rbx)
jmp 0x9d30
movl $0x41c8, %edi           # imm = 0x41C8
callq 0x3230
movq %rax, %r14
movl $0x1, %r15d
movq %rax, %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0x8c24
movq %r14, 0xb71d0(%rbx)
movl %r15d, 0xb71d8(%rbx)
movq (%r14), %rax
movq %r14, %rdi
movl $0x361f0, %esi          # imm = 0x361F0
callq *0x30(%rax)
movl 0xb71d8(%rbx), %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9d40
movq %rax, %rbx
movl $0x41c8, %esi           # imm = 0x41C8
movq %r14, %rdi
callq 0x3240
movq %rbx, %rdi
callq 0x3360
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::Reset()
void TED::Reset()
{
	// clear RAM with powerup pattern
	for (int i = 0; i < RAMSIZE; i++)
		Ram[i] = (i >> 1) << 1 == i ? 0 : 0xFF;
	// reset oscillators
	oscillatorReset();
	if (sidCard) sidCard->reset();
	lastResetCycle = CycleCounter;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movdqa 0x675c(%rip), %xmm0     # 0x104c0
movl $0x45fc0, %eax          # imm = 0x45FC0
movdqa 0x675f(%rip), %xmm1     # 0x104d0
movdqa 0x6767(%rip), %xmm2     # 0x104e0
movdqa %xmm0, %xmm3
pand %xmm1, %xmm3
pxor %xmm4, %xmm4
psubb %xmm3, %xmm4
movdqu %xmm4, (%rbx,%rax)
paddb %xmm2, %xmm0
addq $0x10, %rax
cmpq $0x55fc0, %rax          # imm = 0x55FC0
jne 0x9d79
movq %rbx, %rdi
callq 0xbd5c
movq 0xb71d0(%rbx), %rdi
testq %rdi, %rdi
je 0x9db8
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x1c6b9(%rip), %rax     # 0x26478
movq %rax, 0xb61a0(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::ChangeMemBankSetup(bool)
void TED::ChangeMemBankSetup(bool romoff)
{
	if (romoff) {
		mem_8000_bfff = actram + (0x8000 & RAMMask);
		mem_fc00_fcff = mem_c000_ffff = actram + (0xC000 & RAMMask);
	} else {
		mem_8000_bfff = actromlo;
		mem_c000_ffff = actromhi;
		mem_fc00_fcff = &(RomHi[0][0]);
	}
}

// Assembly:
testl %esi, %esi
je 0x9e1e
movq 0xb6010(%rdi), %rcx
movl 0x76008(%rdi), %eax
movl %eax, %edx
andl $0x8000, %edx           # imm = 0x8000
addq %rcx, %rdx
andl $0xc000, %eax           # imm = 0xC000
addq %rcx, %rax
movq %rax, %xmm1
movq %rdx, %xmm0
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
jmp 0x9e2d
movdqu 0x75fe0(%rdi), %xmm0
leaq 0x55fc0(%rdi), %rax
movdqu %xmm0, 0x75ff0(%rdi)
movq %rax, 0x76000(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::texttoscreen(int, int, char const*)
void TED::texttoscreen(int x,int y, const char *scrtxt)
{
	int i =0;

	while (scrtxt[i]) {
		chrtoscreen(x + i * 8, y, scrtxt[i]);
		i++;
	}
}

// Assembly:
movb (%rcx), %al
testb %al, %al
je 0x9e80
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
incq %rbx
movsbl %al, %ecx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x9e82
movb (%rbx), %al
addl $0x8, %r14d
incq %rbx
testb %al, %al
jne 0x9e59
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::chrtoscreen(int, int, char)
void TED::chrtoscreen(int x,int y, char scrchr)
{
	int j, k;
	unsigned char *charset = (unsigned char *) kernal+0x1000;

	if (isalpha(scrchr)) {
		scrchr=toupper(scrchr)-64;
		charset+=(scrchr<<3);
		for (j=0;j<8;j++)
			for (k=0;k<8;k++)
				(*(charset+j) & (0x80>>k)) ? screen[(y+j)*456+x+k]=0x00 : screen[(y+j)*456+x+k]=0x71;
		return;
	}
	charset+=(scrchr<<3);
	for (j=0;j<8;j++)
		for (k=0;k<8;k++)
			(*(charset+j) & (0x80>>k)) ? screen[(y+j)*456+x+k]=0x00 : screen[(y+j)*456+x+k]=0x71;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl %ecx, %edi
callq 0x3320
testl %eax, %eax
je 0x9f46
movl %r15d, %edi
callq 0x3390
shll $0x18, %eax
addl $0xc0000000, %eax       # imm = 0xC0000000
sarl $0x15, %eax
cltq
leaq 0xf351(%rip), %rcx      # 0x19210
addq %rcx, %rax
addq $0x1000, %rax           # imm = 0x1000
movslq %r14d, %rcx
movslq %ebp, %rdx
imulq $0x1c8, %rcx, %rcx      # imm = 0x1C8
addq %rdx, %rcx
addq %rbx, %rcx
addq $0x824, %rcx            # imm = 0x824
xorl %edx, %edx
movdqa 0x6604(%rip), %xmm0     # 0x104f0
movdqa 0x660c(%rip), %xmm1     # 0x10500
pxor %xmm2, %xmm2
movdqa 0x6610(%rip), %xmm3     # 0x10510
movzbl (%rax,%rdx), %esi
movd %esi, %xmm4
pshufd $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
movdqa %xmm4, %xmm5
pand %xmm0, %xmm5
pand %xmm1, %xmm4
pcmpeqd %xmm2, %xmm4
pcmpeqd %xmm2, %xmm5
packssdw %xmm4, %xmm5
packsswb %xmm5, %xmm5
pand %xmm3, %xmm5
movq %xmm5, (%rcx)
incq %rdx
addq $0x1c8, %rcx            # imm = 0x1C8
cmpq $0x8, %rdx
jne 0x9f00
jmp 0x9fd3
movslq %r15d, %rax
leaq 0xf2c0(%rip), %rcx      # 0x19210
leaq (%rcx,%rax,8), %rax
addq $0x1000, %rax           # imm = 0x1000
movslq %r14d, %rcx
movslq %ebp, %rdx
imulq $0x1c8, %rcx, %rcx      # imm = 0x1C8
addq %rdx, %rcx
addq %rbx, %rcx
addq $0x824, %rcx            # imm = 0x824
xorl %edx, %edx
movdqa 0x6572(%rip), %xmm0     # 0x104f0
movdqa 0x657a(%rip), %xmm1     # 0x10500
pxor %xmm2, %xmm2
movdqa 0x657e(%rip), %xmm3     # 0x10510
movzbl (%rax,%rdx), %esi
movd %esi, %xmm4
pshufd $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
movdqa %xmm4, %xmm5
pand %xmm0, %xmm5
pand %xmm1, %xmm4
pcmpeqd %xmm2, %xmm4
pcmpeqd %xmm2, %xmm5
packssdw %xmm4, %xmm5
packsswb %xmm5, %xmm5
pand %xmm3, %xmm5
movq %xmm5, (%rcx)
incq %rdx
addq $0x1c8, %rcx            # imm = 0x1C8
cmpq $0x8, %rdx
jne 0x9f92
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::loadroms()
void TED::loadroms()
{
	for (int i=0;i<4;i++) {
		loadhiromfromfile(i,romhighpath[i]);
		loadloromfromfile(i,romlopath[i]);
	}
	mem_8000_bfff = actromlo = &(RomLo[0][0]);
	mem_fc00_fcff = mem_c000_ffff = actromhi = &(RomHi[0][0]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x41b(%rdi), %r14
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0xa058
leaq -0x400(%r14), %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0xa142
incq %r15
addq $0x100, %r14            # imm = 0x100
cmpq $0x4, %r15
jne 0x9ff0
leaq 0x65fe0(%rbx), %rax
movq %rax, 0x75fe0(%rbx)
movq %rax, 0x75ff0(%rbx)
leaq 0x55fc0(%rbx), %rax
movq %rax, 0x75fe8(%rbx)
movq %rax, 0x75ff8(%rbx)
movq %rax, 0x76000(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::loadhiromfromfile(int, char*)
void TED::loadhiromfromfile(int nr, char fname[512])
{
	FILE	*img;

	if (fname[0]!='\0') {
		if (img = fopen(fname, "rb")) {
			// load high ROM file
			fread(&(RomHi[nr]),ROMSIZE,1,img);
			fclose(img);
			return;
		}
		switch (nr) {
			case 0:
				memcpy(&(RomHi[0]),kernal,ROMSIZE);
				break;
			case 1: if (!strncmp(fname,"3PLUS1HIGH",10))
						memcpy(&(RomHi[1]),plus4hi,ROMSIZE);
					else
						memset(&(RomHi[1]),0,ROMSIZE);
				break;
			default : memset(&(RomHi[nr]),0,ROMSIZE);
		}
	} else
		memset(&(RomHi[nr]),0,ROMSIZE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, (%rdx)
je 0xa0d2
movq %rdx, %r14
leaq 0x5099(%rip), %rsi      # 0xf10c
movq %rdx, %rdi
callq 0x3270
testq %rax, %rax
je 0xa0b9
movq %rax, %r15
movslq %ebp, %rax
shlq $0xe, %rax
leaq (%rbx,%rax), %rdi
addq $0x55fc0, %rdi          # imm = 0x55FC0
movl $0x4000, %esi           # imm = 0x4000
movl $0x1, %edx
movq %r15, %rcx
callq 0x32e0
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3220
cmpl $0x1, %ebp
je 0xa0fa
testl %ebp, %ebp
jne 0xa0d2
addq $0x55fc0, %rbx          # imm = 0x55FC0
leaq 0xf140(%rip), %rsi      # 0x19210
jmp 0xa12a
movslq %ebp, %rax
shlq $0xe, %rax
leaq (%rbx,%rax), %rdi
addq $0x55fc0, %rdi          # imm = 0x55FC0
movl $0x4000, %edx           # imm = 0x4000
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3130
leaq 0x66e3(%rip), %rsi      # 0x107e4
movl $0xa, %edx
movq %r14, %rdi
callq 0x3100
addq $0x59fc0, %rbx          # imm = 0x59FC0
testl %eax, %eax
je 0xa123
movl $0x4000, %edx           # imm = 0x4000
movq %rbx, %rdi
jmp 0xa0e9
leaq 0x130e6(%rip), %rsi     # 0x1d210
movl $0x4000, %edx           # imm = 0x4000
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::loadloromfromfile(int, char*)
void TED::loadloromfromfile(int nr, char fname[512])
{
	FILE			*img;

	if (fname[0]!='\0') {
		if (img = fopen(fname, "rb")) {
			// load low ROM file
			fread(&(RomLo[nr]),ROMSIZE,1,img);
			fclose(img);
			return;
		}
		switch (nr) {
			case 0: memcpy(&(RomLo[0]),basic,ROMSIZE);
				break;
			case 1: if (!strncmp(fname,"3PLUS1LOW",9))
						memcpy(&(RomLo[1]),plus4lo,ROMSIZE);
					else
						memset(&(RomLo[1]),0,ROMSIZE);
				break;
			default : memset(&(RomLo[nr]),0,ROMSIZE);
		}
	} else
		memset(&(RomLo[nr]),0,ROMSIZE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, (%rdx)
je 0xa1bc
movq %rdx, %r14
leaq 0x4faf(%rip), %rsi      # 0xf10c
movq %rdx, %rdi
callq 0x3270
testq %rax, %rax
je 0xa1a3
movq %rax, %r15
movslq %ebp, %rax
shlq $0xe, %rax
leaq (%rbx,%rax), %rdi
addq $0x65fe0, %rdi          # imm = 0x65FE0
movl $0x4000, %esi           # imm = 0x4000
movl $0x1, %edx
movq %r15, %rcx
callq 0x32e0
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3220
cmpl $0x1, %ebp
je 0xa1e4
testl %ebp, %ebp
jne 0xa1bc
addq $0x65fe0, %rbx          # imm = 0x65FE0
leaq 0xb056(%rip), %rsi      # 0x15210
jmp 0xa214
movslq %ebp, %rax
shlq $0xe, %rax
leaq (%rbx,%rax), %rdi
addq $0x65fe0, %rdi          # imm = 0x65FE0
movl $0x4000, %edx           # imm = 0x4000
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3130
leaq 0x65ef(%rip), %rsi      # 0x107da
movl $0x9, %edx
movq %r14, %rdi
callq 0x3100
addq $0x69fe0, %rbx          # imm = 0x69FE0
testl %eax, %eax
je 0xa20d
movl $0x4000, %edx           # imm = 0x4000
movq %rbx, %rdi
jmp 0xa1d3
leaq 0x16ffc(%rip), %rsi     # 0x21210
movl $0x4000, %edx           # imm = 0x4000
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::copyToKbBuffer(char*, unsigned int)
void TED::copyToKbBuffer(char *bufferString, unsigned int bufferLength)
{
	unsigned int bufferAddress = 0x0527;
	if (bufferLength == -1U) bufferLength = (unsigned int) strlen(bufferString);

	for (unsigned int i=0; i < bufferLength; i++)
		Write( bufferAddress + i, bufferString[i]);

	Write(0xEF, bufferLength);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
cmpl $-0x1, %edx
jne 0xa282
movq %r14, %rdi
callq 0x30f0
movq %rax, %r15
testl %r15d, %r15d
je 0xa2a9
movl %r15d, %r12d
xorl %r13d, %r13d
leal 0x527(%r13), %esi
movzbl (%r14,%r13), %edx
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
incq %r13
cmpq %r13, %r12
jne 0xa28d
movq (%rbx), %rax
movq (%rax), %rax
movzbl %r15b, %edx
movq %rbx, %rdi
movl $0xef, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::~TED()
TED::~TED()
{
	if (filter)
		delete filter;

	if (sidCard)
		enableSidCard(0, 0);

}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x9033(%rip), %rax      # 0x14d38
movq %rax, (%rdi)
movq 0x65fd8(%rdi), %rdi
testq %rdi, %rdi
je 0xbd1a
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xb71d0(%rbx), %rdi
testq %rdi, %rdi
je 0xbd41
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0xb71d0(%rbx)
movl $0x0, 0xb71d8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::oscillatorReset()
void TED::oscillatorReset()
{
	FlipFlop[0] = dcOutput[0] = 0;
	FlipFlop[1] = dcOutput[1] = 0;
	oscCount[0] = 0;
	oscCount[1] = 0;
	NoiseCounter = 0;
	Freq1 = Freq2 = 0;
	DAStatus = Snd1Status = Snd2Status = SndNoiseStatus = 0;
}

// Assembly:
xorl %eax, %eax
movl %eax, 0x1a780(%rip)     # 0x264e4
movl %eax, 0x1a782(%rip)     # 0x264ec
movl %eax, 0x1a778(%rip)     # 0x264e8
movl %eax, 0x1a77a(%rip)     # 0x264f0
movq $0x0, 0x1a777(%rip) # 0x264f8
movl %eax, 0x1a779(%rip)     # 0x26500
movw %ax, 0x1a776(%rip)      # 0x26504
movw %ax, 0x1a771(%rip)      # 0x26506
movl %eax, 0x1a76d(%rip)     # 0x26508
movl %eax, 0x1a76b(%rip)     # 0x2650c
movl %eax, 0x1a769(%rip)     # 0x26510
movl %eax, 0x1a767(%rip)     # 0x26514
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::writeSoundReg(unsigned int, unsigned char)
void TED::writeSoundReg(unsigned int reg, unsigned char value)
{
#if defined(_DEBUG) && 0
	static FILE *f = std::fopen("freqlog.txt", "a");
	if (f)
		std::fprintf(f, "%04X <- %02X in cycle %llu", 0xff0e + reg, value, CycleCounter);
	fprintf(f, "\n");
#endif

	switch (reg) {
		case 0:
			Freq1 = (Freq1 & 0x300) | value;
			setFreq(0, Freq1);
			break;
		case 1:
			Freq2 = (Freq2 & 0x300) | value;
			setFreq(1, Freq2);
			break;
		case 2:
			Freq2 = (Freq2 & 0xFF) | (value << 8);
			setFreq(1, Freq2);
			break;
		case 3:
			if ((DAStatus = value & 0x80)) {
				FlipFlop[0] = 1;
				FlipFlop[1] = 1;
				oscCount[0] = OscReload[0];
				oscCount[1] = OscReload[1];
				NoiseCounter = 0;
			}
			Volume = value & 0x0F;
			if (Volume > 8) Volume = 8;
			Volume = (Volume << 9);
			Snd1Status = value & 0x10;
			Snd2Status = value & 0x20;
			SndNoiseStatus = value & 0x40;
			break;
		case 4:
			Freq1 = (Freq1 & 0xFF) | (value << 8);
			setFreq(0, Freq1);
			break;
	}
}

// Assembly:
cmpl $0x4, %esi
ja 0xc07f
movl %esi, %eax
leaq 0x4900(%rip), %rcx      # 0x10920
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x1a4d6(%rip), %eax     # 0x26506
andl $0x300, %eax            # imm = 0x300
movzbl %dl, %ecx
leal (%rax,%rcx), %edx
movw %dx, 0x1a4c4(%rip)      # 0x26506
jmp 0xc05e
movzbl 0x1a4bb(%rip), %eax     # 0x26506
movzbl %dl, %ecx
shll $0x8, %ecx
leal (%rax,%rcx), %edx
movw %dx, 0x1a4ab(%rip)      # 0x26506
movzwl %dx, %edx
xorl %esi, %esi
cmpl $0x3fe, %edx            # imm = 0x3FE
sete %sil
movl %esi, 0x1a474(%rip)     # 0x264e4
addl %ecx, %eax
incl %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, 0x1a6a9(%rip)     # 0x26728
retq
movzbl 0x1a47d(%rip), %eax     # 0x26504
movzbl %dl, %ecx
shll $0x8, %ecx
leal (%rax,%rcx), %edx
movw %dx, 0x1a46d(%rip)      # 0x26504
movzwl %dx, %edx
jmp 0xc12d
movzbl %dl, %eax
movl %eax, %ecx
andl $0x80, %ecx
movl %ecx, 0x1a464(%rip)     # 0x26514
je 0xc0db
movl $0x1, %ecx
movl %ecx, 0x1a42f(%rip)     # 0x264ec
movl %ecx, 0x1a42d(%rip)     # 0x264f0
movq 0x1a65e(%rip), %rcx     # 0x26728
movq %rcx, 0x1a427(%rip)     # 0x264f8
movl $0x0, 0x1a425(%rip)     # 0x26500
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x8, %ecx
movl $0x8, %edx
cmovbl %ecx, %edx
shll $0x9, %edx
movl %edx, 0x1a63c(%rip)     # 0x26730
movl %eax, %ecx
andl $0x10, %ecx
movl %ecx, 0x1a411(%rip)     # 0x26510
movl %eax, %ecx
andl $0x20, %ecx
movl %ecx, 0x1a402(%rip)     # 0x2650c
andl $0x40, %eax
movl %eax, 0x1a3f5(%rip)     # 0x26508
retq
movzwl 0x1a3e9(%rip), %eax     # 0x26504
andl $0x300, %eax            # imm = 0x300
movzbl %dl, %ecx
leal (%rax,%rcx), %edx
movw %dx, 0x1a3d7(%rip)      # 0x26504
xorl %esi, %esi
cmpl $0x3fe, %edx            # imm = 0x3FE
sete %sil
movl %esi, 0x1a3a9(%rip)     # 0x264e8
addl %ecx, %eax
incl %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, 0x1a5de(%rip)     # 0x2672c
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::storeToBuffer(short*, unsigned int)
void TED::storeToBuffer(short *buffer, unsigned int count)
{
	static double			lp_accu = 0;
	static double			hp_accu = 0;

	const double hptc = 20000.0/1000000;		// 6000us (est) maybe 7000 ?
	const double hpc = 1.0/(hptc * sampleRate * 2.0);	// 2*pi*fc=1/tau..
	
	// TODO: a proper windowed lowpass FIR filter
#if 0
	const double lpc = 1.0 - exp( - double(sampleRate) / 2.0 / double(TED_SOUND_CLOCK));
	do {
		double accu = (double) *buffer;
		// apply low pass filter -> lp_accu = lpc*accu + (1-lpc)*lp_accu
		lp_accu += lpc * (accu - lp_accu);
		accu = lp_accu - hp_accu;
		// update hp filter pole
		hp_accu +=  hpc * accu;
		// fill the buffer
		*buffer++ = ((short)accu);
	} while(--count);
#else
	do {
		double accu = (double) filter->lowPass(*buffer);
		accu = accu - hp_accu;
		// update hp filter pole
		hp_accu +=  hpc * accu;
		// fill the buffer
		*buffer++ = (short)accu;
	} while(--count);
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xb71c8(%rdi), %eax
cvtsi2sd %rax, %xmm0
movq %rsi, %r14
mulsd 0x47e7(%rip), %xmm0     # 0x10958
addsd %xmm0, %xmm0
movsd 0x2e93(%rip), %xmm1     # 0xf010
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movl %edx, %r15d
xorl %r12d, %r12d
movq 0x65fd8(%rbx), %rdi
movswl (%r14,%r12,2), %esi
callq 0x8766
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x1a58b(%rip), %xmm1    # 0x26738
subsd %xmm1, %xmm0
movsd (%rsp), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm0, %eax
movsd %xmm2, 0x1a56e(%rip)    # 0x26738
movw %ax, (%r14,%r12,2)
incq %r12
cmpl %r12d, %r15d
jne 0xc18c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::setMasterVolume(unsigned int)
void TED::setMasterVolume(unsigned int shift)
{
	if (!shift)
		masterVolume = 0;
	else
		masterVolume = AMP(shift);
}

// Assembly:
testl %esi, %esi
je 0xc786
pushq %rax
movl %esi, %eax
cvtsi2sd %rax, %xmm0
movsd 0x392a(%rip), %xmm1     # 0x10098
callq 0x3350
mulsd 0x41e5(%rip), %xmm0     # 0x10960
cvttsd2si %xmm0, %rax
addq $0x8, %rsp
jmp 0xc788
xorl %eax, %eax
movl %eax, 0x19d52(%rip)     # 0x264e0
retq
nop
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::initFilter(unsigned int, unsigned int)
void TED::initFilter(unsigned int sampleRate_, unsigned int filterOrder_)
{
	if (filter)
		delete filter;
	filter = new Filter(sampleRate_ / 2, TED_SOUND_CLOCK, filterOrder_);
	filter->reCalcWindowTable();
	filterOrder = filterOrder_;
	sampleRate = sampleRate_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movq 0x65fd8(%rdi), %rdi
testq %rdi, %rdi
je 0xc80e
movq (%rdi), %rax
callq *0x8(%rax)
movl $0x50, %edi
callq 0x3230
movq %rax, %r15
movl %ebx, %esi
shrl %esi
movq %rax, %rdi
movl $0x361f0, %edx          # imm = 0x361F0
movl %ebp, %ecx
callq 0x82fc
movq %r15, 0x65fd8(%r14)
movq %r15, %rdi
callq 0x8354
movl %ebp, 0xb71cc(%r14)
movl %ebx, 0xb71c8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x50, %esi
movq %r15, %rdi
callq 0x3240
movq %rbx, %rdi
callq 0x3360
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/tedplay.cpp
// Function: tedShowScreenData(char*)
void tedShowScreenData(char* out)
{
	const bool isCaps = !(ted->Read(0xFF13) & 4);
	const unsigned int pageAddr = (ted->Read(0xFF14) & 0xF8) << 8;
	unsigned char* in = ted->Ram + (pageAddr | 0x400);
	unsigned int i, j;
	for (i = 0; i < 25; i++) {
		for (j = 0; j < 40; j++) {
			*out++ = convertToAscii(*in, isCaps);
			in++;
		}
		*out++ = '\r';
		*out++ = '\n';
	}
	*out++ = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x19d2b(%rip), %rdi     # 0x26df0
movq (%rdi), %rax
movl $0xff13, %esi           # imm = 0xFF13
callq *0x8(%rax)
movl %eax, %ebx
movq 0x19d17(%rip), %rdi     # 0x26df0
movq (%rdi), %rax
movl $0xff14, %esi           # imm = 0xFF14
callq *0x8(%rax)
andb $-0x8, %al
movzbl %al, %eax
shll $0x8, %eax
movq 0x19cfd(%rip), %rcx     # 0x26df0
leaq (%rcx,%rax), %r15
addq $0x463c0, %r15          # imm = 0x463C0
xorl %r12d, %r12d
movq %r14, %r13
xorl %ebp, %ebp
xorl %esi, %esi
testb $0x4, %bl
sete %sil
movzbl (%r15,%rbp), %edi
callq 0xd159
movb %al, (%r13,%rbp)
incq %rbp
cmpl $0x28, %ebp
jne 0xd106
leaq 0x2(,%rbp), %r14
addq %r13, %r14
movw $0xa0d, -0x2(%r14)      # imm = 0xA0D
incl %r12d
addq %rbp, %r15
cmpl $0x19, %r12d
jne 0xd101
movb $0x0, 0x2(%r13,%rbp)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/tedplay.cpp
// Function: convertToAscii(unsigned char, bool)
static char convertToAscii(unsigned char c, bool isCaps)
{
	char rv = 0x20;
	
	if (c == 0)
		rv = ' ';
	else if (isCaps) {
		if (c <= 0x1F)
			rv = c ^ 0x40;
		else if (c >= 0x60 && c <= 0x7F)
			rv = c - 0x20;
		else
			rv = c;
	}
	else {
		if (c >= 0x01 && c <= 0x1A)
			rv = c ^ 0x60;
		else if (c >= 0x1B && c <= 0x1F)
			rv = c ^ 0x40;
		else if (c == 0)
			rv = 64;
		else if (c >= 0x41 && c <= 0x5A)
			rv = c ^ 0x20;
		else if (c >= 0xC1 && c <= 0xDA)
			rv = c ^ 0x80;
		else
			rv = c;
	}
	return rv;
}

// Assembly:
testl %edi, %edi
je 0xd177
movl %edi, %eax
testb %sil, %sil
je 0xd17a
cmpb $0x1f, %al
jbe 0xd185
leal -0x20(%rax), %ecx
cmpb $0x60, %al
movzbl %al, %edx
movzbl %cl, %eax
cmovll %edx, %eax
retq
movb $0x20, %al
retq
cmpb $0x1a, %al
ja 0xd181
orb $0x60, %al
retq
cmpb $0x1f, %al
ja 0xd188
orb $0x40, %al
retq
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0xd193
orb $0x20, %al
retq
leal 0x3f(%rax), %ecx
movzbl %al, %edx
andb $0x5f, %al
cmpb $0x1a, %cl
movzbl %al, %eax
cmovael %edx, %eax
retq