LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: combine
void combine(const char *in_even_fname, const char *in_odd_fname, const char *out_fname, int bytes)
{
	int c;
	FILE *fin_odd, *fin_even, *fout;
	fout = fopen(out_fname, "wb");
	if (!fout)
	{
		fprintf(stderr, "Couldn't open %s.\n", out_fname);
		return;
	}
	fin_even = fopen(in_even_fname, "rb");
	if (!fin_even)
	{
		fprintf(stderr, "Couldn't open %s.\n", in_even_fname);
		fclose(fout);
		return;
	}
	fin_odd = fopen(in_odd_fname, "rb");
	if (!fin_odd)
	{
		fprintf(stderr, "Couldn't open %s.\n", in_odd_fname);
		fclose(fin_even);
		fclose(fout);
		return;
	}

	do
	{
		for (int i = 0; i < bytes; i++)
		{
			c = fgetc(fin_even);
			if (c != EOF)
			{
				fputc(c, fout);
			}
		}

		for (int i = 0; i < bytes; i++)
		{
			c = fgetc(fin_odd);
			if (c != EOF)
			{
				fputc(c, fout);
			}
		}
	} while (c != EOF);

	fclose(fout);
	fclose(fin_even);
	fclose(fin_odd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
leaq 0xce1(%rip), %rsi       # 0x201a
movq %rdx, %rdi
callq 0x10a0
testq %rax, %rax
je 0x13fd
movq %rax, %rbx
leaq 0xcb0(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x1426
movq %rax, %r14
leaq 0xc95(%rip), %rsi       # 0x2004
movq %r12, %rdi
callq 0x10a0
testq %rax, %rax
je 0x1443
movq %rax, %r15
movl %ebp, %r13d
testl %ebp, %ebp
jle 0x13d1
movq %r14, %rdi
callq 0x1060
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x13a5
movl %r12d, %edi
movq %rbx, %rsi
callq 0x1070
decl %r13d
jne 0x138a
movl %ebp, %r13d
testl %ebp, %ebp
jle 0x13d1
movq %r15, %rdi
callq 0x1060
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x13cc
movl %r12d, %edi
movq %rbx, %rsi
callq 0x1070
decl %r13d
jne 0x13b1
cmpl $-0x1, %r12d
jne 0x1383
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1040
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040
movq 0x2bf4(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xbf9(%rip), %rsi       # 0x2007
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1080
movq 0x2bcb(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xbd0(%rip), %rsi       # 0x2007
movq %r15, %rdx
xorl %eax, %eax
callq 0x1080
jmp 0x1466
movq 0x2bae(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xbb3(%rip), %rsi       # 0x2007
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
movq %r14, %rdi
callq 0x1040
movq %rbx, %rdi
jmp 0x13ea
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: exchange
void exchange(const char *in_fname, const char *out_fname)
{
	int c;
	uint8_t byte[2];
	FILE *fin, *fout;
	fout = fopen(out_fname, "wb");
	if (!fout)
	{
		fprintf(stderr, "Couldn't open %s.\n", out_fname);
		return;
	}
	fin = fopen(in_fname, "rb");
	if (!fin)
	{
		fprintf(stderr, "Couldn't open %s.\n", in_fname);
		fclose(fout);
		return;
	}

	do
	{
		c = fgetc(fin);
		if (c == EOF)
		{
			break;
		}
		byte[0] = c;
		c = fgetc(fin);
		if (c == EOF)
		{
			break;
		}
		byte[1] = c;

		fputc(byte[1], fout);
		fputc(byte[0], fout);
	} while (c != EOF);

	fclose(fout);
	fclose(fin);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xb98(%rip), %rsi       # 0x201a
movq %r14, %rdi
callq 0x10a0
testq %rax, %rax
je 0x1516
movq %rax, %rbx
leaq 0xb67(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x153b
movq %rax, %r14
movq %rax, %rdi
callq 0x1060
cmpl $-0x1, %eax
je 0x14fc
movl %eax, %ebp
movl $0xff, %r15d
movq %r14, %rdi
callq 0x1060
cmpl $-0x1, %eax
je 0x14fc
andl %r15d, %eax
movl %eax, %edi
movq %rbx, %rsi
callq 0x1070
andl %r15d, %ebp
movl %ebp, %edi
movq %rbx, %rsi
callq 0x1070
movq %r14, %rdi
callq 0x1060
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x14c6
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1040
movq 0x2adb(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xae0(%rip), %rsi       # 0x2007
movq %r14, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1080
movq 0x2ab6(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xabb(%rip), %rsi       # 0x2007
movq %r15, %rdx
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
jmp 0x1507
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: exchange_nybbles
void exchange_nybbles(const char *in_fname, const char *out_fname)
{
	int c;
	FILE *fin, *fout;
	fout = fopen(out_fname, "wb");
	if (!fout)
	{
		fprintf(stderr, "Couldn't open %s.\n", out_fname);
		return;
	}
	fin = fopen(in_fname, "rb");
	if (!fin)
	{
		fprintf(stderr, "Couldn't open %s.\n", in_fname);
		fclose(fout);
		return;
	}

	do
	{
		c = fgetc(fin);
		if (c == EOF)
		{
			break;
		}
		fputc(((c & 0xF) << 4) | ((c & 0xF0) >> 4), fout);
	} while (c != EOF);

	fclose(fout);
	fclose(fin);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xaad(%rip), %rsi       # 0x201a
movq %r14, %rdi
callq 0x10a0
testq %rax, %rax
je 0x15d2
movq %rax, %rbx
leaq 0xa80(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x15f2
movq %rax, %r14
movq %r14, %rdi
callq 0x1060
cmpl $-0x1, %eax
je 0x15bd
movl %eax, %ecx
shll $0x4, %ecx
movzbl %cl, %ecx
shrl $0x4, %eax
andl $0xf, %eax
orl %ecx, %eax
movl %eax, %edi
movq %rbx, %rsi
callq 0x1070
jmp 0x1594
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1040
movq 0x2a1f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xa24(%rip), %rsi       # 0x2007
movq %r14, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x1080
movq 0x29ff(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xa04(%rip), %rsi       # 0x2007
movq %r15, %rdx
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
jmp 0x15c8
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: exchange_halfnybbles
void exchange_halfnybbles(const char *in_fname, const char *out_fname)
{
	int c;
	uint8_t byte;
	FILE *fin, *fout;
	fout = fopen(out_fname, "wb");
	if (!fout)
	{
		fprintf(stderr, "Couldn't open %s.\n", out_fname);
		return;
	}
	fin = fopen(in_fname, "rb");
	if (!fin)
	{
		fprintf(stderr, "Couldn't open %s.\n", in_fname);
		fclose(fout);
		return;
	}

	do
	{
		c = fgetc(fin);
		if (c == EOF)
		{
			break;
		}
		byte = c;
		c = ((byte & 0x03) << 2) | ((byte & 0x0C) >> 2) | (((byte & 0x30) << 2) | ((byte & 0xC0) >> 2));

		fputc(c, fout);
	} while (c != EOF);

	fclose(fout);
	fclose(fin);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x9f6(%rip), %rsi       # 0x201a
movq %r14, %rdi
callq 0x10a0
testq %rax, %rax
je 0x1685
movq %rax, %rbx
leaq 0x9c9(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x16a5
movq %rax, %r14
movq %r14, %rdi
callq 0x1060
cmpl $-0x1, %eax
je 0x1670
movl %eax, %ecx
shrl $0x2, %ecx
andl $0x33, %ecx
andl $0x33, %eax
leal (%rcx,%rax,4), %edi
movq %rbx, %rsi
callq 0x1070
jmp 0x164b
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1040
movq 0x296c(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x971(%rip), %rsi       # 0x2007
movq %r14, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x1080
movq 0x294c(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x951(%rip), %rsi       # 0x2007
movq %r15, %rdx
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
jmp 0x167b
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: usage
void usage(const char *name)
{
	printf("Usage: %s [op]\n", name);
	printf("    split: s in out.even out.odd <bytes per>\n");
	printf("  combine: c in.even in.odd out <bytes per>\n");
	printf(" exchange: x in out\n");
	printf(" ex. 4bit: n in out\n");
	printf(" ex. 2bit: z in out\n");
}

// Assembly:
pushq %rax
movq %rdi, %rsi
leaq 0x94d(%rip), %rdi       # 0x201d
xorl %eax, %eax
callq 0x1050
leaq 0x972(%rip), %rdi       # 0x2050
callq 0x1030
leaq 0x993(%rip), %rdi       # 0x207d
callq 0x1030
leaq 0x9b3(%rip), %rdi       # 0x20a9
callq 0x1030
leaq 0x9bb(%rip), %rdi       # 0x20bd
callq 0x1030
leaq 0x9c3(%rip), %rdi       # 0x20d1
popq %rax
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O3/Mikejmoffitt[P]romtools/bsplit/bsplit.c
// Function: main
int main(int argc, char **argv)
{
	if (argc < 2)
	{
		usage(argv[0]);
		return 0;
	}

	int bytes = 1;

	if (argc > 5)
	{
		bytes = atoi(argv[5]);
		printf("Using %d bytes interleave cadence\n", bytes);
	}

	if (argv[1][0] == 's')
	{
		if (argc < 5)
		{
			usage(argv[0]);
			return 0;
		}
		printf("Splitting\n");
		split(argv[2], argv[3], argv[4], bytes);
	}
	else if (argv[1][0] == 'c')
	{
		if (argc < 5)
		{
			usage(argv[0]);
			return 0;
		}
		printf("Combining\n");
		combine(argv[2], argv[3], argv[4], bytes);
	}
	else if (argv[1][0] == 'x')
	{
		if (argc < 4)
		{
			usage(argv[0]);
			return 0;
		}
		printf("Exchanging bytes\n");
		exchange(argv[2], argv[3]);
	}
	else if (argv[1][0] == 'n')
	{
		if (argc < 4)
		{
			usage(argv[0]);
			return 0;
		}
		printf("Exchanging nybbles\n");
		exchange_nybbles(argv[2], argv[3]);
	}
	else if (argv[1][0] == 'z')
	{
		if (argc < 4)
		{
			usage(argv[0]);
			return 0;
		}
		printf("Exchanging half-nybbles\n");
		exchange_halfnybbles(argv[2], argv[3]);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpl $0x1, %edi
jg 0x172f
movq (%rbx), %rdi
callq 0x16c5
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %edi, %r14d
movl $0x1, %ebp
cmpl $0x6, %edi
jb 0x1757
movq 0x28(%rbx), %rdi
callq 0x10b0
movl %eax, %ebp
leaq 0x8df(%rip), %rdi       # 0x202d
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
movq 0x8(%rbx), %rax
movzbl (%rax), %eax
cmpl $0x72, %eax
jle 0x179d
cmpl $0x7a, %eax
je 0x17cf
cmpl $0x78, %eax
je 0x17f7
cmpl $0x73, %eax
jne 0x1728
cmpl $0x4, %r14d
jbe 0x1720
leaq 0x9a8(%rip), %rdi       # 0x212b
callq 0x1030
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
movl %ebp, %ecx
callq 0x11bc
jmp 0x1728
cmpl $0x63, %eax
je 0x181f
cmpl $0x6e, %eax
jne 0x1728
cmpl $0x3, %r14d
jbe 0x1720
leaq 0x945(%rip), %rdi       # 0x20fd
callq 0x1030
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0x155b
jmp 0x1728
cmpl $0x3, %r14d
jbe 0x1720
leaq 0x905(%rip), %rdi       # 0x20e5
callq 0x1030
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0x1612
jmp 0x1728
cmpl $0x3, %r14d
jbe 0x1720
leaq 0x908(%rip), %rdi       # 0x2110
callq 0x1030
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0x146e
jmp 0x1728
cmpl $0x4, %r14d
jbe 0x1720
leaq 0x8f1(%rip), %rdi       # 0x2121
callq 0x1030
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
movl %ebp, %ecx
callq 0x131c
jmp 0x1728
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntCreateStream
sonicStream sonicCreateStream(int sampleRate, int numChannels) {
  sonicStream stream =
      (sonicStream)sonicCalloc(1, sizeof(struct sonicStreamStruct));

  sampleRate = CLAMP(sampleRate, SONIC_MIN_SAMPLE_RATE, SONIC_MAX_SAMPLE_RATE);
  numChannels = CLAMP(numChannels, SONIC_MIN_CHANNELS, SONIC_MAX_CHANNELS);
  if (stream == NULL) {
    return NULL;
  }
  if (!allocateStreamBuffers(stream, sampleRate, numChannels)) {
    return NULL;
  }
  stream->speed = 1.0f;
  stream->pitch = 1.0f;
  stream->volume = 1.0f;
  stream->rate = 1.0f;
  stream->oldRatePosition = 0;
  stream->newRatePosition = 0;
  stream->quality = 0;
  return stream;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movl %edi, %ebp
movl $0x1, %edi
movl $0x88, %esi
callq 0x10a0
testq %rax, %rax
je 0x151c
movq %rax, %rbx
cmpl $0x20, %r14d
movl $0x20, %eax
cmovll %r14d, %eax
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
movl $0x7a120, %eax          # imm = 0x7A120
cmpl %eax, %ebp
cmovll %ebp, %eax
cmpl $0x3e9, %eax            # imm = 0x3E9
movl $0x3e8, %esi            # imm = 0x3E8
cmovgel %eax, %esi
movq %rbx, %rdi
callq 0x1526
testl %eax, %eax
je 0x151c
movaps 0x1b29(%rip), %xmm0     # 0x3030
movups %xmm0, 0x28(%rbx)
movq $0x0, 0x44(%rbx)
movl $0x0, 0x4c(%rbx)
jmp 0x151e
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntReadFloatFromStream
int sonicReadFloatFromStream(sonicStream stream, float* samples,
                             int maxSamples) {
  int numSamples = stream->numOutputSamples;
  int remainingSamples = 0;
  short* buffer;
  int count;

  if (numSamples == 0) {
    return 0;
  }
  if (numSamples > maxSamples) {
    remainingSamples = numSamples - maxSamples;
    numSamples = maxSamples;
  }
  buffer = stream->outputBuffer;
  count = numSamples * stream->numChannels;
  while (count--) {
    *samples++ = (*buffer++) / 32767.0f;
  }
  if (remainingSamples > 0) {
    memmove(stream->outputBuffer,
            stream->outputBuffer + numSamples * stream->numChannels,
            remainingSamples * sizeof(short) * stream->numChannels);
  }
  stream->numOutputSamples = remainingSamples;
  return numSamples;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x64(%rdi), %eax
testl %eax, %eax
je 0x1782
movl %edx, %ebx
movq %rdi, %r14
xorl %ecx, %ecx
movl %eax, %r15d
subl %edx, %r15d
cmovll %eax, %ebx
cmovlel %ecx, %r15d
movq 0x8(%rdi), %rdi
movslq 0x50(%r14), %rdx
movslq %ebx, %rax
imulq %rdx, %rax
testl %eax, %eax
je 0x1766
movl %eax, %ecx
xorl %r8d, %r8d
movss 0x18c9(%rip), %xmm0     # 0x3010
movswl (%rdi,%r8,2), %r9d
xorps %xmm1, %xmm1
cvtsi2ss %r9d, %xmm1
divss %xmm0, %xmm1
movss %xmm1, (%rsi,%r8,4)
incq %r8
cmpl %r8d, %ecx
jne 0x1747
testl %r15d, %r15d
jle 0x177c
leaq (%rdi,%rax,2), %rsi
leal (%r15,%r15), %eax
imulq %rax, %rdx
callq 0x1130
movl %r15d, 0x64(%r14)
jmp 0x1784
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntReadShortFromStream
int sonicReadShortFromStream(sonicStream stream, short* samples,
                             int maxSamples) {
  int numSamples = stream->numOutputSamples;
  int remainingSamples = 0;

  if (numSamples == 0) {
    return 0;
  }
  if (numSamples > maxSamples) {
    remainingSamples = numSamples - maxSamples;
    numSamples = maxSamples;
  }
  memcpy(samples, stream->outputBuffer,
         numSamples * sizeof(short) * stream->numChannels);
  if (remainingSamples > 0) {
    memmove(stream->outputBuffer,
            stream->outputBuffer + numSamples * stream->numChannels,
            remainingSamples * sizeof(short) * stream->numChannels);
  }
  stream->numOutputSamples = remainingSamples;
  return numSamples;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x64(%rdi), %eax
testl %eax, %eax
je 0x17f4
movl %edx, %ebx
movq %rdi, %r14
xorl %ecx, %ecx
movl %eax, %r15d
subl %edx, %r15d
cmovll %eax, %ebx
cmovlel %ecx, %r15d
movq 0x8(%rdi), %rax
movslq %ebx, %r12
movslq 0x50(%rdi), %rdx
imulq %r12, %rdx
addq %rdx, %rdx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x10e0
testl %r15d, %r15d
jle 0x17ee
movq 0x8(%r14), %rdi
movslq 0x50(%r14), %rax
imulq %rax, %r12
leaq (%rdi,%r12,2), %rsi
leal (%r15,%r15), %edx
imulq %rax, %rdx
callq 0x1130
movl %r15d, 0x64(%r14)
jmp 0x17f6
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntReadUnsignedCharFromStream
int sonicReadUnsignedCharFromStream(sonicStream stream, unsigned char* samples,
                                    int maxSamples) {
  int numSamples = stream->numOutputSamples;
  int remainingSamples = 0;
  short* buffer;
  int count;

  if (numSamples == 0) {
    return 0;
  }
  if (numSamples > maxSamples) {
    remainingSamples = numSamples - maxSamples;
    numSamples = maxSamples;
  }
  buffer = stream->outputBuffer;
  count = numSamples * stream->numChannels;
  while (count--) {
    *samples++ = (char)((*buffer++) >> 8) + 128;
  }
  if (remainingSamples > 0) {
    memmove(stream->outputBuffer,
            stream->outputBuffer + numSamples * stream->numChannels,
            remainingSamples * sizeof(short) * stream->numChannels);
  }
  stream->numOutputSamples = remainingSamples;
  return numSamples;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x64(%rdi), %eax
testl %eax, %eax
je 0x1875
movl %edx, %ebx
movq %rdi, %r14
xorl %ecx, %ecx
movl %eax, %r15d
subl %edx, %r15d
cmovll %eax, %ebx
cmovlel %ecx, %r15d
movl 0x50(%rdi), %ecx
imull %ebx, %ecx
testl %ecx, %ecx
je 0x184a
movq 0x8(%r14), %rax
movl %ecx, %ecx
xorl %edx, %edx
movb 0x1(%rax,%rdx,2), %dil
addb $-0x80, %dil
movb %dil, (%rsi,%rdx)
incq %rdx
cmpl %edx, %ecx
jne 0x1836
testl %r15d, %r15d
jle 0x186f
movq 0x8(%r14), %rdi
movslq 0x50(%r14), %rax
movslq %ebx, %rcx
imulq %rax, %rcx
leaq (%rdi,%rcx,2), %rsi
leal (%r15,%r15), %edx
imulq %rax, %rdx
callq 0x1130
movl %r15d, 0x64(%r14)
jmp 0x1877
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntFlushStream
int sonicFlushStream(sonicStream stream) {
  int maxRequired = stream->maxRequired;
  int remainingSamples = stream->numInputSamples;
  float speed = stream->speed / stream->pitch;
  float rate = stream->rate * stream->pitch;
  int expectedOutputSamples =
      stream->numOutputSamples +
      (int)((remainingSamples / speed + stream->numPitchSamples) / rate + 0.5f);

  /* Add enough silence to flush both input and pitch buffers. */
  if (!enlargeInputBufferIfNeeded(stream, remainingSamples + 2 * maxRequired)) {
    return 0;
  }
  memset(stream->inputBuffer + remainingSamples * stream->numChannels, 0,
         2 * maxRequired * sizeof(short) * stream->numChannels);
  stream->numInputSamples += 2 * maxRequired;
  if (!sonicWriteShortToStream(stream, NULL, 0)) {
    return 0;
  }
  /* Throw away any extra samples we generated due to the silence we added */
  if (stream->numOutputSamples > expectedOutputSamples) {
    stream->numOutputSamples = expectedOutputSamples;
  }
  /* Empty input and pitch buffers */
  stream->numInputSamples = 0;
  stream->inputPlayTime = 0.0f;
  stream->timeError = 0.0f;
  stream->numPitchSamples = 0;
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movslq 0x74(%rdi), %r15
movslq 0x60(%rdi), %r14
movss 0x28(%rdi), %xmm0
movss 0x30(%rdi), %xmm1
divss %xmm1, %xmm0
cvtsi2ss %r14d, %xmm2
divss %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2ssl 0x68(%rdi), %xmm0
mulss 0x34(%rdi), %xmm1
addss %xmm2, %xmm0
divss %xmm1, %xmm0
addss 0x174e(%rip), %xmm0     # 0x3014
cvttss2si %xmm0, %r12d
addl 0x64(%rdi), %r12d
addq %r15, %r15
leal (%r14,%r15), %esi
callq 0x1941
testl %eax, %eax
je 0x1934
movslq 0x50(%rbx), %rax
imulq %rax, %r14
addq %r14, %r14
addq (%rbx), %r14
movq %r15, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x1090
addl %r15d, 0x60(%rbx)
movq %rbx, %rdi
callq 0x1aab
testl %eax, %eax
je 0x1936
cmpl %r12d, 0x64(%rbx)
jle 0x191d
movl %r12d, 0x64(%rbx)
xorl %eax, %eax
movl %eax, 0x60(%rbx)
movq $0x0, 0x3c(%rbx)
movl %eax, 0x68(%rbx)
movl $0x1, %ebp
jmp 0x1936
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: enlargeInputBufferIfNeeded
static int enlargeInputBufferIfNeeded(sonicStream stream, int numSamples) {
  int inputBufferSize = stream->inputBufferSize;

  if (stream->numInputSamples + numSamples > inputBufferSize) {
    stream->inputBufferSize += (inputBufferSize >> 1) + numSamples;
    stream->inputBuffer = (short*)sonicRealloc(
        stream->inputBuffer, inputBufferSize, stream->inputBufferSize,
        sizeof(short) * stream->numChannels);
    if (stream->inputBuffer == NULL) {
      return 0;
    }
  }
  return 1;
}

// Assembly:
movl 0x54(%rdi), %eax
movl 0x60(%rdi), %ecx
addl %esi, %ecx
cmpl %eax, %ecx
jle 0x1976
pushq %rbx
movq %rdi, %rbx
movl %eax, %ecx
sarl %ecx
addl %eax, %esi
addl %ecx, %esi
movl %esi, 0x54(%rdi)
movq (%rdi), %rdi
imull 0x50(%rbx), %esi
addl %esi, %esi
movslq %esi, %rsi
callq 0x1120
movq %rax, (%rbx)
testq %rax, %rax
popq %rbx
je 0x197c
movl $0x1, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntChangeFloatSpeed
int sonicChangeFloatSpeed(float* samples, int numSamples, float speed,
                          float pitch, float rate, float volume,
                          int useChordPitch, int sampleRate, int numChannels) {
  sonicStream stream = sonicCreateStream(sampleRate, numChannels);

  sonicSetSpeed(stream, speed);
  sonicSetPitch(stream, pitch);
  sonicSetRate(stream, rate);
  sonicSetVolume(stream, volume);
  sonicWriteFloatToStream(stream, samples, numSamples);
  sonicFlushStream(stream);
  numSamples = sonicSamplesAvailable(stream);
  sonicReadFloatFromStream(stream, samples, numSamples);
  sonicDestroyStream(stream);
  return numSamples;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movaps %xmm3, 0x30(%rsp)
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, (%rsp)
movaps %xmm0, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movl %ecx, %edi
movl %r8d, %esi
callq 0x1100
movq %rax, %rbx
movaps (%rsp), %xmm0
unpcklps 0x20(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps 0x10(%rsp), %xmm2
unpcklps 0x30(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
movlhps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movaps 0xa7d(%rip), %xmm0      # 0x3040
movaps 0xa86(%rip), %xmm1      # 0x3050
movq $0x0, 0x44(%rax)
minps %xmm2, %xmm1
cmpltps %xmm0, %xmm2
andps %xmm2, %xmm0
andnps %xmm1, %xmm2
orps %xmm0, %xmm2
movups %xmm2, 0x28(%rax)
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x1040
movq %rbx, %rdi
callq 0x1060
movl 0x64(%rbx), %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x10f0
movq %rbx, %rdi
callq 0x1467
movq %rbx, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: sonicIntChangeShortSpeed
int sonicChangeShortSpeed(short* samples, int numSamples, float speed,
                          float pitch, float rate, float volume,
                          int useChordPitch, int sampleRate, int numChannels) {
  sonicStream stream = sonicCreateStream(sampleRate, numChannels);

  sonicSetSpeed(stream, speed);
  sonicSetPitch(stream, pitch);
  sonicSetRate(stream, rate);
  sonicSetVolume(stream, volume);
  sonicWriteShortToStream(stream, samples, numSamples);
  sonicFlushStream(stream);
  numSamples = sonicSamplesAvailable(stream);
  sonicReadShortFromStream(stream, samples, numSamples);
  sonicDestroyStream(stream);
  return numSamples;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movaps %xmm3, 0x30(%rsp)
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, (%rsp)
movaps %xmm0, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movl %ecx, %edi
movl %r8d, %esi
callq 0x1100
movq %rax, %rbx
movaps (%rsp), %xmm0
unpcklps 0x20(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps 0x10(%rsp), %xmm2
unpcklps 0x30(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
movlhps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movaps 0x9d0(%rip), %xmm0      # 0x3040
movaps 0x9d9(%rip), %xmm1      # 0x3050
movq $0x0, 0x44(%rax)
minps %xmm2, %xmm1
cmpltps %xmm0, %xmm2
andps %xmm2, %xmm0
andnps %xmm1, %xmm2
orps %xmm0, %xmm2
movups %xmm2, 0x28(%rax)
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x10d0
movq %rbx, %rdi
callq 0x1060
movl 0x64(%rbx), %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x1160
movq %rbx, %rdi
callq 0x1467
movq %rbx, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: removeInputSamples
static void removeInputSamples(sonicStream stream, int position) {
  int remainingSamples = stream->numInputSamples - position;

  if (remainingSamples > 0) {
    memmove(stream->inputBuffer,
            stream->inputBuffer + position * stream->numChannels,
            remainingSamples * sizeof(short) * stream->numChannels);
  }
  /* If we play 3/4ths of the samples, then the expected play time of the
     remaining samples is 1/4th of the original expected play time. */
  stream->inputPlayTime =
      (stream->inputPlayTime * remainingSamples) / stream->numInputSamples;
  stream->numInputSamples = remainingSamples;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x60(%rdi), %eax
movl %eax, %r14d
subl %esi, %r14d
jle 0x2707
movq (%rbx), %rdi
movslq 0x50(%rbx), %rax
movslq %esi, %rcx
imulq %rax, %rcx
leaq (%rdi,%rcx,2), %rsi
leal (%r14,%r14), %edx
imulq %rax, %rdx
callq 0x1130
movl 0x60(%rbx), %eax
cvtsi2ss %r14d, %xmm0
mulss 0x3c(%rbx), %xmm0
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x3c(%rbx)
movl %r14d, 0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: enlargeOutputBufferIfNeeded
static int enlargeOutputBufferIfNeeded(sonicStream stream, int numSamples) {
  int outputBufferSize = stream->outputBufferSize;

  if (stream->numOutputSamples + numSamples > outputBufferSize) {
    stream->outputBufferSize += (outputBufferSize >> 1) + numSamples;
    stream->outputBuffer = (short*)sonicRealloc(
        stream->outputBuffer, outputBufferSize, stream->outputBufferSize,
        sizeof(short) * stream->numChannels);
    if (stream->outputBuffer == NULL) {
      return 0;
    }
  }
  return 1;
}

// Assembly:
movl 0x5c(%rdi), %eax
movl 0x64(%rdi), %ecx
addl %esi, %ecx
cmpl %eax, %ecx
jle 0x2761
pushq %rbx
movq %rdi, %rbx
movl %eax, %ecx
sarl %ecx
addl %eax, %esi
addl %ecx, %esi
movl %esi, 0x5c(%rdi)
movq 0x8(%rdi), %rdi
imull 0x50(%rbx), %esi
addl %esi, %esi
movslq %esi, %rsi
callq 0x1120
movq %rax, 0x8(%rbx)
testq %rax, %rax
popq %rbx
je 0x2767
movl $0x1, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/sonic.c
// Function: findPitchPeriodInRange
static int findPitchPeriodInRange(short* samples, int minPeriod, int maxPeriod,
                                  int* retMinDiff, int* retMaxDiff) {
  int period, bestPeriod = 0, worstPeriod = 255;
  short* s;
  short* p;
  short sVal, pVal;
  unsigned long diff, minDiff = 1, maxDiff = 0;
  int i;

  for (period = minPeriod; period <= maxPeriod; period++) {
    diff = 0;
    s = samples;
    p = samples + period;
    for (i = 0; i < period; i++) {
      sVal = *s++;
      pVal = *p++;
      diff += sVal >= pVal ? (unsigned short)(sVal - pVal)
                           : (unsigned short)(pVal - sVal);
    }
    /* Note that the highest number of samples we add into diff will be less
       than 256, since we skip samples.  Thus, diff is a 24 bit number, and
       we can safely multiply by numSamples without overflow */
    if (bestPeriod == 0 || diff * bestPeriod < minDiff * period) {
      minDiff = diff;
      bestPeriod = period;
    }
    if (diff * worstPeriod > maxDiff * period) {
      maxDiff = diff;
      worstPeriod = period;
    }
  }
  *retMinDiff = minDiff / bestPeriod;
  *retMaxDiff = maxDiff / worstPeriod;
  return bestPeriod;
}

// Assembly:
movq %rcx, %r10
cmpl %edx, %esi
jle 0x2780
movl $0x1, %eax
xorl %r9d, %r9d
xorl %edi, %edi
jmp 0x285a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r10, -0x10(%rsp)
movq %r8, -0x8(%rsp)
movslq %esi, %r10
incl %edx
movl %esi, %r11d
leaq (%rdi,%r10,2), %r14
movl $0xff, %ebx
xorl %eax, %eax
movl $0x1, %ecx
xorl %r9d, %r9d
testq %r10, %r10
jle 0x27e8
xorl %r12d, %r12d
xorl %r15d, %r15d
movzwl (%rdi,%r12,2), %ebp
movzwl (%r14,%r12,2), %r13d
movl %ebp, %r8d
subw %r13w, %r8w
movl %r8d, %esi
negl %esi
cmpw %r13w, %bp
cmovgel %r8d, %esi
movzwl %si, %esi
addq %rsi, %r15
incq %r12
cmpl %r12d, %r11d
jne 0x27ba
jmp 0x27eb
xorl %r15d, %r15d
testl %r9d, %r9d
je 0x2803
movslq %r9d, %rsi
imulq %r15, %rsi
movq %rcx, %r8
imulq %r10, %r8
cmpq %r8, %rsi
jae 0x2809
movl %r10d, %r9d
movq %r15, %rcx
movslq %ebx, %rbx
movq %r15, %rsi
imulq %rbx, %rsi
movq %rax, %r8
imulq %r10, %r8
cmpq %r8, %rsi
cmoval %r10d, %ebx
cmovaq %r15, %rax
incq %r10
incq %r11
addq $0x2, %r14
cmpl %r10d, %edx
jne 0x27af
movslq %ebx, %rsi
xorl %edx, %edx
divq %rsi
movq %rax, %rdi
movq -0x8(%rsp), %r8
movq -0x10(%rsp), %r10
movq %rcx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movslq %r9d, %r9
xorl %edx, %edx
divq %r9
movl %eax, (%r10)
movl %edi, (%r8)
movl %r9d, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: closeFile
static void closeFile(waveFile file) {
  FILE* soundFile = file->soundFile;

  if (soundFile != NULL) {
    fclose(soundFile);
    file->soundFile = NULL;
  }
  free(file);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x2af3
callq 0x1070
movq %rbx, %rdi
popq %rbx
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: openOutputWaveFile
waveFile openOutputWaveFile(const char* fileName, int sampleRate, int numChannels) {
  waveFile file;
  FILE* soundFile = fopen(fileName, "wb");

  if (soundFile == NULL) {
    fprintf(stderr, "Unable to open wave file %s for writing\n", fileName);
    return NULL;
  }
  file = (waveFile)calloc(1, sizeof(struct waveFileStruct));
  file->soundFile = soundFile;
  file->sampleRate = sampleRate;
  file->numChannels = numChannels;
  writeHeader(file, sampleRate, numChannels);
  if (file->failed) {
    closeFile(file);
    return NULL;
  }
  return file;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r15
leaq 0xa47(%rip), %rsi       # 0x355e
callq 0x1140
testq %rax, %rax
je 0x2cd1
movq %rax, %r12
movl $0x1, %edi
movl $0x20, %esi
callq 0x10a0
movq %rax, %rbx
movq %r12, 0x8(%rax)
movl %ebp, 0x4(%rax)
movl %r14d, (%rax)
leaq 0xa7f(%rip), %rsi       # 0x35ca
movq %rax, %rdi
movl $0x4, %edx
callq 0x2ed2
movb $0x24, %cl
xorl %eax, %eax
movb %cl, 0xc(%rsp,%rax)
incq %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
jne 0x2b5c
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
leaq 0xa4b(%rip), %rsi       # 0x35cf
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
leaq 0xa3c(%rip), %rsi       # 0x35d4
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
movb $0x10, %cl
xorl %eax, %eax
movb %cl, 0xc(%rsp,%rax)
incq %rax
xorl %ecx, %ecx
cmpq $0x4, %rax
jne 0x2ba9
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x2ed2
movw $0x1, (%r15)
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0x2, %edx
callq 0x2ed2
movw %r14w, (%r15)
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x2ed2
xorl %eax, %eax
movl %ebp, %ecx
movb %cl, 0xc(%rsp,%rax)
sarl $0x8, %ecx
incq %rax
cmpq $0x4, %rax
jne 0x2c02
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
addl %ebp, %ebp
xorl %eax, %eax
movb %bpl, 0xc(%rsp,%rax)
sarl $0x8, %ebp
incq %rax
cmpq $0x4, %rax
jne 0x2c28
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x2ed2
movw $0x2, (%r14)
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x2ed2
movw $0x10, (%r14)
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x2ed2
leaq 0x9c9(%rip), %rsi       # 0x3654
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
movl $0x0, (%r14)
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
cmpl $0x0, 0x14(%rbx)
je 0x2cc1
movq %rbx, %rdi
callq 0x2ae1
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x3320(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x87f(%rip), %rsi       # 0x3561
xorl %ebx, %ebx
movq %r15, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x2cc1
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: closeWaveFile
int closeWaveFile(waveFile file) {
  FILE* soundFile = file->soundFile;
  int passed = 1;

  if (!file->isInput) {
    if (fseek(soundFile, 4, SEEK_SET) != 0) {
      fprintf(stderr, "Failed to seek on input file.\n");
      passed = 0;
    } else {
      /* Now update the file to have the correct size. */
      writeInt(file, file->bytesWritten - 8);
      if (file->failed) {
        fprintf(stderr, "Failed to write wave file size.\n");
        passed = 0;
      }
      if (fseek(soundFile, 40, SEEK_SET) != 0) {
        fprintf(stderr, "Failed to seek on input file.\n");
        passed = 0;
      } else {
        /* Now update the file to have the correct size. */
        writeInt(file, file->bytesWritten - 48);
        if (file->failed) {
          fprintf(stderr, "Failed to write wave file size.\n");
          passed = 0;
        }
      }
    }
  }
  closeFile(file);
  return passed;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x1, %ebp
cmpl $0x0, 0x18(%rdi)
jne 0x2d9f
movq 0x8(%rbx), %r14
xorl %ebp, %ebp
movl $0x4, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x1110
testl %eax, %eax
jne 0x2db2
movl 0x10(%rbx), %eax
addl $-0x8, %eax
xorl %ecx, %ecx
movb %al, 0x8(%rsp,%rcx)
sarl $0x8, %eax
incq %rcx
cmpq $0x4, %rcx
jne 0x2d2f
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
movl $0x1, %ebp
cmpl $0x0, 0x14(%rbx)
jne 0x2db9
movl $0x28, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x1110
testl %eax, %eax
jne 0x2dc2
movl 0x10(%rbx), %eax
addl $-0x30, %eax
xorl %ecx, %ecx
movb %al, 0xc(%rsp,%rcx)
sarl $0x8, %eax
incq %rcx
cmpq $0x4, %rcx
jne 0x2d77
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x2ed2
cmpl $0x0, 0x14(%rbx)
jne 0x2dc9
movq %rbx, %rdi
callq 0x2ae1
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x11d4
jmp 0x2d9f
callq 0x11f0
xorl %ebp, %ebp
jmp 0x2d5c
callq 0x120c
jmp 0x2dce
callq 0x1228
xorl %ebp, %ebp
jmp 0x2d9f
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: readFromWaveFile
int readFromWaveFile(waveFile file, short* buffer, int maxSamples) {
  int i, bytesRead, samplesRead;
  int bytePos = 0;
  unsigned char bytes[WAVE_BUF_LEN];
  short sample;

  if (maxSamples * file->numChannels * 2 > WAVE_BUF_LEN) {
    maxSamples = WAVE_BUF_LEN / (file->numChannels * 2);
  }
  bytesRead = readBytes(file, bytes, maxSamples * file->numChannels * 2);
  samplesRead = bytesRead / (file->numChannels * 2);
  for (i = 0; i < samplesRead * file->numChannels; i++) {
    sample = bytes[bytePos++];
    sample |= (unsigned int)bytes[bytePos++] << 8;
    *buffer++ = sample;
  }
  return samplesRead;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %ecx
movl %ecx, %eax
imull %edx, %eax
cmpl $0x801, %eax            # imm = 0x801
jl 0x2dfe
leal (%rcx,%rcx), %esi
movl $0x1000, %eax           # imm = 0x1000
xorl %edx, %edx
idivl %esi
movl %eax, %edx
xorl %eax, %eax
cmpl $0x0, 0x14(%r14)
jne 0x2e23
imull %edx, %ecx
addl %ecx, %ecx
movslq %ecx, %rdx
movq 0x8(%r14), %rcx
movq %rsp, %rdi
movl $0x1, %esi
callq 0x1050
movl (%r14), %ecx
leal (%rcx,%rcx), %esi
cltd
idivl %esi
movl %eax, %edx
imull %ecx, %edx
testl %edx, %edx
jle 0x2e45
movl %edx, %ecx
xorl %edx, %edx
movzwl (%rsp,%rdx,2), %esi
movw %si, (%rbx,%rdx,2)
incq %rdx
cmpl %edx, %ecx
jne 0x2e36
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: writeToWaveFile
int writeToWaveFile(waveFile file, short* buffer, int numSamples) {
  int i;
  int bytePos = 0;
  unsigned char bytes[WAVE_BUF_LEN];
  short sample;
  int total = numSamples * file->numChannels;

  for (i = 0; i < total; i++) {
    if (bytePos == WAVE_BUF_LEN) {
      writeBytes(file, bytes, bytePos);
      bytePos = 0;
    }
    sample = buffer[i];
    bytes[bytePos++] = sample;
    bytes[bytePos++] = sample >> 8;
  }
  if (bytePos != 0) {
    writeBytes(file, bytes, bytePos);
  }
  return !file->failed;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rdi, %rbx
imull (%rdi), %edx
testl %edx, %edx
jle 0x2eb8
movq %rsi, %r14
movl %edx, %r12d
xorl %r13d, %r13d
movq %rsp, %r15
xorl %edx, %edx
cmpl $0x1000, %edx           # imm = 0x1000
jne 0x2e92
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x2ed2
xorl %edx, %edx
movzwl (%r14,%r13,2), %eax
movslq %edx, %rcx
leal 0x2(%rcx), %edx
movw %ax, (%rsp,%rcx)
incq %r13
cmpq %r13, %r12
jne 0x2e78
testl %edx, %edx
je 0x2eb8
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2ed2
xorl %eax, %eax
cmpl $0x0, 0x14(%rbx)
sete %al
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: writeBytes
static void writeBytes(waveFile file, void* bytes, int length) {
  size_t bytesWritten;

  if (file->failed) {
    return;
  }
  bytesWritten = fwrite(bytes, sizeof(char), length, file->soundFile);
  if (bytesWritten != length) {
    fprintf(stderr, "Unable to write to output file");
    file->failed = 1;
  }
  file->bytesWritten += bytesWritten;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
je 0x2ed9
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movslq %edx, %r15
movq 0x8(%rdi), %rcx
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
callq 0x1150
movq %rax, %r14
cmpq %r15, %rax
jne 0x2f0d
addl %r14d, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x14(%rbx), %rdi
callq 0x1244
jmp 0x2f03
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: expectString
static void expectString(waveFile file, char* expectedString) {
  char buf[11]; /* Be sure that we never call with a longer string */
  int length = strlen(expectedString);

  if (length > 10) {
    fprintf(stderr, "Internal error: expected string too long\n");
    file->failed = 1;
  } else {
    readExactBytes(file, buf, length);
    buf[length] = '\0';
    if (strcmp(expectedString, buf)) {
      fprintf(stderr, "Unsupported wave file format: Expected '%s', got '%s;\n",
          expectedString, buf);
      file->failed = 1;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1080
movq %rax, %r15
cmpl $0xb, %r15d
jge 0x2f70
leaq 0xd(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x2fa0
movslq %r15d, %rax
movb $0x0, 0xd(%rsp,%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x10b0
testl %eax, %eax
jne 0x2f77
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x126c
jmp 0x2f97
movq 0x307a(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x6fb(%rip), %rsi       # 0x3683
leaq 0xd(%rsp), %rcx
movq %r14, %rdx
xorl %eax, %eax
callq 0x10c0
movl $0x1, 0x14(%rbx)
jmp 0x2f64
// File: /workspace/github_c_makefile_star2_O3/waywardgeek[P]sonic/wave.c
// Function: readExactBytes
static void readExactBytes(waveFile file, void* bytes, int length) {
  int numRead;

  if (file->failed) {
    return;
  }
  numRead = fread(bytes, sizeof(char), length, file->soundFile);
  if (numRead != length) {
    fprintf(stderr, "Failed to read requested bytes from input file\n");
    file->failed = 1;
  }
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
je 0x2fa7
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movslq %edx, %r14
movq 0x8(%rdi), %rcx
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0x1050
cmpl %r14d, %eax
jne 0x2fd5
addq $0x8, %rsp
popq %rbx
popq %r14
retq
addq $0x14, %rbx
movq %rbx, %rdi
callq 0x1288
jmp 0x2fcd
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/d3d.c
// Function: d3d_new_texture
d3d_texture *d3d_new_texture(size_t width, size_t height, d3d_pixel fill)
{
	if (width < 1) width = 1;
	if (height < 1) height = 1;
	size_t size = texture_size(width, height);
	if (size == 0) return NULL;
	d3d_texture *txtr = d3d_malloc(size);
	if (!txtr) return NULL;
	txtr->width = width;
	txtr->height = height;
	for (size_t i = 0; i < width * height; ++i) {
		txtr->pixels[i] = fill;
	}
	return txtr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r12
cmpq $0x1, %rdi
adcq $0x0, %r12
movq %rsi, %r13
cmpq $0x1, %rsi
adcq $0x0, %r13
movq %r12, %rax
mulq %r13
movq %rax, %r15
seto %al
cmpq $-0x10, %r15
setae %cl
orb %al, %cl
jne 0x2969
leaq 0x10(%r15), %rdi
callq 0x2150
testq %rax, %rax
je 0x2969
movq %rax, %r14
movq %r12, (%rax)
movq %r13, 0x8(%rax)
testq %r15, %r15
je 0x296c
movq %r14, %rdi
addq $0x10, %rdi
movzbl %bl, %esi
movq %r15, %rdx
callq 0x2060
jmp 0x296c
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/d3d.c
// Function: d3d_new_board
d3d_board *d3d_new_board(size_t width, size_t height, const d3d_block_s *fill)
{
	size_t size = offsetof(d3d_board, blocks);
	size_t blocks_size = width * height * sizeof(d3d_block_s *);
	if (width != 0 && blocks_size / sizeof(d3d_block_s *) / width != height)
		return NULL;
	CHECKED_ADD(size, blocks_size);
	d3d_board *board = d3d_malloc(size);
	if (!board) return NULL;
	board->width = width;
	board->height = height;
	static const d3d_block_s empty_block = {{ NULL, NULL, NULL, NULL,
		NULL, NULL }};
	if (!fill) fill = &empty_block;
	for (size_t i = 0; i < width * height; ++i) {
		board->blocks[i] = fill;
	}
	return board;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %r12
imulq %rdi, %r12
leaq (,%r12,8), %rdi
testq %r15, %r15
je 0x29c6
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
andq %r12, %rax
xorl %ecx, %ecx
xorl %edx, %edx
divq %r15
cmpq $-0x11, %rdi
ja 0x2a97
cmpq %r14, %rax
je 0x29d0
jmp 0x2a97
cmpq $-0x11, %rdi
ja 0x2a95
addq $0x10, %rdi
callq 0x2150
testq %rax, %rax
je 0x2a95
movq %rax, %rcx
movq %r15, (%rax)
movq %r14, 0x8(%rax)
testq %rbx, %rbx
leaq 0x9742(%rip), %rax      # 0xc138
cmovneq %rbx, %rax
testq %r12, %r12
je 0x2a97
leaq 0x1(%r12), %rdx
andq $-0x2, %rdx
decq %r12
movq %r12, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x960f(%rip), %xmm1     # 0xc030
xorl %esi, %esi
movdqa 0x9615(%rip), %xmm2     # 0xc040
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x9615(%rip), %xmm4     # 0xc050
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edi
notl %edi
testb $0x1, %dil
je 0x2a72
movq %rax, 0x10(%rcx,%rsi,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x2a86
movq %rax, 0x18(%rcx,%rsi,8)
addq $0x2, %rsi
paddq %xmm4, %xmm1
cmpq %rsi, %rdx
jne 0x2a3b
jmp 0x2a97
xorl %ecx, %ecx
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/do-ts3d-game.c
// Function: write_save_state
static int write_save_state(struct save_state *save, const char *state_file,
	struct logger *log, struct menu *menu)
{
	FILE *to = fopen(state_file, "w");
	int ret = 0;
	if (!to || save_state_write(save, to)) {
		int errnum = errno;
		FILE *print = logger_get_output(log, LOGGER_ERROR);
		if (print) {
			logger_printf(log, LOGGER_ERROR,
				"Failed to write state information to %s: %s\n",
				state_file, strerror(errnum));
			logger_printf(log, LOGGER_ERROR,
				"The information is below. Copy this to %s or"
				" to another location (see ts3d -h output):\n",
				state_file);
			save_state_write(save, print);
		}
		menu_set_message(menu, "SAVE ERROR!! QUIT NOW AND READ LOG!");
		beep();
		ret = -1;
	}
	if (to) fclose(to);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %r15
leaq 0x8001(%rip), %rsi      # 0xc273
movq %r12, %rdi
callq 0x2160
movq %rax, %rbx
testq %rax, %rax
je 0x4295
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa3cf
testl %eax, %eax
je 0x431f
movq %r14, (%rsp)
callq 0x2320
movl (%rax), %r14d
movq %r13, %rdi
movl $0x4, %esi
callq 0x6d5f
testq %rax, %rax
je 0x42fe
movq %rax, %rbp
movl %r14d, %edi
callq 0x2260
leaq 0x7fb0(%rip), %rdx      # 0xc275
movq %r13, %rdi
movl $0x4, %esi
movq %r12, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x6e50
leaq 0x7fc1(%rip), %rdx      # 0xc2a2
movq %r13, %rdi
movl $0x4, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0x6e50
movq %r15, %rdi
movq %rbp, %rsi
callq 0xa3cf
leaq 0x7ff5(%rip), %rsi      # 0xc2fa
movq (%rsp), %rdi
callq 0x8a7a
callq 0x2170
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rbx, %rbx
jne 0x4321
jmp 0x4329
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x23e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/ent.c
// Function: ent_type_free
void ent_type_free(struct ent_type *ent)
{
	if (!ent) return;
	free(ent->name);
	free(ent->frames);
	free(ent);
}

// Assembly:
testq %rdi, %rdi
je 0x481f
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2570
movq 0x20(%rbx), %rdi
callq 0x2570
movq %rbx, %rdi
popq %rbx
jmp 0x2570
retq
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/ent.c
// Function: ents_init
void ents_init(struct ents *ents, size_t cap)
{
	ents->ents = xmalloc(cap * sizeof(*ents->ents));
	ents->sprites = xmalloc(cap * sizeof(*ents->sprites));
	ents->num = 0;
	ents->cap = cap;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rax
shlq $0x5, %rax
leaq (%rax,%rax,2), %rdi
callq 0xb080
movq %rax, (%r14)
movq %rbx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
callq 0xb080
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
movq %rbx, 0x18(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/ent.c
// Function: ents_add
ent_id ents_add(struct ents *ents, struct ent_type *type, enum team team,
	const d3d_vec_s *pos)
{
	size_t old_num = ents->num;
	size_t old_cap = ents->cap;
	struct ent *ent = GROWE(ents->ents, ents->num, ents->cap);
	if (ents->cap != old_cap) {
		ents->sprites = xrealloc(ents->sprites, ents->cap
			* sizeof(*ents->sprites));
	}
	ent_init(ent, type, team, &ents->sprites[old_num], pos);
	return ents->num - 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movq %rsi, %r15
movq %rdi, %r12
leaq 0x10(%rdi), %r14
movq 0x10(%rdi), %rbx
movq 0x18(%rdi), %rbp
leaq 0x18(%rdi), %rdx
movl $0x60, %ecx
movq %r14, %rsi
callq 0x4c2c
movq %rax, %r13
movq 0x8(%r12), %rax
movq 0x18(%r12), %rcx
cmpq %rbp, %rcx
je 0x48f8
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0xb1a8
movq %rax, 0x8(%r12)
leaq (%rbx,%rbx,2), %rcx
shlq $0x4, %rcx
addq %rax, %rcx
movq %r13, %rdi
movq %r15, %rsi
movl 0xc(%rsp), %edx
movq 0x10(%rsp), %r8
callq 0x492c
movq (%r14), %rax
decq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq