LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: readChunk_tIME
static unsigned readChunk_tIME(LodePNGInfo* info, const unsigned char* data, size_t chunkLength)
{
  if(chunkLength != 7) return 73; /*invalid tIME chunk size*/

  info->time_defined = 1;
  info->time.year = 256u * data[0] + data[1];
  info->time.month = data[2];
  info->time.day = data[3];
  info->time.hour = data[4];
  info->time.minute = data[5];
  info->time.second = data[6];

  return 0; /* OK */
}

// Assembly:
movl $0x49, %eax
cmpq $0x7, %rdx
jne 0xbd54
movl $0x1, 0x88(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x8c(%rdi)
movzbl 0x2(%rsi), %eax
movl %eax, 0x90(%rdi)
movzbl 0x3(%rsi), %eax
movl %eax, 0x94(%rdi)
movzbl 0x4(%rsi), %eax
movl %eax, 0x98(%rdi)
movzbl 0x5(%rsi), %eax
movl %eax, 0x9c(%rdi)
movzbl 0x6(%rsi), %eax
movl %eax, 0xa0(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: readChunk_pHYs
static unsigned readChunk_pHYs(LodePNGInfo* info, const unsigned char* data, size_t chunkLength)
{
  if(chunkLength != 9) return 74; /*invalid pHYs chunk size*/

  info->phys_defined = 1;
  info->phys_x = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3];
  info->phys_y = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7];
  info->phys_unit = data[8];

  return 0; /* OK */
}

// Assembly:
movl $0x4a, %eax
cmpq $0x9, %rdx
jne 0xbd8b
movl $0x1, 0xa4(%rdi)
movl (%rsi), %eax
bswapl %eax
movl %eax, 0xa8(%rdi)
movl 0x4(%rsi), %eax
bswapl %eax
movl %eax, 0xac(%rdi)
movzbl 0x8(%rsi), %eax
movl %eax, 0xb0(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: lodepng_get_raw_size_idat
static size_t lodepng_get_raw_size_idat(unsigned w, unsigned h, const LodePNGColorMode* color)
{
  /*will not overflow for any color type if roughly w * h < 268435455*/
  size_t bpp = lodepng_get_bpp(color);
  size_t line = ((w / 8) * bpp) + ((w & 7) * bpp + 7) / 8;
  return h * line;
}

// Assembly:
xorl %eax, %eax
cmpl $0x6, %edx
ja 0xbd9f
movl %edx, %eax
leaq 0x2d68(%rip), %rdx      # 0xeb04
movl (%rdx,%rax,4), %eax
imull %ecx, %eax
movl %edi, %ecx
shrl $0x3, %ecx
imulq %rax, %rcx
andl $0x7, %edi
imulq %rax, %rdi
addq $0x7, %rdi
shrq $0x3, %rdi
addq %rcx, %rdi
movl %esi, %eax
imulq %rdi, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: removePaddingBits
static void removePaddingBits(unsigned char* out, const unsigned char* in,
                              size_t olinebits, size_t ilinebits, unsigned h)
{
  /*
  After filtering there are still padding bits if scanlines have non multiple of 8 bit amounts. They need
  to be removed (except at last scanline of (Adam7-reduced) image) before working with pure image buffers
  for the Adam7 code, the color convert code and the output to the user.
  in and out are allowed to be the same buffer, in may also be higher but still overlapping; in must
  have >= ilinebits*h bits, out must have >= olinebits*h bits, olinebits must be <= ilinebits
  also used to move bits after earlier such operations happened, e.g. in a sequence of reduced images from Adam7
  only useful if (ilinebits - olinebits) is a value in the range 1..7
  */
  unsigned y;
  size_t diff = ilinebits - olinebits;
  size_t ibp = 0, obp = 0; /*input and output bit pointers*/
  for(y = 0; y < h; ++y)
  {
    size_t x;
    for(x = 0; x < olinebits; ++x)
    {
      unsigned char bit = readBitFromReversedStream(&ibp, in);
      setBitOfReversedStream(&obp, out, bit);
    }
    ibp += diff;
  }
}

// Assembly:
testl %r8d, %r8d
je 0xc192
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rax
subq %rdx, %rax
xorl %r9d, %r9d
xorl %r11d, %r11d
xorl %r10d, %r10d
testq %rdx, %rdx
je 0xc17d
leaq (%r11,%rdx), %rbx
movq %rdx, %r14
movq %r10, %r15
movq %r15, %rcx
shrq $0x3, %rcx
movl %r15d, %ebp
notb %bpl
movzbl (%rsi,%rcx), %r12d
movzbl %bpl, %r13d
andl $0x7, %r13d
movl %r11d, %ecx
notb %cl
andb $0x7, %cl
movb $0x1, %bpl
shlb %cl, %bpl
btl %r13d, %r12d
jae 0xc15e
movq %r11, %rcx
shrq $0x3, %rcx
orb %bpl, (%rdi,%rcx)
jmp 0xc16c
notb %bpl
movq %r11, %rcx
shrq $0x3, %rcx
andb %bpl, (%rdi,%rcx)
incq %r11
incq %r15
decq %r14
jne 0xc123
addq %rdx, %r10
movq %rbx, %r11
addq %rax, %r10
incl %r9d
cmpl %r8d, %r9d
jne 0xc114
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: Adam7_getpassvalues
static void Adam7_getpassvalues(unsigned passw[7], unsigned passh[7], size_t filter_passstart[8],
                                size_t padded_passstart[8], size_t passstart[8], unsigned w, unsigned h, unsigned bpp)
{
  /*the passstart values have 8 values: the 8th one indicates the byte after the end of the 7th (= last) pass*/
  unsigned i;

  /*calculate width and height in pixels of each pass*/
  for(i = 0; i != 7; ++i)
  {
    passw[i] = (w + ADAM7_DX[i] - ADAM7_IX[i] - 1) / ADAM7_DX[i];
    passh[i] = (h + ADAM7_DY[i] - ADAM7_IY[i] - 1) / ADAM7_DY[i];
    if(passw[i] == 0) passh[i] = 0;
    if(passh[i] == 0) passw[i] = 0;
  }

  filter_passstart[0] = padded_passstart[0] = passstart[0] = 0;
  for(i = 0; i != 7; ++i)
  {
    /*if passw[i] is 0, it's 0 bytes, not 1 (no filtertype-byte)*/
    filter_passstart[i + 1] = filter_passstart[i]
                            + ((passw[i] && passh[i]) ? passh[i] * (1 + (passw[i] * bpp + 7) / 8) : 0);
    /*bits padded if needed to fill full byte at end of each scanline*/
    padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7) / 8);
    /*only padded at end of reduced image*/
    passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7) / 8;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r10
movl 0x38(%rsp), %ebx
xorl %r14d, %r14d
leaq 0x2742(%rip), %r15      # 0xe8f0
leaq 0x275b(%rip), %r12      # 0xe910
leaq 0x2774(%rip), %r13      # 0xe930
leaq 0x278d(%rip), %rbp      # 0xe950
movl (%r14,%r15), %r11d
movl (%r14,%r12), %eax
notl %eax
addl %r11d, %eax
addl %r9d, %eax
xorl %edx, %edx
divl %r11d
movl %eax, (%rdi,%r14)
movl (%r14,%r13), %r11d
movl (%r14,%rbp), %eax
notl %eax
addl %r11d, %eax
addl %ebx, %eax
xorl %edx, %edx
divl %r11d
movl %eax, (%rsi,%r14)
movl (%rdi,%r14), %edx
testl %edx, %edx
cmovel %edx, %eax
movl %eax, (%rsi,%r14)
testl %eax, %eax
jne 0xc20d
movl $0x0, (%rdi,%r14)
addq $0x4, %r14
cmpq $0x1c, %r14
jne 0xc1c3
xorl %eax, %eax
movq %rax, (%r8)
movq %rax, (%rcx)
movq %rax, (%r10)
movl 0x40(%rsp), %ebp
movl (%rdi,%rax), %edx
movl (%rsi,%rax), %r9d
testl %edx, %edx
je 0xc24c
testl %r9d, %r9d
je 0xc249
movl %edx, %ebx
imull %ebp, %ebx
addl $0x7, %ebx
shrl $0x3, %ebx
incl %ebx
imull %r9d, %ebx
jmp 0xc24e
xorl %r9d, %r9d
xorl %ebx, %ebx
addq (%r10,%rax,2), %rbx
movq %rbx, 0x8(%r10,%rax,2)
imull %ebp, %edx
leal 0x7(%rdx), %r11d
shrl $0x3, %r11d
imull %r9d, %r11d
addq (%rcx,%rax,2), %r11
movq %r11, 0x8(%rcx,%rax,2)
imull %r9d, %edx
addl $0x7, %edx
shrl $0x3, %edx
addq (%r8,%rax,2), %rdx
movq %rdx, 0x8(%r8,%rax,2)
addq $0x4, %rax
cmpq $0x1c, %rax
jne 0xc226
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: addPaddingBits
static void addPaddingBits(unsigned char* out, const unsigned char* in,
                           size_t olinebits, size_t ilinebits, unsigned h)
{
  /*The opposite of the removePaddingBits function
  olinebits must be >= ilinebits*/
  unsigned y;
  size_t diff = olinebits - ilinebits;
  size_t obp = 0, ibp = 0; /*bit pointers*/
  for(y = 0; y != h; ++y)
  {
    size_t x;
    for(x = 0; x < ilinebits; ++x)
    {
      unsigned char bit = readBitFromReversedStream(&ibp, in);
      setBitOfReversedStream(&obp, out, bit);
    }
    /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
    "Use of uninitialised value of size ###" warning from valgrind*/
    for(x = 0; x != diff; ++x) setBitOfReversedStream(&obp, out, 0);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x8(%rsp)
testl %r8d, %r8d
je 0xc364
movq %rcx, %rax
movq -0x8(%rsp), %rdx
subq %rcx, %rdx
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %r14d, %r14d
testq %rax, %rax
je 0xc32b
leaq (%r14,%rax), %rbx
movq %rax, %r15
movq %r11, %r12
movq %r12, %rcx
shrq $0x3, %rcx
movl %r12d, %ebp
notb %bpl
movzbl (%rsi,%rcx), %r13d
movzbl %bpl, %r9d
andl $0x7, %r9d
movl %r14d, %ecx
notb %cl
andb $0x7, %cl
movb $0x1, %bpl
shlb %cl, %bpl
btl %r9d, %r13d
jae 0xc30d
movq %r14, %rcx
shrq $0x3, %rcx
orb %bpl, (%rdi,%rcx)
jmp 0xc31b
notb %bpl
movq %r14, %rcx
shrq $0x3, %rcx
andb %bpl, (%rdi,%rcx)
incq %r14
incq %r12
decq %r15
jne 0xc2d2
addq %rax, %r11
jmp 0xc32e
movq %r14, %rbx
movq %rdx, %r14
cmpq %rax, -0x8(%rsp)
je 0xc355
movl %ebx, %ecx
notb %cl
movb $-0x2, %r9b
rolb %cl, %r9b
movq %rbx, %rcx
shrq $0x3, %rcx
andb %r9b, (%rdi,%rcx)
incq %rbx
decq %r14
jne 0xc338
incl %r10d
movq %rbx, %r14
cmpl %r8d, %r10d
jne 0xc2c3
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/txp-convert.c
// Function: unfiddle
unsigned char *unfiddle(unsigned char *source, unsigned int width, unsigned int height, unsigned int bpp) {
	unsigned char *retpixel = malloc(width*height);
	unsigned int x, y, yc0, yc1, xc0, xc1, memptr = 0;
	for(y = 0; y < height; y++) {
		yc0 = y*16;
		if(bpp == 4) {
			yc1 = y/8*(width*4-128);
			for(x = 0; x < width/2; x++) {
				xc0 = x/16*16;
				xc1 = x/16*128;
				retpixel[memptr] = source[x-xc0+xc1+yc0+yc1] & 0xF;
				memptr++;
				retpixel[memptr] = source[x-xc0+xc1+yc0+yc1] >> 4;
				memptr++;
			}
		}
		else {
			yc1 = y/8*(width*8-128);
			for(x = 0; x < width; x++) {
				xc0 = x/16*16;
				xc1 = x/16*128;
				retpixel[memptr] = source[x-xc0+xc1+yc0+yc1];
				memptr++;
			}
		}
	}
	return retpixel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl %edx, %edi
imull %esi, %edi
callq 0x1100
testl %ebp, %ebp
je 0xd608
leal -0x80(,%r14,8), %ecx
leal -0x80(,%r14,4), %edx
movl %edx, 0x4(%rsp)
movl %r14d, %esi
shrl %esi
xorl %edi, %edi
xorl %r8d, %r8d
movl %r8d, %r10d
shll $0x4, %r10d
cmpl $0x4, %ebx
jne 0xd5b4
cmpl $0x2, %r14d
jb 0xd5fc
movl %r8d, %r9d
shrl $0x3, %r9d
imull 0x4(%rsp), %r9d
addl %r10d, %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
movl %r10d, %r12d
andl $-0x80, %r12d
movl %r11d, %r13d
andl $0xf, %r13d
addl %r9d, %r13d
addl %r12d, %r13d
movb (%r15,%r13), %r12b
movl %r12d, %r13d
andb $0xf, %r13b
movl %edi, %edx
movb %r13b, (%rax,%rdx)
leal 0x1(%rdi), %edx
shrb $0x4, %r12b
movb %r12b, (%rax,%rdx)
addl $0x2, %edi
incl %r11d
addl $0x8, %r10d
cmpl %r11d, %esi
jne 0xd573
jmp 0xd5fc
testl %r14d, %r14d
je 0xd5fc
movl %r8d, %r9d
shrl $0x3, %r9d
imull %ecx, %r9d
addl %r10d, %r9d
xorl %r11d, %r11d
xorl %r10d, %r10d
leal (%rdi,%r10), %edx
movl %r11d, %r12d
andl $-0x80, %r12d
movl %r10d, %r13d
andl $0xf, %r13d
addl %r9d, %r13d
addl %r12d, %r13d
movb (%r15,%r13), %r12b
movb %r12b, (%rax,%rdx)
incl %r10d
addl $0x8, %r11d
cmpl %r10d, %r14d
jne 0xd5cd
addl %r10d, %edi
incl %r8d
cmpl %ebp, %r8d
jne 0xd547
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/txp-convert.c
// Function: buildPalette
paletteEntry *buildPalette(unsigned char *source, unsigned int bpp) {
	paletteEntry *retpal = NULL;
	unsigned int palsize;
	palsize = (bpp==4) ? 16:256;
	retpal = malloc(sizeof(paletteEntry)*palsize);
	unsigned int i, e = 0;
	for(i = 0; i < palsize; i++) {
		retpal[i].red = source[e];
		e++;
		retpal[i].green = source[e];
		e++;
		retpal[i].blue = source[e];
		e++;
		retpal[i].alpha = source[e];
		e++;
	}
	return retpal;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x4, %esi
movl $0x10, %eax
movl $0x100, %r14d           # imm = 0x100
cmovel %eax, %r14d
leal (,%r14,4), %edi
callq 0x1100
xorl %ecx, %ecx
movl (%rbx,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0xd63f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/txp-convert.c
// Function: getFramePixels
void getFramePixels(FILE *f, txpHeader header, textureHeader *textures, frameHeader *frames) {
	unsigned int i/*, j*/, palsize;
	uint32_t compressedsize;
	unsigned char *palette = NULL;
	for(i = 0; i < header.numframes; i++) {
		frames[i].texpixels = textures[frames[i].sourcetexture].texpixels;
		if(frames[i].palette == textures[frames[i].sourcetexture].palette) frames[i].palpixels = textures[frames[i].sourcetexture].palpixels;
		else {
			fseek(f, frames[i].palette, SEEK_SET);
			switch(textures[frames[i].sourcetexture].bpp) {
				case 4: {
					palsize = 16*4;
					break;
				}
				case 5: {
					palsize = 256*4;
					break;
				}
				case 6: {
					fseek(f, 20, SEEK_CUR);
					fread(&compressedsize, 4, 1, f);
					palsize = compressedsize;
					fseek(f, textures[i].palette, SEEK_SET);
					break;
				}
			}
			
			palette = malloc(palsize);
			fread(palette, palsize, 1, f);
			frames[i].palpixels = buildPalette(palette, textures[frames[i].sourcetexture].bpp);
			free(palette);
		}
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x5c(%rsp), %eax
testq %rax, %rax
je 0xd9c5
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
addq $0x14, %rbx
shlq $0x3, %rax
leaq (%rax,%rax,4), %r15
xorl %r12d, %r12d
movq %rdi, 0x10(%rsp)
movl (%rbx), %eax
movl 0x4(%rbx), %esi
leaq (%rax,%rax,4), %rax
movq 0x18(%r14,%rax,8), %rcx
movq %rcx, 0xc(%rbx)
cmpl 0x14(%r14,%rax,8), %esi
jne 0xd8f9
leaq (%r14,%rax,8), %rax
movq 0x20(%rax), %rax
movq %rax, 0x14(%rbx)
jmp 0xd9b4
movq %r13, %rdi
xorl %edx, %edx
callq 0x1120
movl (%rbx), %eax
leaq (%rax,%rax,4), %rax
movl (%r14,%rax,8), %eax
cmpl $0x6, %eax
je 0xd92e
cmpl $0x5, %eax
je 0xd927
cmpl $0x4, %eax
movl 0x8(%rsp), %eax
jne 0xd96c
movl $0x40, %eax
jmp 0xd96c
movl $0x400, %eax            # imm = 0x400
jmp 0xd96c
movl $0x14, %esi
movq %r13, %rdi
movl $0x1, %edx
callq 0x1120
movl $0x4, %esi
movl $0x1, %edx
leaq 0xc(%rsp), %rdi
movq %r13, %rcx
callq 0x1060
movl 0xc(%rsp), %ebp
movl 0x14(%r14,%r12), %esi
movq %r13, %rdi
xorl %edx, %edx
callq 0x1120
movl %ebp, %eax
movl %eax, 0x8(%rsp)
movl %eax, %r13d
movq %r13, %rdi
callq 0x1100
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %r13
movq %r13, %rcx
callq 0x1060
movl (%rbx), %eax
leaq (%rax,%rax,4), %rax
movl (%r14,%rax,8), %esi
movq %rbp, %rdi
callq 0xd617
movq %rax, 0x14(%rbx)
movq %rbp, %rdi
callq 0x1030
addq $0x30, %rbx
addq $0x28, %r12
cmpq %r12, %r15
jne 0xd8cf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/txp-convert.c
// Function: buildSingleFrameRgba
unsigned char *buildSingleFrameRgba(textureHeader *textures, frameHeader frame) {
	unsigned int x, y, mempointer = 0, framesize = frame.width * frame.height;
	unsigned char *retframe = malloc(framesize * 4), pixel;
	for(y = frame.sourcey; y < frame.sourcey+frame.height; y++) {
		for(x = frame.sourcex; x < frame.sourcex+frame.width; x++) {
			pixel = frame.texpixels[x+y*textures[frame.sourcetexture].width];
			retframe[mempointer] = frame.palpixels[pixel].red;
			mempointer++;
			retframe[mempointer] = frame.palpixels[pixel].green;
			mempointer++;
			retframe[mempointer] = frame.palpixels[pixel].blue;
			mempointer++;
			retframe[mempointer] = frame.palpixels[pixel].alpha;
			mempointer++;
		}
	}
	return retframe;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x44(%rsp), %r14d
movl 0x48(%rsp), %ebp
movl %r14d, %edi
imull %ebp, %edi
shll $0x2, %edi
callq 0x1100
movl 0x50(%rsp), %ecx
addl %ecx, %ebp
cmpl %ebp, %ecx
jae 0xda92
leaq 0x40(%rsp), %r8
movl 0xc(%r8), %edx
movl 0x14(%r8), %edi
addl %edx, %r14d
movq 0x20(%r8), %rsi
leaq (%rdi,%rdi,4), %rdi
leaq (%rbx,%rdi,8), %rdi
addq $0x8, %rdi
movq 0x28(%r8), %r8
movq %r14, %r9
subq %rdx, %r9
xorl %r10d, %r10d
cmpl %r14d, %edx
jae 0xda8c
movl (%rdi), %r11d
imull %ecx, %r11d
addl %edx, %r11d
movq %r9, %rbx
movl %r11d, %r15d
movzbl (%rsi,%r15), %r15d
movb (%r8,%r15,4), %r12b
movl %r10d, %r13d
movb %r12b, (%rax,%r13)
leal 0x1(%r10), %r12d
movb 0x1(%r8,%r15,4), %r13b
movb %r13b, (%rax,%r12)
leal 0x2(%r10), %r12d
movb 0x2(%r8,%r15,4), %r13b
movb %r13b, (%rax,%r12)
leal 0x3(%r10), %r12d
movb 0x3(%r8,%r15,4), %r15b
movb %r15b, (%rax,%r12)
addl $0x4, %r10d
incl %r11d
decq %rbx
jne 0xda46
incl %ecx
cmpl %ebp, %ecx
jne 0xda34
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/tracegen.c
// Function: validate
int validate(int fn,int M, int N, int A[N][M], int B[M][N]) {
    int C[M][N];
    memset(C,0,sizeof(C));
    correctTrans(M,N,A,C);
    for(int i=0;i<M;i++) {
        for(int j=0;j<N;j++) {
            if(B[i][j]!=C[i][j]) {
                printf("Validation failed on function %d! Expected %d but got %d at B[%d][%d]\n",fn,C[i][j],B[i][j],i,j);
                return 0;
            }
        }
    }
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, -0x40(%rbp)
movl %edx, %r15d
movl %esi, %r13d
movl %edi, -0x2c(%rbp)
movl %edx, %ebx
movl %esi, %eax
movq %rbx, %rdx
movq %rax, -0x38(%rbp)
imulq %rax, %rdx
leaq 0xf(,%rdx,4), %rax
andq $-0x10, %rax
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
shlq $0x2, %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x1070
movl %r13d, %edi
movl %r15d, %esi
movq -0x40(%rbp), %rdx
movq %r12, %rcx
callq 0x5640
movl $0x1, %eax
testl %r13d, %r13d
jle 0x12c8
leaq (,%rbx,4), %rsi
xorl %r8d, %r8d
xorl %r13d, %r13d
movq -0x38(%rbp), %rdi
testl %r15d, %r15d
jle 0x1299
xorl %r9d, %r9d
movl (%r14,%r9,4), %ecx
movl (%r12,%r9,4), %edx
cmpl %edx, %ecx
jne 0x12b0
incq %r9
cmpq %r9, %rbx
jne 0x1285
incq %r8
cmpq %rdi, %r8
setae %r13b
addq %rsi, %r12
addq %rsi, %r14
cmpq %rdi, %r8
jne 0x127d
jmp 0x12c8
leaq 0x4d4d(%rip), %rdi      # 0x6004
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1050
movzbl %r13b, %eax
andl $0x1, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/cachelab.c
// Function: printSummary
void printSummary(int hits, int misses, int evictions)
{
    printf("hits:%d misses:%d evictions:%d\n", hits, misses, evictions);
    FILE* output_fp = fopen(".csim_results", "w");
    assert(output_fp);
    fprintf(output_fp, "%d %d %d\n", hits, misses, evictions);
    fclose(output_fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %r14d
movl %edi, %r15d
leaq 0xc08(%rip), %rdi       # 0x60ba
movl %r15d, %esi
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1050
leaq 0xc12(%rip), %rdi       # 0x60da
leaq 0xb8b(%rip), %rsi       # 0x605a
callq 0x10b0
testq %rax, %rax
je 0x5506
movq %rax, %r12
leaq 0xc3b(%rip), %rsi       # 0x611e
movq %rax, %rdi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x1090
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1040
leaq 0xbdb(%rip), %rdi       # 0x60e8
leaq 0xbde(%rip), %rsi       # 0x60f2
leaq 0xbe2(%rip), %rcx       # 0x60fd
movl $0x15, %edx
callq 0x1060
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/cachelab.c
// Function: initMatrix
void initMatrix(int M, int N, int A[N][M], int B[M][N])
{
    int i, j;
    srand(time(NULL));
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            // A[i][j] = i+j;  /* The matrix created this way is symmetric */
            A[i][j]=rand();
            B[j][i]=rand();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, %r14
movl %esi, %r12d
movl %edi, -0x2c(%rbp)
xorl %edi, %edi
callq 0x10a0
movl %eax, %edi
callq 0x1080
testl %r12d, %r12d
jle 0x55b9
movl -0x2c(%rbp), %r13d
movl %r12d, %eax
movq %rax, -0x48(%rbp)
leaq (,%rax,4), %r15
leaq (,%r13,4), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x55a3
movq -0x38(%rbp), %rbx
xorl %r12d, %r12d
callq 0x10f0
movl %eax, (%r14,%r12,4)
callq 0x10f0
movl %eax, (%rbx)
incq %r12
addq %r15, %rbx
cmpq %r12, %r13
jne 0x5588
movq -0x50(%rbp), %rax
incq %rax
addq $0x4, -0x38(%rbp)
addq -0x40(%rbp), %r14
cmpq -0x48(%rbp), %rax
jne 0x5577
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/cachelab.c
// Function: randMatrix
void randMatrix(int M, int N, int A[N][M]) {
    int i, j;
    srand(time(NULL));
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            // A[i][j] = i+j;  /* The matrix created this way is symmetric */
            A[i][j]=rand();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl %esi, %r15d
movl %edi, -0x2c(%rbp)
xorl %edi, %edi
callq 0x10a0
movl %eax, %edi
callq 0x1080
testl %r15d, %r15d
jle 0x5631
movl -0x2c(%rbp), %r12d
movl %r15d, %eax
movq %rax, -0x38(%rbp)
leaq (,%r12,4), %r13
xorl %r14d, %r14d
cmpl $0x0, -0x2c(%rbp)
jle 0x5625
xorl %r15d, %r15d
callq 0x10f0
movl %eax, (%rbx,%r15,4)
incq %r15
cmpq %r15, %r12
jne 0x5614
incq %r14
addq %r13, %rbx
cmpq -0x38(%rbp), %r14
jne 0x560b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/cachelab.c
// Function: correctTrans
void correctTrans(int M, int N, int A[N][M], int B[M][N])
{
    int i, j, tmp;
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            tmp = A[i][j];
            B[j][i] = tmp;
        }
    }    
}

// Assembly:
testl %esi, %esi
jle 0x5690
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %eax
movl %esi, %esi
leaq (,%rsi,4), %r8
leaq (,%rax,4), %r9
xorl %r10d, %r10d
testl %edi, %edi
jle 0x567d
movq %rcx, %r11
xorl %ebx, %ebx
movl (%rdx,%rbx,4), %r14d
movl %r14d, (%r11)
incq %rbx
addq %r8, %r11
cmpq %rbx, %rax
jne 0x566b
incq %r10
addq $0x4, %rcx
addq %r9, %rdx
cmpq %rsi, %r10
jne 0x5662
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/YanjieZe[P]CacheLab/cachelab.c
// Function: registerTransFunction
void registerTransFunction(void (*trans)(int M, int N, int[N][M], int[M][N]), 
                           char* desc)
{
    func_list[func_counter].func_ptr = trans;
    func_list[func_counter].description = desc;
    func_list[func_counter].correct = 0;
    func_list[func_counter].num_hits = 0;
    func_list[func_counter].num_misses = 0;
    func_list[func_counter].num_evictions =0;
    func_counter++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq 0x82ce4(%rip), %rax     # 0x88380
leal 0x1(%rax), %ecx
shlq $0x5, %rax
leaq 0x82ce6(%rip), %rdx     # 0x88390
movq %rdi, (%rax,%rdx)
movq %rsi, 0x8(%rax,%rdx)
movb $0x0, 0x10(%rax,%rdx)
movq $0x0, 0x14(%rax,%rdx)
movl $0x0, 0x1c(%rax,%rdx)
movl %ecx, 0x82cb1(%rip)     # 0x88380
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceGstmtC
int ReduceGstmtC(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 4);
    SYNTAX_TREE* identifier1 = node->children[0];
    SYNTAX_TREE* type1 = node->children[2];
    SYNTAX_TREE* block1 = node->children[3];

    int error = 0;
    error = (error ? error : ProcessNode(identifier1));
    error = (error ? error : ProcessNode(type1));
    error = (error ? error : ProcessNode(block1));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq 0x10(%rax), %r14
movq 0x18(%rax), %rbx
callq 0x224d
testl %eax, %eax
jne 0x2518
movq %r14, %rdi
callq 0x224d
testl %eax, %eax
je 0x251d
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceGstmtD
int ReduceGstmtD(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 7);
    SYNTAX_TREE* identifier1 = node->children[0];
    SYNTAX_TREE* param_1 = node->children[2];
    SYNTAX_TREE* type1 = node->children[5];
    SYNTAX_TREE* block1 = node->children[6];

    int error = 0;
    error = (error ? error : ProcessNode(identifier1));
    error = (error ? error : ProcessNode(param_1));
    error = (error ? error : ProcessNode(type1));
    error = (error ? error : ProcessNode(block1));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq 0x10(%rax), %r15
movq 0x28(%rax), %r14
movq 0x30(%rax), %rbx
callq 0x224d
testl %eax, %eax
jne 0x2567
movq %r15, %rdi
callq 0x224d
testl %eax, %eax
jne 0x2567
movq %r14, %rdi
callq 0x224d
testl %eax, %eax
je 0x2572
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceParamStarB
int ReduceParamStarB(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 5);
    SYNTAX_TREE* identifier1 = node->children[0];
    SYNTAX_TREE* type1 = node->children[2];
    SYNTAX_TREE* param_1 = node->children[4];

    int error = 0;
    error = (error ? error : ProcessNode(identifier1));
    error = (error ? error : ProcessNode(type1));
    error = (error ? error : ProcessNode(param_1));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq 0x10(%rax), %r14
movq 0x20(%rax), %rbx
callq 0x224d
testl %eax, %eax
jne 0x25de
movq %r14, %rdi
callq 0x224d
testl %eax, %eax
je 0x25e3
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceFstmtC
int ReduceFstmtC(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 7);
    SYNTAX_TREE* identifier1 = node->children[0];
    SYNTAX_TREE* expr1 = node->children[2];
    SYNTAX_TREE* expr2 = node->children[5];

    int error = 0;
    error = (error ? error : ProcessNode(identifier1));
    error = (error ? error : ProcessNode(expr1));
    error = (error ? error : ProcessNode(expr2));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq 0x10(%rax), %r14
movq 0x28(%rax), %rbx
callq 0x224d
testl %eax, %eax
jne 0x26dc
movq %r14, %rdi
callq 0x224d
testl %eax, %eax
je 0x26e1
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceFstmtE
int ReduceFstmtE(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 6);
    SYNTAX_TREE* expr1 = node->children[2];
    SYNTAX_TREE* block1 = node->children[4];
    SYNTAX_TREE* else1 = node->children[5];

    int error = 0;
    error = (error ? error : ProcessNode(expr1));
    error = (error ? error : ProcessNode(block1));
    error = (error ? error : ProcessNode(else1));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rax), %r14
movq 0x28(%rax), %rbx
callq 0x224d
testl %eax, %eax
jne 0x272a
movq %r14, %rdi
callq 0x224d
testl %eax, %eax
je 0x272f
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/autostubs.c
// Function: ReduceTermA
int ReduceTermA(SYNTAX_TREE* node)
{
    Assert(node->numChildren == 3);
    SYNTAX_TREE* term1 = node->children[0];
    SYNTAX_TREE* factor1 = node->children[2];

    int error = 0;
    error = (error ? error : ProcessNode(term1));
    error = (error ? error : ProcessNode(factor1));

    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq 0x10(%rax), %rbx
callq 0x224d
testl %eax, %eax
je 0x2a55
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x224d
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/generator.c
// Function: OutputProgram
int OutputProgram(const char* destination)
{
    FILE* output;
    int nbytes;

    output = fopen(destination, "wb");
    if (output == NULL)
    {
        return 1;
    }

    nbytes = 8 * VariableCount(gPrgrmVariables);
    fprintf(output, "# Program assembly from min comp\r\n");
    fprintf(output, "# Target: 32-bit Unix assembly\r\n");
    fprintf(output, ".global main\r\n");
    fprintf(output, "\r\n");
    fprintf(output, ".data\r\n");
    fprintf(output, "static_heap:\r\n");
    fprintf(output, ".space %i, 0\r\n", nbytes);
    fprintf(output, "\r\n");
    /* output static strings and static data */

    fprintf(output, ".text\r\n");

    EmitCodeMain(output);
    EmitCodeLibrary(output);
    EmitCodeProgram(output);

    fprintf(output, "# End Of Assembly\r\n");
    fprintf(output, "\r\n");
    fclose(output);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x54fb(%rip), %rsi      # 0x8145
callq 0x2120
testq %rax, %rax
je 0x2da6
movq %rax, %rbx
leaq 0x1670e(%rip), %rax     # 0x19370
movq (%rax), %rdi
callq 0x6445
leal (,%rax,8), %r15d
leaq 0x54cf(%rip), %rdi      # 0x8148
movl $0x22, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x54d9(%rip), %rdi      # 0x816b
movl $0x20, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x54e1(%rip), %rdi      # 0x818c
movl $0xe, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x54fa(%rip), %r14      # 0x81be
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x2130
leaq 0x54bb(%rip), %rdi      # 0x819b
movl $0x7, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x54aa(%rip), %rdi      # 0x81a3
movl $0xe, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x54a0(%rip), %rsi      # 0x81b2
xorl %r12d, %r12d
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x20e0
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x2130
leaq 0x5483(%rip), %rdi      # 0x81c1
movl $0x7, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
leaq 0x53d9(%rip), %rdi      # 0x8130
movl $0x7, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
callq 0x2c09
leaq 0x5454(%rip), %rdi      # 0x81c9
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2130
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x2130
movq %rbx, %rdi
callq 0x2070
jmp 0x2dac
movl $0x1, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: GetElement
char* GetElement(int i, GRAMMAR_TABLE grammar)
{
    char* search;
    char* end;
    int   index;

    if (i & K_SYMBOL) {
        search = grammar.symbols;
        end = grammar.symbols + SYMBOL_BUFFER_SIZE;
        i ^= K_SYMBOL;
    } else if (i & K_TOKEN) {
        search = grammar.tokens;
        end = grammar.tokens + TOKEN_BUFFER_SIZE;
        i ^= K_TOKEN;
    } else {
        return 0;
    }

    index = 1;
    while (index < i &&
           search < end)
    {
        while (search[0] != 0 && search != end)
            search++;
        search++;
        index++;
    }

    if (search < end)
        return search;
    return 0;
}

// Assembly:
btl $0xc, %edi
jb 0x2dc7
btl $0xd, %edi
jb 0x2dd3
xorl %eax, %eax
retq
movl $0xffffefff, %ecx       # imm = 0xFFFFEFFF
movl $0x8, %eax
jmp 0x2ddd
movl $0xffffcfff, %ecx       # imm = 0xFFFFCFFF
movl $0x18, %eax
pushq %rbp
movq %rsp, %rbp
leaq 0x10(%rbp), %rdx
andl %edi, %ecx
movq (%rdx,%rax), %rax
cmpl $0x2, %ecx
jl 0x2e40
movl $0x1, %edx
xorl %esi, %esi
leaq -0x1000(%rsi), %r8
leaq (%rax,%rsi), %r10
xorl %r9d, %r9d
movq %r9, %r11
decq %r9
leaq 0x1(%r10), %rdi
cmpq %r11, %r8
je 0x2e1d
cmpb $0x0, (%r10)
movq %rdi, %r10
jne 0x2e05
incl %edx
subq %r9, %rsi
leaq -0x1(%rsi), %r8
cmpl %ecx, %edx
jge 0x2e33
cmpq $0xfff, %r8             # imm = 0xFFF
jl 0x2df7
xorl %eax, %eax
cmpq $0xfff, %r8             # imm = 0xFFF
cmovlq %rdi, %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: GetRule
RULE* GetRule(int lhs, int n, GRAMMAR_TABLE grammar)
{
    int r;
    for (r = 0; r < grammar.numRules; r++)
    {
        if (grammar.rules[r].lhs == lhs) {
            if (n == 0)
                return grammar.rules + r;
            n--;
        }
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq 0x30(%rbp), %rcx
testq %rcx, %rcx
jle 0x2e6a
leaq 0x10(%rbp), %rax
movq 0x28(%rax), %rax
cmpl %edi, (%rax)
jne 0x2e61
testl %esi, %esi
je 0x2e6c
decl %esi
addq $0x10, %rax
decq %rcx
jne 0x2e57
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: AddSymbol
int AddSymbol(char*          string,
              int            len,
              GRAMMAR_TABLE* grammar)
{
    int   j;
    char* search = grammar->symbols;
    char* end = grammar->symbols + SYMBOL_BUFFER_SIZE;
    int   index = 1;
    while (index <= grammar->numSymbols &&
           search < end)
    {
        for (j = 0; j < len; j++)
        {
            if (string[j] != search[j])
                break;
        }
        if (j == len && search[j] == 0)
        {
            return index | K_SYMBOL;
        }
        while (search[0] != 0 && search != end)
            search++;
        search++;
        index++;
    }

    if (search < end)
    {
        for (j = 0; j < len && search < end; j++)
        {
            search[0] = string[j];
            search++;
        }
        search[0] = 0;
        grammar->numSymbols++;
        return index | K_SYMBOL;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x8(%rdx), %rcx
movl (%rdx), %r9d
testl %r9d, %r9d
jle 0x2f26
movl %esi, %r10d
movl $0x1, %eax
xorl %r15d, %r15d
movq %rcx, %r11
movq %r15, %r8
movl $0x0, %ebx
testl %esi, %esi
jle 0x2eb9
xorl %ebx, %ebx
movb (%rdi,%rbx), %r14b
cmpb (%r11,%rbx), %r14b
jne 0x2eb9
incq %rbx
cmpq %rbx, %r10
jne 0x2ea5
jmp 0x2ebd
cmpl %esi, %ebx
jne 0x2ec8
cmpb $0x0, (%r11,%r10)
je 0x2f64
leaq -0x1000(%r8), %r14
leaq (%rcx,%r8), %r15
xorl %ebx, %ebx
movq %rbx, %r12
decq %rbx
leaq 0x1(%r15), %r11
cmpq %r12, %r14
je 0x2eed
cmpb $0x0, (%r15)
movq %r11, %r15
jne 0x2ed5
leal 0x1(%rax), %r14d
movq %r8, %r15
subq %rbx, %r15
leaq -0x1(%r15), %r12
cmpl %r9d, %eax
jge 0x2f0c
movl %r14d, %eax
cmpq $0xfff, %r12            # imm = 0xFFF
jl 0x2e97
xorl %eax, %eax
cmpq $0xffe, %r12            # imm = 0xFFE
jg 0x2f69
orl $0x1000, %r14d          # imm = 0x1000
subq %rbx, %r8
movl %r14d, %eax
jmp 0x2f2e
movl $0x1001, %eax           # imm = 0x1001
xorl %r8d, %r8d
addq %r8, %rcx
testl %esi, %esi
jle 0x2f5d
movl %esi, %esi
xorl %r9d, %r9d
movb (%rdi,%r9), %r10b
movb %r10b, (%rcx,%r9)
leaq 0x1(%r9), %r10
cmpq %rsi, %r10
jae 0x2f5a
addq %r8, %r9
cmpq $0xfff, %r9             # imm = 0xFFF
movq %r10, %r9
jl 0x2f3a
addq %r10, %rcx
movb $0x0, (%rcx)
incl (%rdx)
jmp 0x2f69
orl $0x1000, %eax           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: AddToken
int AddToken(char*           string,
              int            len,
              GRAMMAR_TABLE* grammar)
{
    int   j;
    char* search = grammar->tokens;
    char* end = grammar->tokens + TOKEN_BUFFER_SIZE;
    int   index = 1;
    while (index <= grammar->numTokens &&
           search < end)
    {
        for (j = 0; j < len; j++)
        {
            if (string[j] == '\\') j++;
            if (string[j] != search[j])
                break;
        }
        if (j == len && search[j] == 0)
        {
            return index | K_TOKEN;
        }
        while (search[0] != 0 && search != end)
            search++;
        search++;
        index++;
    }

    if (search < end)
    {
        for (j = 0; j < len && search < end; j++)
        {
            if (string[j] == '\\') j++;
            search[0] = string[j];
            search++;
        }
        search[0] = 0;
        grammar->numTokens++;
        return index | K_TOKEN;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x18(%rdx), %rcx
movl 0x10(%rdx), %r9d
testl %r9d, %r9d
jle 0x303f
movslq %esi, %r10
movl $0x1, %eax
xorl %r15d, %r15d
movq %rcx, %r11
movq %r15, %r8
movl $0x0, %ebx
testl %esi, %esi
jle 0x2fce
xorl %ebx, %ebx
movslq %ebx, %rbx
xorl %r14d, %r14d
cmpb $0x5c, (%rdi,%rbx)
sete %r14b
addl %r14d, %ebx
movslq %ebx, %r14
movb (%rdi,%r14), %r15b
cmpb (%r11,%r14), %r15b
jne 0x2fce
incl %ebx
cmpl %esi, %ebx
jl 0x2faa
cmpl %esi, %ebx
jne 0x2fdd
cmpb $0x0, (%r11,%r10)
je 0x3097
leaq -0x1000(%r8), %r14
leaq (%rcx,%r8), %r15
xorl %ebx, %ebx
movq %rbx, %r12
decq %rbx
leaq 0x1(%r15), %r11
cmpq %r12, %r14
je 0x3002
cmpb $0x0, (%r15)
movq %r11, %r15
jne 0x2fea
leal 0x1(%rax), %r14d
movq %r8, %r15
subq %rbx, %r15
leaq -0x1(%r15), %r12
cmpl %r9d, %eax
jge 0x3025
movl %r14d, %eax
cmpq $0xfff, %r12            # imm = 0xFFF
jl 0x2f9c
xorl %eax, %eax
cmpq $0xffe, %r12            # imm = 0xFFE
jg 0x309c
orl $0x2000, %r14d          # imm = 0x2000
subq %rbx, %r8
movl %r14d, %eax
jmp 0x3047
movl $0x2001, %eax           # imm = 0x2001
xorl %r8d, %r8d
testl %esi, %esi
jle 0x308c
xorl %r9d, %r9d
movslq %r9d, %r9
xorl %r11d, %r11d
cmpb $0x5c, (%rdi,%r9)
sete %r11b
leal (%r9,%r11), %r10d
movslq %r10d, %r10
movb (%rdi,%r10), %r10b
movb %r10b, (%rcx,%r8)
leaq 0x1(%r8), %r10
addl %r11d, %r9d
incl %r9d
cmpl %esi, %r9d
jge 0x3087
cmpq $0xfff, %r8             # imm = 0xFFF
movq %r10, %r8
jl 0x304e
addq %r10, %rcx
jmp 0x308f
addq %r8, %rcx
movb $0x0, (%rcx)
incl 0x10(%rdx)
jmp 0x309c
orl $0x2000, %eax           # imm = 0x2000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: FindToken
int FindToken(char*          string,
              int            len,
              GRAMMAR_TABLE  grammar)
{
    int   j;
    char* search = grammar.tokens;
    char* end = grammar.tokens + TOKEN_BUFFER_SIZE;
    int   index = 1;
    while (index <= grammar.numTokens &&
           search < end)
    {
        for (j = 0; j < len; j++)
        {
            if (string[j] == '\\') j++;
#ifdef CASE_SENSITIVE_KEYWORDS
            if (string[j] != search[j])
                break;
#else
            if (toupper(string[j]) != toupper(search[j]))
                break;
#endif
        }
        if (j == len && search[j] == 0)
        {
            return index | K_TOKEN;
        }
        while (search[0] != 0 && search != end)
            search++;
        search++;
        index++;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
movl 0x20(%rbp), %ecx
testl %ecx, %ecx
jle 0x3140
movq 0x28(%rbp), %r8
movslq %esi, %r9
movl $0x1, %edx
xorl %r10d, %r10d
movq %r8, %r11
movl $0x0, %eax
testl %esi, %esi
jle 0x30f6
xorl %eax, %eax
cltq
xorl %ebx, %ebx
cmpb $0x5c, (%rdi,%rax)
sete %bl
addl %ebx, %eax
movslq %eax, %rbx
movb (%rdi,%rbx), %r14b
cmpb (%r11,%rbx), %r14b
jne 0x30f6
incl %eax
cmpl %esi, %eax
jl 0x30d6
cmpl %esi, %eax
jne 0x3101
cmpb $0x0, (%r11,%r9)
je 0x3144
leaq -0x1000(%r10), %rax
leaq (%r8,%r10), %r14
xorl %ebx, %ebx
movq %rbx, %r15
decq %rbx
leaq 0x1(%r14), %r11
cmpq %r15, %rax
je 0x3126
cmpb $0x0, (%r14)
movq %r11, %r14
jne 0x310e
xorl %eax, %eax
cmpl %ecx, %edx
jge 0x314c
incl %edx
subq %rbx, %r10
leaq -0x1(%r10), %rbx
cmpq $0xfff, %rbx            # imm = 0xFFF
jl 0x30cb
jmp 0x314c
xorl %eax, %eax
jmp 0x314c
orl $0x2000, %edx           # imm = 0x2000
movl %edx, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/grammar.c
// Function: FreeGrammarTable
void FreeGrammarTable(GRAMMAR_TABLE* table)
{
    int i;

    free(table->symbols);
    free(table->tokens);
    table->numSymbols = 0;
    table->numTokens = 0;

    for (i = 0; i < table->numRules; i++)
    {
        free(table->rules[i].rhs);
    }
    free(table->rules);
    table->numRules = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x2030
movq 0x18(%rbx), %rdi
callq 0x2030
xorl %eax, %eax
movl %eax, (%rbx)
movl %eax, 0x10(%rbx)
cmpl %eax, 0x20(%rbx)
jle 0x31a4
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2030
incq %r15
movslq 0x20(%rbx), %rax
addq $0x10, %r14
cmpq %rax, %r15
jl 0x3187
movq 0x28(%rbx), %rdi
callq 0x2030
movl $0x0, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/lexer.c
// Function: LexAddBlock
void LexAddBlock(L_TOKEN** start,
                 L_TOKEN** end,
                 L_TOKEN*  next)
{
    if (next) {
        if (next->string)
        {
            // use null terminated strings
            char* buffer = (char*)malloc(sizeof(char) * (next->length + 1));
            int i;
#ifdef CASE_SENSITIVE
            for (i = 0; i < next->length; i++)
                buffer[i] = next->string[i];
#else
            if (next->token == gSymbolIdentifier) {
                for (i = 0; i < next->length; i++)
                    buffer[i] = tolower(next->string[i]);
            } else {
                for (i = 0; i < next->length; i++)
                    buffer[i] = next->string[i];
            }
#endif
            buffer[i] = '\0';
            next->string = buffer;
        }

        if (*start)
            (*end)->next = next;
        else
            *start = next;
        *end = next;
    }
}

// Assembly:
testq %rdx, %rdx
je 0x3ce5
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdx), %r13
testq %r13, %r13
je 0x3cc4
movslq 0x10(%rbx), %r12
leaq 0x1(%r12), %rdi
callq 0x2100
testq %r12, %r12
jle 0x3cb8
xorl %ecx, %ecx
movb (%r13,%rcx), %dl
movb %dl, (%rax,%rcx)
incq %rcx
cmpq %rcx, %r12
jne 0x3ca6
jmp 0x3cbb
xorl %r12d, %r12d
movb $0x0, (%rax,%r12)
movq %rax, 0x8(%rbx)
cmpq $0x0, (%r15)
je 0x3cd1
movq (%r14), %r15
addq $0x18, %r15
movq %rbx, (%r15)
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/lexer.c
// Function: INTEGER
L_TOKEN* INTEGER(char* source,
                 int   start,
                 int   end,
                 int   line)
{
    L_TOKEN* block = (L_TOKEN*)malloc(sizeof(L_TOKEN));

    // number
    block->token = gSymbolInteger;
    block->string = source + start;
    block->length = end - start;
    block->line = line;
    block->next = 0;

    return block;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
movl $0x20, %edi
callq 0x2100
leaq 0x8343(%rip), %rcx      # 0xc0c0
movl (%rcx), %ecx
movl %ecx, (%rax)
movslq %r15d, %rcx
addq %rcx, %r12
movq %r12, 0x8(%rax)
subl %ecx, %r14d
movl %r14d, 0x10(%rax)
movl %ebx, 0x14(%rax)
movq $0x0, 0x18(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/lexer.c
// Function: FLOAT
L_TOKEN* FLOAT(char* source,
               int   start,
               int   end,
               int   line)
{
    L_TOKEN* block = (L_TOKEN*)malloc(sizeof(L_TOKEN));
    
    // floating-point number
    block->token = gSymbolFloat;
    block->string = source + start;
    block->length = end - start;
    block->line = line;
    block->next = 0;

    return block;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
movl $0x20, %edi
callq 0x2100
leaq 0x82f7(%rip), %rcx      # 0xc0c4
movl (%rcx), %ecx
movl %ecx, (%rax)
movslq %r15d, %rcx
addq %rcx, %r12
movq %r12, 0x8(%rax)
subl %ecx, %r14d
movl %r14d, 0x10(%rax)
movl %ebx, 0x14(%rax)
movq $0x0, 0x18(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gregtour[P]minimal-compiler/lexer.c
// Function: TOKEN
L_TOKEN* TOKEN(char*          source,
               int            start,
               int            end,
               int            line,
               GRAMMAR_TABLE  grammar)
{
    int token;
    L_TOKEN* block = (L_TOKEN*)malloc(sizeof(L_TOKEN));

    token = FindToken(&source[start], end - start, grammar);
    if (token) {
        // token
        block->token = token;
        block->string = source + start;
        block->length = end - start;
        block->line = line;
        block->next = 0;
    } else {
        // identifier
        free(block);
        block = NULL;
        printf("Syntax error on line %i, ", line+1);
        printf("Error, illegal identifier: ");
        while (start < end)
            printf("0x%X", source[start++]);
        printf("\n");
    }

    return block;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movl $0x20, %edi
callq 0x2100
movq %rax, %r13
movl %r15d, -0x2c(%rbp)
movslq %r15d, %rax
addq %rax, %rbx
movl %r14d, %r15d
subl %eax, %r15d
movaps 0x10(%rbp), %xmm0
movaps 0x20(%rbp), %xmm1
movaps 0x30(%rbp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30a5
testl %eax, %eax
je 0x3ecb
movl %eax, (%r13)
movq %rbx, 0x8(%r13)
movl %r15d, 0x10(%r13)
movl %r12d, 0x14(%r13)
movq $0x0, 0x18(%r13)
jmp 0x3f29
movq %r13, %rdi
callq 0x2030
incl %r12d
leaq 0x460f(%rip), %rdi      # 0x84ec
movl %r12d, %esi
xorl %eax, %eax
callq 0x2090
leaq 0x4618(%rip), %rdi      # 0x8506
xorl %eax, %eax
callq 0x2090
subl -0x2c(%rbp), %r14d
jle 0x3f1c
leaq 0x4620(%rip), %r15      # 0x8522
xorl %r12d, %r12d
movsbl (%rbx,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2090
incq %r12
cmpl %r12d, %r14d
jne 0x3f05
movl $0xa, %edi
callq 0x2040
xorl %r13d, %r13d
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq