LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/tests/basic_pipe.c
// Function: child_main
static void child_main(libforks_ServerConn conn, int socket_fd) {
  check(libforks_free_conn(conn) == libforks_OK);
  check(close(pipe_fds[0]) == 0);
  check(socket_fd == -1);
  check(getpid() != main_process_pid);
  check(write(pipe_fds[1], "a", 1) == 1);
}

// Assembly:
pushq %rbx
movl %esi, %ebx
callq 0x229b
testl %eax, %eax
jne 0x143e
movl 0x4d0a(%rip), %edi      # 0x6110
callq 0x10c0
testl %eax, %eax
jne 0x1449
cmpl $-0x1, %ebx
jne 0x1454
callq 0x1090
cmpl 0x4ced(%rip), %eax      # 0x610c
je 0x145f
movl 0x4ced(%rip), %edi      # 0x6114
leaq 0x1d68(%rip), %rsi      # 0x3196
pushq $0x1
popq %rdx
callq 0x1080
cmpq $0x1, %rax
jne 0x146a
popq %rbx
retq
leaq 0x1ce4(%rip), %rdi      # 0x3129
pushq $0x7
jmp 0x1473
leaq 0x1d01(%rip), %rdi      # 0x3151
pushq $0x8
jmp 0x1473
leaq 0x1d0e(%rip), %rdi      # 0x3169
pushq $0x9
jmp 0x1473
leaq 0x1d13(%rip), %rdi      # 0x3179
pushq $0xa
jmp 0x1473
leaq 0x1d27(%rip), %rdi      # 0x3198
pushq $0xb
popq %rsi
callq 0x13c9
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/converters/littcvt/littcvt.c
// Function: main
int main (int argc, char *argv[])
{
int i, k, bc;
unsigned char buf[FLPSIZ];
char *ppos, oname[256];
FILE *ifile, *ofile;

if ((argc < 2) || (argv[0] == NULL)) {
	printf ("Usage is: verb file [file...]\n");
	exit (0);  }

for (i = 1; i < argc; i++) {
	strcpy (oname, argv[i]);
        if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
                else strcat (oname, ".new");
	ifile = fopen (argv[i], "rb");
	if (ifile == NULL) {
		printf ("Error opening file: %s\n", argv[i]);
		exit (0);  }
	ofile = fopen (oname, "wb");
	if (ofile == NULL) {
		printf ("Error opening file: %s\n", oname);
		exit (0);  }

	printf ("Processing file %s\n", argv[i]);
	fread (&bc, sizeof (int), 1, ifile);
	for (;;) {
		k = fread (buf, sizeof (char), FLPSIZ, ifile);
		if (k == 0) break;
		fwrite (buf, sizeof (char), k, ofile);  }
	fclose (ifile);
	fclose (ofile);
}

exit (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10128, %rsp          # imm = 0x10128
cmpl $0x2, %edi
jl 0x11eb
movq %rsi, %rbx
cmpq $0x0, (%rsi)
jne 0x11fe
leaq 0xe49(%rip), %rdi       # 0x203b
callq 0x1040
xorl %edi, %edi
callq 0x10b0
movl %edi, %eax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %r14
leaq 0x20(%rsp), %r13
leaq 0x120(%rsp), %rbp
movq %r14, %rax
cmpq 0x10(%rsp), %rax
je 0x11f7
movq (%rbx,%rax,8), %r12
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %r15
callq 0x1030
movq %r13, %rdi
pushq $0x2e
popq %rsi
callq 0x1090
testq %rax, %rax
movq %r15, 0x8(%rsp)
je 0x1257
movb $0x0, 0x4(%rax)
movl $0x77656e2e, (%rax)     # imm = 0x77656E2E
movq (%rbx,%r15,8), %r12
jmp 0x126c
movq %r13, %rdi
callq 0x1070
movl $0x77656e2e, 0x20(%rsp,%rax) # imm = 0x77656E2E
movb $0x0, 0x24(%rsp,%rax)
movq %r12, %rdi
leaq 0xd93(%rip), %rsi       # 0x2009
callq 0x10a0
testq %rax, %rax
je 0x1319
movq %rax, %r12
movq %r13, %r15
movq %r13, %rdi
leaq 0xd90(%rip), %rsi       # 0x2024
callq 0x10a0
testq %rax, %rax
je 0x132b
movq %rax, %r13
movq 0x8(%rsp), %rax
movq (%rbx,%rax,8), %rsi
leaq 0xd72(%rip), %rdi       # 0x2027
xorl %eax, %eax
callq 0x1080
leaq 0x1c(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x1050
movl $0x10000, %edx          # imm = 0x10000
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x1050
testl %eax, %eax
je 0x12f9
movslq %eax, %rdx
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0x10c0
jmp 0x12cf
movq %r12, %rdi
callq 0x1060
movq %r13, %rdi
callq 0x1060
movq 0x8(%rsp), %rax
incq %rax
movq %r15, %r13
jmp 0x1219
movq 0x8(%rsp), %rax
movq (%rbx,%rax,8), %rsi
leaq 0xce3(%rip), %rdi       # 0x200c
jmp 0x1337
leaq 0xcda(%rip), %rdi       # 0x200c
leaq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x1080
jmp 0x11f7
// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripOLE/pldstr.c
// Function: PLD_strncasecmp
int PLD_strncasecmp( char *s1, char *s2, int n )
{
	char *ds1 = s1, *ds2 = s2;
	char c1, c2;
	int result = 0;

	while(n > 0)
	{
		c1 = tolower(*ds1);
		c2 = tolower(*ds2);

		if (c1 == c2)
		{
			n--;
			ds1++;
			ds2++;
		}
		else
		{
			result = c2 - c1;
			n = 0;
		}

	}

	return result;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
testl %ebp, %ebp
jle 0x3f42
callq 0x11e0
movq (%rax), %rax
movsbq (%r14), %rcx
movsbl (%rax,%rcx,4), %ecx
movsbq (%rbx), %rdx
movsbl (%rax,%rdx,4), %eax
subl %ecx, %eax
jne 0x3f3b
decl %ebp
incq %r14
incq %rbx
jmp 0x3f11
xorl %ebp, %ebp
movl %eax, %r15d
jmp 0x3f11
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripOLE/pldstr.c
// Function: PLD_strreplace
char *PLD_strreplace( char **source, char *searchfor, char *replacewith, int replacenumber )
{
	struct PLD_strreplace replace_details;
	char *tmp_source;

	replace_details.source = *source;
	replace_details.searchfor = searchfor;
	replace_details.replacewith = replacewith;
	replace_details.replacenumber = replacenumber;
	replace_details.preexist = NULL;
	replace_details.postexist = NULL;
	replace_details.insensitive = 0;

	tmp_source = PLD_strreplace_general( &replace_details );

	if (tmp_source != *source) *source = tmp_source;

	return *source;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq %rsp, %rdi
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movl %ecx, 0x28(%rdi)
andl $0x0, 0x2c(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
callq 0x3ff6
movq (%rbx), %rcx
cmpq %rcx, %rax
je 0x437d
movq %rax, (%rbx)
movq %rax, %rcx
movq %rcx, %rax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripOLE/pldstr.c
// Function: PLD_dprintf
char *PLD_dprintf(const char *format, ...) 
{
	int n, size = 1024; // Assume we don't need more than 1K to start with
	char *p;
	va_list ap;

	// Attempt to allocate and then check 
	p = malloc(size *sizeof(char));
	if (p == NULL) return NULL;

	while (1) 
	{
		// Attempt to print out string out into the allocated space
		va_start(ap, format);
		n = vsnprintf (p, size, format, ap);
		va_end(ap);

		// If things went well, then return the new string
		if ((n > -1) && (n < size)) return p;

		// If things didn't go well, then we have to allocate more space
		//	based on which glibc we're using ( fortunately, the return codes
		//	tell us which glibc is being used! *phew*
		//
		// If n > -1, then we're being told precisely how much space we need
		// else (older glibc) we have to just guess again ...

		if (n > -1) size = n+1; // Allocate precisely what is needed
		else size *= 2;  // Double the amount allocated, note, we could just increase by 1K, but if we have a long string, we'd end up using a lot of realloc's

		// We could just realloc 'blind', but that'd be wrong and potentially cause a DoS, so
		//	instead, we'll be good and first attempt to realloc to a temp variable then, if all
		//	is well, we go ahead and update
		if (1)
		{
			char *tmp_p;

			tmp_p = realloc(p, size);
			if (tmp_p == NULL){ if (p != NULL) free(p); return NULL; }
			else p = tmp_p;
		}
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x43ee
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x1110
testq %rax, %rax
je 0x4472
movl $0x400, %r15d           # imm = 0x400
leaq 0x110(%rsp), %rbp
movabsq $0x3000000008, %r13     # imm = 0x3000000008
movq %rsp, %r12
movq %rax, %r14
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movq %r13, (%rsp)
movl %r15d, %esi
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x1090
testl %eax, %eax
setns %cl
cmpl %r15d, %eax
setl %dl
testb %dl, %cl
jne 0x4475
leal 0x1(%rax), %ecx
addl %r15d, %r15d
testl %eax, %eax
cmovnsl %ecx, %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0x1170
testq %rax, %rax
jne 0x4418
movq %r14, %rdi
callq 0x1030
xorl %r14d, %r14d
movq %r14, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripOLE/ripole.c
// Function: ROLE_set_parameters
int ROLE_set_parameters( struct ripOLE_object *role, struct OLE_object *ole )
{
	if(role->debug == 1)
	{
		OLE_set_debug(ole, OLE_DEBUG_NORMAL);
	} 

	if (role->verbose == 1)
	{
		OLE_set_verbose(ole, OLE_VERBOSE_NORMAL);
	}

	if (role->save_unknown_streams == 1)
	{
		OLE_set_save_unknown_streams(ole, 1);
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x1, (%rdi)
jne 0x47c0
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x13b5
cmpl $0x1, 0x4(%r14)
jne 0x47d2
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x139b
cmpl $0x1, 0x8(%r14)
jne 0x47e4
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x13e3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/rra/wav2rra.c
// Function: filter
static void
filter(FILE *in,FILE *out)
    {
    int i,amp;
    WAVE *w;
    RRA *h;

    w = newWave();
    //printf("reading wave header...\n");
    readWaveHeader(w,in);
    //printf("wave header read.\n");

    h = newRRAHeader();

    h->sampleRate = w->SampleRate;
    h->samples = w->sampleCount;
    //fprintf(stderr,"%d samples in wav\n",w->sampleCount);
    h->bitsPerSample = w->BitsPerSample;
    if (Track == -1)
        h->channels = w->NumChannels;
    else
        h->channels = 1;
    h->data = w->channels;
    h->maxAmp = w->maxAmp;

    if (h->sampleRate == 0) h->sampleRate = 44100;

    writeRRAHeader(out,h,"modifiedBy: wav2rra",0);

    for (i = 0; !feof(in); ++i)
        {
        amp = readByteInt(in,h->bitsPerSample/8);
        if (amp >= w->maxAmp)
            amp = -2 * h->maxAmp + amp;

        if (Track == -1 || i % w->NumChannels == Track)
            fprintf(out,"%d\n",(int)(amp * Attenuation));
        }

    if ((i - 1) / w->NumChannels != h->samples)
        fprintf(stderr,"WARNING: %d samples expected, %d found\n",
            h->samples, i / w->NumChannels);

    fclose(in);
    fclose(out);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
callq 0x1a5c
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1cc5
callq 0x2760
movq %rax, %r12
movl 0x38(%r15), %eax
movl %eax, 0x4(%r12)
movl 0x78(%r15), %ecx
movl %ecx, 0xc(%r12)
movl 0x44(%r15), %ecx
movl %ecx, 0x8(%r12)
cmpl $-0x1, 0x5b2d(%rip)     # 0x7168
je 0x1642
pushq $0x1
popq %rcx
jmp 0x1646
movl 0x34(%r15), %ecx
movl %ecx, (%r12)
movq %r15, %rcx
addq $0x50, %rcx
movq %rcx, 0x18(%r12)
movl 0x80(%r15), %ecx
movl %ecx, 0x20(%r12)
testl %eax, %eax
jne 0x166f
movl $0xac44, 0x4(%r12)      # imm = 0xAC44
leaq 0x299a(%rip), %rdx      # 0x4010
movq -0x38(%rbp), %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x34d4
pushq $-0x1
popq %rbx
leal 0x1(%rbx), %r13d
movq %r14, %rdi
callq 0x1170
testl %eax, %eax
jne 0x170e
movl 0x8(%r12), %eax
cltd
pushq $0x8
popq %rcx
idivl %ecx
andl $0x0, -0x2c(%rbp)
movslq %eax, %rdx
leaq -0x2c(%rbp), %rdi
pushq $0x1
popq %rsi
movq %r14, %rcx
callq 0x1080
movl -0x2c(%rbp), %ecx
cmpl 0x80(%r15), %ecx
jl 0x16cd
movl 0x20(%r12), %eax
addl %eax, %eax
subl %eax, %ecx
movl 0x5a95(%rip), %esi      # 0x7168
cmpl $-0x1, %esi
je 0x16e4
movl %r13d, %eax
cltd
idivl 0x34(%r15)
cmpl %esi, %edx
jne 0x1706
cvtsi2sd %ecx, %xmm0
mulsd 0x5a80(%rip), %xmm0     # 0x7170
cvttsd2si %xmm0, %edx
movq -0x38(%rbp), %rdi
leaq 0x2bc1(%rip), %rsi      # 0x42c0
xorl %eax, %eax
callq 0x1150
movl %r13d, %ebx
jmp 0x1687
movl 0x34(%r15), %esi
movl %ebx, %eax
cltd
idivl %esi
movl 0xc(%r12), %ecx
cmpl %ecx, %eax
jne 0x173f
movq %r14, %rdi
callq 0x10a0
movq -0x38(%rbp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10a0
movq 0x58b2(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movl %r13d, %eax
cltd
idivl %esi
leaq 0x28ce(%rip), %rsi      # 0x4024
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x1150
jmp 0x1720
nop
// File: /workspace/github_c_makefile_star2_O2/felipelouza[P]egap/tools/lib/utils.c
// Function: bwt
int bwt(int_t sa, unsigned char* str){

    int c;

    if(sa==0 || str[sa-1]==1)
      c = 0;
    else
      c = str[sa-1]-1;

return c;
}

// Assembly:
xorl %eax, %eax
testl %edi, %edi
je 0x3da2
movslq %edi, %rcx
movzbl -0x1(%rsi,%rcx), %ecx
cmpl $0x1, %ecx
je 0x3da2
decl %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gl/gl_3.c
// Function: ogl_LoadFunctions
int ogl_LoadFunctions()
{
	int numFailed = 0;
	ClearExtensionVars();
	
	_ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint *))IntGetProcAddress("glGetIntegerv");
	if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
	_ptrc_glGetStringi = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glGetStringi");
	if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;
	
	ProcExtsFromExtList();
	numFailed = Load_Version_3_3();
	
	if(numFailed == 0)
		return ogl_LOAD_SUCCEEDED;
	else
		return ogl_LOAD_SUCCEEDED + numFailed;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x6d0c(%rip), %rdi      # 0x8004
callq 0x1120
movq %rax, 0xaf04(%rip)      # 0xc208
xorl %ebx, %ebx
testq %rax, %rax
je 0x1358
leaq 0x6d00(%rip), %rdi      # 0x8012
callq 0x1120
movq %rax, 0xb5b2(%rip)      # 0xc8d0
testq %rax, %rax
je 0x1358
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movl $0x821d, %edi           # imm = 0x821D
callq *0xaed2(%rip)           # 0xc208
xorl %ebx, %ebx
cmpl 0xc(%rsp), %ebx
jge 0x134f
movl $0x1f03, %edi           # imm = 0x1F03
movl %ebx, %esi
callq *0xb585(%rip)           # 0xc8d0
incl %ebx
jmp 0x1338
callq 0x1360
movl %eax, %ebx
incl %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gl/gl_3.c
// Function: ogl_IsVersionGEQ
int ogl_IsVersionGEQ(int majorVersion, int minorVersion)
{
	if(g_major_version == 0)
		GetGLVersion();
	
	if(majorVersion < g_major_version) return 1;
	if(majorVersion > g_major_version) return 0;
	if(minorVersion <= g_minor_version) return 1;
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl 0x7133(%rip), %ecx      # 0xcc18
testl %ecx, %ecx
jne 0x5af4
callq 0x5a95
movl 0x7124(%rip), %ecx      # 0xcc18
cmpl %ebp, %ecx
jle 0x5afd
pushq $0x1
popq %rax
jmp 0x5b0e
xorl %eax, %eax
cmpl %ebp, %ecx
jl 0x5b0e
xorl %eax, %eax
cmpl %ebx, 0x7111(%rip)      # 0xcc1c
setge %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: createShader
void createShader(ShaderPrg *prg, const char *vs, const char *fs){
	char *vsData = readFile(vs);
	char *fsData = readFile(fs);

	prg->vs = compileShader(vsData, GL_VERTEX_SHADER);
	prg->fs = compileShader(fsData, GL_FRAGMENT_SHADER);

	linkPrg(prg);

	free(vsData);
	free(fsData);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x5b78
movq %rax, %r15
movq %rbx, %rdi
callq 0x5b78
movq %rax, %rbx
movq %r15, %rdi
movl $0x8b31, %esi           # imm = 0x8B31
callq 0x5bfe
movl %eax, 0x4(%r14)
movq %rbx, %rdi
movl $0x8b30, %esi           # imm = 0x8B30
callq 0x5bfe
movl %eax, 0x8(%r14)
movq %r14, %rdi
callq 0x5c7f
movq %r15, %rdi
callq 0x1150
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1150
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: readFile
static char *readFile(const char *filename){
	FILE *fp = fopen(filename, "r");
	if(fp == NULL){
		printf("Could not open file: %s\n", filename);
		return NULL;
	}

	// Get size of file
	fseek(fp, 0, SEEK_END);
	int fileSize = ftell(fp);
	fseek(fp, 0, SEEK_SET);

	char *data = malloc(fileSize);
	fread(data, 1, fileSize, fp);
	fclose(fp);
	return data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r15
leaq 0x24aa(%rip), %rsi      # 0x8031
callq 0x1140
testq %rax, %rax
je 0x5be1
movq %rax, %rbx
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1130
movq %rbx, %rdi
callq 0x1030
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1130
movslq %r14d, %r15
movq %r15, %rdi
callq 0x1160
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x11b0
movq %rbx, %rdi
callq 0x1100
jmp 0x5bf5
leaq 0x3c22(%rip), %rdi      # 0x980a
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x1040
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: compileShader
GLuint compileShader(const char *shader, GLenum type){
	GLuint s = glCreateShader(type);
	glShaderSource(s, 1, &shader, NULL);
	glCompileShader(s);

	// Check if shader compiled okay
	GLint okay = GL_FALSE;
	glGetShaderiv(s, GL_COMPILE_STATUS, &okay);
	if(okay == GL_FALSE){
		printf("Error compiling shader\n");
		printErrLog(s);
		return 0;
	}

	return s;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %r14
movq %rdi, (%r14)
leaq 0x689b(%rip), %rax      # 0xc4b0
movl %esi, %edi
callq *(%rax)
movl %eax, %ebp
leaq 0x695e(%rip), %rax      # 0xc580
xorl %ebx, %ebx
pushq $0x1
popq %rsi
movl %ebp, %edi
movq %r14, %rdx
xorl %ecx, %ecx
callq *(%rax)
leaq 0x6869(%rip), %rax      # 0xc4a0
movl %ebp, %edi
callq *(%rax)
leaq 0x4(%rsp), %r14
andl $0x0, (%r14)
leaq 0x68dd(%rip), %rax      # 0xc528
movl %ebp, %edi
movl $0x8b81, %esi           # imm = 0x8B81
movq %r14, %rdx
callq *(%rax)
cmpl $0x0, (%r14)
je 0x5c61
movl %ebp, %ebx
jmp 0x5c74
leaq 0x3be2(%rip), %rdi      # 0x984a
callq 0x11c0
movl %ebp, %edi
callq 0x5cfe
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: linkPrg
void linkPrg(ShaderPrg *prg){
	prg->prgID = glCreateProgram();
	glAttachShader(prg->prgID, prg->vs);
	glAttachShader(prg->prgID, prg->fs);
	glLinkProgram(prg->prgID);

	// Check if program linked okay
	GLint okay = GL_FALSE;
	glGetProgramiv(prg->prgID, GL_LINK_STATUS, &okay);
	if(okay == GL_FALSE){
		printf("Error linking program\n");
		printErrLog(prg->prgID);
		glDeleteProgram(prg->prgID);
		prg->prgID = 0;
		return;
	}
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x681b(%rip), %rax      # 0xc4a8
callq *(%rax)
movl %eax, (%rbx)
leaq 0x67f0(%rip), %r14      # 0xc488
movl 0x4(%rbx), %esi
movl %eax, %edi
callq *(%r14)
movl (%rbx), %edi
movl 0x8(%rbx), %esi
callq *(%r14)
leaq 0x68c9(%rip), %rax      # 0xc578
movl (%rbx), %edi
callq *(%rax)
leaq 0x4(%rsp), %r14
andl $0x0, (%r14)
leaq 0x684d(%rip), %rax      # 0xc510
movl (%rbx), %edi
movl $0x8b82, %esi           # imm = 0x8B82
movq %r14, %rdx
callq *(%rax)
cmpl $0x0, (%r14)
jne 0x5cf6
leaq 0x3b85(%rip), %rdi      # 0x9861
callq 0x11c0
movl (%rbx), %edi
callq 0x5cfe
leaq 0x67c9(%rip), %rax      # 0xc4b8
movl (%rbx), %edi
callq *(%rax)
andl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: printErrLog
static void printErrLog(GLuint obj){
	GLint logLen = 0;
	bool isShader;
	if(glIsShader(obj)){
		isShader = true;
		glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &logLen);
	} else if (glIsProgram(obj)){
		isShader = false;
		glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &logLen);
	} else {
		printf("Object is neither shader or program");
		return;
	}

	char *log = malloc(logLen);
	if(isShader){
		glGetShaderInfoLog(obj, logLen, NULL, log);
	} else {
		glGetProgramInfoLog(obj, logLen, NULL, log);
	}

	printf("%s", log);
	free(log);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
andl $0x0, 0x4(%rsp)
leaq 0x685c(%rip), %rax      # 0xc570
callq *(%rax)
testb %al, %al
je 0x5d2a
leaq 0x6807(%rip), %rax      # 0xc528
leaq 0x67f0(%rip), %r12      # 0xc518
jmp 0x5d47
leaq 0x6837(%rip), %rax      # 0xc568
movl %ebx, %edi
callq *(%rax)
testb %al, %al
je 0x5d9c
leaq 0x67d0(%rip), %rax      # 0xc510
leaq 0x67c1(%rip), %r12      # 0xc508
leaq 0x4(%rsp), %r14
movl %ebx, %edi
movl $0x8b84, %esi           # imm = 0x8B84
movq %r14, %rdx
callq *(%rax)
movl (%r14), %eax
movslq %eax, %r14
movq %r14, %rdi
callq 0x1160
movq %rax, %r15
movl %ebx, %edi
movl %r14d, %esi
xorl %edx, %edx
movq %rax, %rcx
callq *(%r12)
leaq 0x3ac9(%rip), %rdi      # 0x9847
movq %r15, %rsi
xorl %eax, %eax
callq 0x1040
movq %r15, %rdi
callq 0x1150
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x3a80(%rip), %rdi      # 0x9823
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: getAttribLoc
GLint getAttribLoc(ShaderPrg *prg, const char *name){
	GLint attrib = glGetAttribLocation(prg->prgID, name);
	if(attrib == -1){
		printf("Could not find vertex attribute: %s\n", name);
		return -1;
	}
	
	return attrib;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x673e(%rip), %rax      # 0xc500
movl (%rdi), %edi
callq *(%rax)
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x5dde
leaq 0x39f5(%rip), %rdi      # 0x97c9
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/gutils.c
// Function: getUniformLoc
GLint getUniformLoc(ShaderPrg *prg, const char *name){
	GLint uniform = glGetUniformLocation(prg->prgID, name);
	if(uniform == -1){
		printf("Could not find uniform: %s\n", name);
		return -1;
	}

	return uniform;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x673c(%rip), %rax      # 0xc530
movl (%rdi), %edi
callq *(%rax)
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x5e10
leaq 0x39e8(%rip), %rdi      # 0x97ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: mulMat
void mulMat(mat4 *dst, mat4 *a, mat4 *b){
	mat4 aa = *a;
	mat4 bb = *b;
	float *dm = &dst->m[0];
	float *am = &aa.m[0];
	float *bm = &bb.m[0];

	for(int j=0; j<4; j++){
		for(int i=0; i<4; i++){
			int index = j*4 + i;
			dm[index] = am[0*4 + i]*bm[j*4 + 0] + am[1*4 + i]*bm[j*4 + 1]
			+ am[2*4 + i]*bm[j*4 + 2] + am[3*4 + i]*bm[j*4 + 3]; 
		}
	}
}

// Assembly:
pushq %rax
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups 0x30(%rsi), %xmm3
movaps %xmm3, -0x10(%rsp)
movaps %xmm2, -0x20(%rsp)
movaps %xmm1, -0x30(%rsp)
movaps %xmm0, -0x40(%rsp)
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups 0x30(%rdx), %xmm3
movaps %xmm3, -0x50(%rsp)
movaps %xmm2, -0x60(%rsp)
movaps %xmm1, -0x70(%rsp)
movaps %xmm0, -0x80(%rsp)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x5f1f
movq %rax, %rcx
shlq $0x4, %rcx
movss -0x80(%rsp,%rcx), %xmm0
movss -0x7c(%rsp,%rcx), %xmm1
movss -0x78(%rsp,%rcx), %xmm2
movss -0x74(%rsp,%rcx), %xmm3
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x5f16
movss -0x30(%rsp,%rcx,4), %xmm4
mulss %xmm1, %xmm4
movss -0x40(%rsp,%rcx,4), %xmm5
mulss %xmm0, %xmm5
addss %xmm4, %xmm5
movss -0x20(%rsp,%rcx,4), %xmm4
mulss %xmm2, %xmm4
addss %xmm5, %xmm4
movss -0x10(%rsp,%rcx,4), %xmm5
mulss %xmm3, %xmm5
addss %xmm4, %xmm5
movss %xmm5, (%rdi,%rcx,4)
incq %rcx
jmp 0x5ed2
incq %rax
addq $0x10, %rdi
jmp 0x5eab
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: frustrum
void frustrum(mat4 *mat, float left, float right, float bottom, float top, float near, float far){
	mat4 r;
	float *m = &r.m[0];
	float n2 = 2.0*near;
	float rml = right - left;
	float fmn = far - near;
	float tmb = top - bottom;

	m[0] = n2/rml;
	m[1] = 0;
	m[2] = 0;
	m[3] = 0;

	m[4] = 0;
	m[5] = n2/tmb;
	m[6] = 0;
	m[7] = 0;
	
	m[8] = (right + left)/rml;
	m[9] = (top + bottom)/tmb;
	m[10]= -(far + near)/fmn;
	m[11]= -1;

	m[12]= 0;
	m[13]= 0;
	m[14]= -n2/fmn;
	m[15]= 0;

	mulMat(mat, mat, &r);
}

// Assembly:
subq $0x48, %rsp
movaps %xmm4, %xmm6
addss %xmm4, %xmm6
unpcklps %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movaps %xmm1, %xmm3
subps %xmm0, %xmm3
movaps %xmm5, %xmm2
subss %xmm4, %xmm2
movaps %xmm6, %xmm7
divss %xmm3, %xmm7
leaq 0x8(%rsp), %rdx
movss %xmm7, (%rdx)
addps %xmm1, %xmm0
divps %xmm3, %xmm0
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
movaps %xmm6, %xmm1
divss %xmm3, %xmm1
xorps %xmm3, %xmm3
movups %xmm3, 0x4(%rdx)
movss %xmm1, 0x14(%rdx)
movlhps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
movups %xmm3, 0x18(%rdx)
addss %xmm5, %xmm4
movaps 0x3942(%rip), %xmm0     # 0x98c0
xorps %xmm0, %xmm4
divss %xmm2, %xmm4
movss %xmm4, 0x28(%rdx)
movss 0x38ea(%rip), %xmm1     # 0x987c
movlps %xmm1, 0x2c(%rdx)
andl $0x0, 0x34(%rdx)
xorps %xmm0, %xmm6
divss %xmm2, %xmm6
movss %xmm6, 0x38(%rdx)
andl $0x0, 0x3c(%rdx)
movq %rdi, %rsi
callq 0x5e62
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: perspective
void perspective(mat4 *mat, float fovy, float aspect, float near, float far){
	mat4 r;
	float *m = &r.m[0];
	float range = tanf(fovy)*near;
	float sx = (2.0f*near)/(range*aspect + range*aspect);
	float sy = near/range;
	float sz = -(far + near)/(far - near);
	float pz = -(2.0f*far*near)/(far - near);

	m[0] = sx;
	m[1] = 0;
	m[2] = 0;
	m[3] = 0;

	m[4] = 0;
	m[5] = sy;
	m[6] = 0;
	m[7] = 0;

	m[8] = 0;
	m[9] = 0;
	m[10]= sz;
	m[11]= -1;

	m[12]= 0;
	m[13]= 0;
	m[14]= pz;
	m[15]= 0;

	mulMat(mat, mat, &r);
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movss %xmm3, 0xc(%rsp)
movss %xmm2, 0x4(%rsp)
movss %xmm1, 0x8(%rsp)
movq %rdi, %rbx
callq 0x11a0
movss 0x4(%rsp), %xmm5
mulss %xmm5, %xmm0
movaps %xmm5, %xmm1
addss %xmm5, %xmm1
movss 0x8(%rsp), %xmm2
mulss %xmm0, %xmm2
addss %xmm2, %xmm2
divss %xmm2, %xmm1
movaps %xmm5, %xmm2
movaps %xmm5, %xmm3
movss 0xc(%rsp), %xmm4
addss %xmm4, %xmm3
xorps 0x38b0(%rip), %xmm3     # 0x98c0
divss %xmm0, %xmm2
movaps %xmm4, %xmm0
subss %xmm5, %xmm0
divss %xmm0, %xmm3
mulss 0x3859(%rip), %xmm4     # 0x9880
mulss %xmm5, %xmm4
divss %xmm0, %xmm4
leaq 0x10(%rsp), %rdx
movss %xmm1, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rdx)
movss %xmm2, 0x14(%rdx)
movups %xmm0, 0x18(%rdx)
movss %xmm3, 0x28(%rdx)
movss 0x3827(%rip), %xmm0     # 0x987c
movlps %xmm0, 0x2c(%rdx)
andl $0x0, 0x34(%rdx)
movss %xmm4, 0x38(%rdx)
andl $0x0, 0x3c(%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x5e62
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: translate
void translate(mat4 *mat, float x, float y, float z){
	mat4 r;
	float *m = &r.m[0];
	m[0] = 1;m[4] = 0;m[8] = 0;m[12]= x;
	m[1] = 0;m[5] = 1;m[9] = 0;m[13]= y;
	m[2] = 0;m[6] = 0;m[10]= 1;m[14]= z;
	m[3] = 0;m[7] = 0;m[11]= 0;m[15]= 1;


	mulMat(mat, mat, &r);
}

// Assembly:
subq $0x48, %rsp
movq %rsp, %rdx
movss %xmm0, 0x30(%rdx)
movss %xmm1, 0x34(%rdx)
movss %xmm2, 0x38(%rdx)
movss 0x37e3(%rip), %xmm0     # 0x9878
movaps %xmm0, (%rdx)
movsd 0x37f0(%rip), %xmm0     # 0x9890
movaps %xmm0, 0x10(%rdx)
movaps 0x37f5(%rip), %xmm0     # 0x98a0
movaps %xmm0, 0x20(%rdx)
movl $0x3f800000, 0x3c(%rdx) # imm = 0x3F800000
movq %rdi, %rsi
callq 0x5e62
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: rotateY
void rotateY(mat4 *mat, float angle){
	mat4 r;
	float *m = &r.m[0];
	m[0] = cosf(angle);
	m[1] = 0;
	m[2] = -sinf(angle);
	m[3] = 0;

	m[4] = 0;
	m[5] = 1;
	m[6] = 0;
	m[7] = 0;

	m[8] = sinf(angle);
	m[9] = 0;
	m[10]= cosf(angle);
	m[11]= 0;

	m[12]= 0;
	m[13]= 0;
	m[14]= 0;
	m[15]= 1;

	mulMat(mat, mat, &r);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movss %xmm0, 0x4(%rsp)
movq %rdi, %rbx
callq 0x10a0
leaq 0x8(%rsp), %r14
movss %xmm0, (%r14)
andl $0x0, 0x4(%r14)
movss 0x4(%rsp), %xmm0
callq 0x10d0
xorps 0x37c7(%rip), %xmm0     # 0x98c0
movss %xmm0, 0x8(%r14)
movaps 0x379a(%rip), %xmm0     # 0x98a0
movups %xmm0, 0xc(%r14)
andl $0x0, 0x1c(%r14)
movss 0x4(%rsp), %xmm0
callq 0x10d0
movss %xmm0, 0x20(%r14)
andl $0x0, 0x24(%r14)
movss 0x4(%rsp), %xmm0
callq 0x10a0
movss %xmm0, 0x28(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%r14)
movl $0x3f800000, 0x3c(%r14) # imm = 0x3F800000
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5e62
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/mat.c
// Function: lookAt
void lookAt(mat4 *mat, vec3Float *pos, vec3Float *fwd, vec3Float *right, vec3Float *up){
	mat4 r;
	float *m = &r.m[0];

	m[0] = right->x;
	m[1] = up->x;
	m[2] = -fwd->x;
	m[3] = 0;

	m[4] = right->y;
	m[5] = up->y;
	m[6] = -fwd->y;
	m[7] = 0;	

	m[8] = right->z;
	m[9] = up->z;
	m[10]= -fwd->z;
	m[11]= 0;

	m[12]= -pos->x;
	m[13]= -pos->y;
	m[14]= -pos->z;
	m[15]= 1;

	mulMat(mat, mat, &r);
}

// Assembly:
subq $0x48, %rsp
movq %rdx, %rax
movss (%rcx), %xmm0
leaq 0x8(%rsp), %rdx
movss %xmm0, (%rdx)
movss (%r8), %xmm0
movss %xmm0, 0x4(%rdx)
movss (%rax), %xmm1
movaps 0x373a(%rip), %xmm0     # 0x98c0
xorps %xmm0, %xmm1
movss %xmm1, 0x8(%rdx)
andl $0x0, 0xc(%rdx)
movss 0x4(%rcx), %xmm1
movss %xmm1, 0x10(%rdx)
movss 0x4(%r8), %xmm1
movss %xmm1, 0x14(%rdx)
movss 0x4(%rax), %xmm1
xorps %xmm0, %xmm1
movss %xmm1, 0x18(%rdx)
andl $0x0, 0x1c(%rdx)
movss 0x8(%rcx), %xmm1
movss %xmm1, 0x20(%rdx)
movss 0x8(%r8), %xmm1
movss %xmm1, 0x24(%rdx)
movss 0x8(%rax), %xmm1
xorps %xmm0, %xmm1
movss %xmm1, 0x28(%rdx)
andl $0x0, 0x2c(%rdx)
movsd (%rsi), %xmm1
xorps %xmm0, %xmm1
movlps %xmm1, 0x30(%rdx)
movss 0x8(%rsi), %xmm1
xorps %xmm0, %xmm1
movss %xmm1, 0x38(%rdx)
movl $0x3f800000, 0x3c(%rdx) # imm = 0x3F800000
movq %rdi, %rsi
callq 0x5e62
addq $0x48, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/pak.c
// Function: readPakFile
PakFile *readPakFile(const char *filename){
	PakFile *pak = malloc(sizeof(PakFile));
	FILE *fp = fopen(filename, "rb");
	if(fp == NULL){
		printf("Could not open file: %s\n", filename);
		return NULL;
	}

	PakHeader header;

	// Read in PAK header
	fread(&header, sizeof(PakHeader), 1, fp);

	// Verify that this is a valid pak file
	if(header.magic[0] != 'P' || header.magic[1] != 'A' ||
			header.magic[2] != 'C' || header.magic[3] != 'K'){
		printf("Invalid pak file: %s\n", filename);
		return NULL;
	}
	
	PakEntry *entries = malloc(header.size);
	int numEntries = header.size/sizeof(PakEntry);
	pak->numFiles = numEntries;
	pak->files = malloc(sizeof(FILE)*numEntries);
	
	// Go to first entry
	fseek(fp, header.offset, SEEK_SET);
	// Read in all entries
	fread(entries, sizeof(PakEntry), numEntries, fp);

	// Read all file entries
	for(int i=0; i < numEntries; i++){
		int filenameLength = strlen(entries[i].filename);
		pak->files[i].filename = malloc(filenameLength+1);
		strcpy(pak->files[i].filename, entries[i].filename);

		pak->files[i].size = entries[i].size;
		pak->files[i].data = malloc(pak->files[i].size);
		fseek(fp, entries[i].offset, SEEK_SET);
		fread(pak->files[i].data, 1, pak->files[i].size, fp);
	}


	fclose(fp);

	free(entries);
	return pak;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r15
pushq $0x10
popq %rdi
callq 0x1160
movq %rax, %rbx
leaq 0x36a1(%rip), %rsi      # 0x98d0
movq %r15, %rdi
callq 0x1140
testq %rax, %rax
je 0x6336
movq %rax, %r14
leaq 0x1c(%rsp), %r12
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %rax, %rcx
callq 0x11b0
cmpl $0x4b434150, (%r12)     # imm = 0x4B434150
jne 0x633f
movslq 0x24(%rsp), %r12
movq %r12, %rdi
callq 0x1160
movq %rax, %rbp
sarl $0x6, %r12d
movl %r12d, 0x8(%rbx)
movslq %r12d, %r13
imulq $0xd8, %r13, %rdi
callq 0x1160
movq %rax, %r12
movq %rbx, 0x10(%rsp)
movq %rax, (%rbx)
movslq 0x20(%rsp), %rsi
xorl %r15d, %r15d
movq %r14, %rdi
xorl %edx, %edx
callq 0x1130
pushq $0x40
popq %rsi
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x11b0
testl %r13d, %r13d
cmovlel %r15d, %r13d
imulq $0x18, %r13, %rbx
pushq $0x1
popq %r13
movq %rbp, 0x8(%rsp)
cmpq %r15, %rbx
je 0x6354
movq %rbp, %rdi
callq 0x1080
incl %eax
movslq %eax, %rdi
callq 0x1160
movq %rax, (%r12,%r15)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x10f0
movslq 0x3c(%rbp), %rdi
movl %edi, 0x8(%r12,%r15)
callq 0x1160
movq %rax, 0x10(%r12,%r15)
movslq 0x38(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x1130
movq 0x10(%r12,%r15), %rdi
movslq 0x8(%r12,%r15), %rdx
movq %r13, %rsi
movq %r14, %rcx
callq 0x11b0
addq $0x18, %r15
addq $0x40, %rbp
jmp 0x62d0
leaq 0x34cd(%rip), %rdi      # 0x980a
jmp 0x6346
leaq 0x358d(%rip), %rdi      # 0x98d3
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x1040
jmp 0x636b
movq %r14, %rdi
callq 0x1100
movq 0x8(%rsp), %rdi
callq 0x1150
movq 0x10(%rsp), %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/pak.c
// Function: readFile
void *readFile(PakFile *pf, const char *filename, int *size){
	for(int i=0; i<pf->numFiles; i++){
		if(strcmp(filename, pf->files[i].filename) == 0){
			// If size pointer isn't NULL set file size
			if(size != NULL){
				*size = pf->files[i].size;
			}
			return pf->files[i].data;
		}
	}

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rdi, %r15
movl 0x8(%rdi), %eax
xorl %r14d, %r14d
testl %eax, %eax
cmovlel %r14d, %eax
movq %rsi, %r12
imulq $0x18, %rax, %rbp
addq $0x18, %rbp
xorl %ecx, %ecx
leaq 0x18(%rcx), %r13
cmpq %r13, %rbp
je 0x63dc
movq (%r15), %rbx
movq (%rbx,%rcx), %rsi
movq %r12, %rdi
callq 0x1170
movq %r13, %rcx
testl %eax, %eax
jne 0x63a8
movq (%rsp), %rcx
testq %rcx, %rcx
je 0x63d7
movl -0x10(%rbx,%r13), %eax
movl %eax, (%rcx)
movq -0x8(%rbx,%r13), %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/pak.c
// Function: freePak
void freePak(PakFile *pf){
	for(int i=0; i<pf->numFiles; i++){
		free(pf->files[i].filename);
		free(pf->files[i].data);
	}
	
	free(pf->files);
	free(pf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x8(%rbx), %rax
movq (%rbx), %rdi
cmpq %rax, %r15
jge 0x6427
movq (%rdi,%r14), %rdi
callq 0x1150
movq (%rbx), %rax
movq 0x10(%rax,%r14), %rdi
callq 0x1150
incq %r15
addq $0x18, %r14
jmp 0x63fc
callq 0x1150
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1150
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/quad.c
// Function: initQuad
void initQuad(){
	glGenBuffers(2, bufferIds);
	glBindBuffer(GL_ARRAY_BUFFER, bufferIds[0]);
	glBufferData(GL_ARRAY_BUFFER, sizeof(verts), &verts[0], GL_STATIC_DRAW);
	
	glBindBuffer(GL_ARRAY_BUFFER, bufferIds[1]);
	glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), &texCoords[0], GL_STATIC_DRAW);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x5fa5(%rip), %rax      # 0xc428
leaq 0x6796(%rip), %rsi      # 0xcc20
pushq $0x2
popq %rdi
callq *(%rax)
leaq 0x5f62(%rip), %rbx      # 0xc3f8
movl 0x6784(%rip), %esi      # 0xcc20
movl $0x8892, %edi           # imm = 0x8892
callq *(%rbx)
leaq 0x5f56(%rip), %r14      # 0xc400
leaq 0x5c5f(%rip), %rdx      # 0xc110
pushq $0x30
popq %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *(%r14)
movl 0x675d(%rip), %esi      # 0xcc24
movl $0x8892, %edi           # imm = 0x8892
callq *(%rbx)
movq (%r14), %rax
leaq 0x5c68(%rip), %rdx      # 0xc140
pushq $0x20
popq %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/quad.c
// Function: drawQuad
void drawQuad(ShaderPrg *prg){
	GLint pos = getAttribLoc(prg, "position");
	GLint tex = getAttribLoc(prg, "texCoord");
	glEnableVertexAttribArray(pos);
	glBindBuffer(GL_ARRAY_BUFFER, bufferIds[0]);
	glVertexAttribPointer(
			pos,
			3,
			GL_FLOAT,
			GL_FALSE,
			0,
			NULL);

	glEnableVertexAttribArray(tex);
	glBindBuffer(GL_ARRAY_BUFFER, bufferIds[1]);
	glVertexAttribPointer(
			tex,
			2,
			GL_FLOAT,
			GL_FALSE,
			0,
			NULL);

	glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

	glDisableVertexAttribArray(pos);
	glDisableVertexAttribArray(tex);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x33e9(%rip), %rsi      # 0x98e9
callq 0x5db5
movl %eax, %ebx
leaq 0x33e4(%rip), %rsi      # 0x98f2
movq %r14, %rdi
callq 0x5db5
movl %eax, %ebp
leaq 0x5fc1(%rip), %r15      # 0xc4e0
movl %ebx, %edi
callq *(%r15)
leaq 0x5ecd(%rip), %r12      # 0xc3f8
movl 0x66ef(%rip), %esi      # 0xcc20
movl $0x8892, %edi           # imm = 0x8892
callq *(%r12)
leaq 0x6227(%rip), %r14      # 0xc768
pushq $0x3
popq %rsi
movl %ebx, %edi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *(%r14)
movl %ebp, %edi
callq *(%r15)
movl 0x66c3(%rip), %esi      # 0xcc24
movl $0x8892, %edi           # imm = 0x8892
callq *(%r12)
pushq $0x2
popq %rsi
movl %ebp, %edi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *(%r14)
leaq 0x5d92(%rip), %rax      # 0xc318
pushq $0x6
popq %rdi
pushq $0x4
popq %rdx
xorl %esi, %esi
callq *(%rax)
leaq 0x5f39(%rip), %r14      # 0xc4d0
movl %ebx, %edi
callq *(%r14)
movl %ebp, %edi
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *(%rax)
nop
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/texture.c
// Function: writePPM
void writePPM(Texture *tex, const char *filename){
	FILE *fp = fopen(filename, "wb");
	if(fp == NULL){
		printf("Could not create file: %s\n", filename);
		return;
	}

	fprintf(fp, "P6 %d %d 255\n", tex->width, tex->height);
	fwrite(tex->data, sizeof(colour3UByte), tex->width*tex->height, fp);
	fclose(fp);
	
	return;	
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x31c3(%rip), %rsi      # 0x98fb
movq %r15, %rdi
callq 0x1140
testq %rax, %rax
je 0x6789
movq %rax, %rbx
movl 0xc(%r14), %edx
movl 0x10(%r14), %ecx
leaq 0x31c2(%rip), %rsi      # 0x9919
movq %rax, %rdi
xorl %eax, %eax
callq 0x1190
movq 0x18(%r14), %rdi
movslq 0xc(%r14), %rax
movslq 0x10(%r14), %rdx
imulq %rax, %rdx
pushq $0x3
popq %rsi
movq %rbx, %rcx
callq 0x11e0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1100
leaq 0x316e(%rip), %rdi      # 0x98fe
movq %r15, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/vec.c
// Function: vec3Cross
void vec3Cross(vec3Float *dst, vec3Float *a, vec3Float *b){
	vec3Float aa = *a;
	vec3Float bb = *b;

	dst->x = aa.y*bb.z - aa.z*bb.y;
	dst->y = aa.z*bb.x - aa.x*bb.z;
	dst->z = aa.x*bb.y - aa.y*bb.x;
}

// Assembly:
movss (%rsi), %xmm0
movss (%rdx), %xmm1
movsd 0x4(%rsi), %xmm2
movsd 0x4(%rdx), %xmm3
movaps %xmm0, %xmm4
shufps $0xd4, %xmm2, %xmm4     # xmm4 = xmm4[0,1],xmm2[1,3]
shufps $0x52, %xmm2, %xmm4     # xmm4 = xmm4[2,0],xmm2[1,1]
mulps %xmm3, %xmm4
movaps %xmm1, %xmm5
shufps $0xd4, %xmm3, %xmm5     # xmm5 = xmm5[0,1],xmm3[1,3]
shufps $0x52, %xmm3, %xmm5     # xmm5 = xmm5[2,0],xmm3[1,1]
mulps %xmm2, %xmm5
subps %xmm4, %xmm5
movlps %xmm5, (%rdi)
mulss %xmm2, %xmm1
mulss %xmm3, %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x8(%rdi)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/bsp.c
// Function: renderAllBspFaces
void renderAllBspFaces(Bsp *bsp){
	glBindVertexArray(bsp->vaoId);
	for(int f=0; f < bsp->numFaces; f++){
		Face *face = &bsp->faces[f];
		if(face->glId == 0){
			continue;
		}

		glBindBuffer(GL_ARRAY_BUFFER, face->glId);

		Vert *vert = NULL;
		glVertexAttribPointer(
				0,
				3,
				GL_FLOAT,
				GL_FALSE,
				sizeof(Vert),
				&vert->position);
		glVertexAttribPointer(
				1,
				2,
				GL_FLOAT,
				GL_FALSE,
				sizeof(Vert),
				&vert->texCoord);

		bindTexture(face->texture);

		glDrawArrays(GL_TRIANGLE_FAN, 0, face->numVerts);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x5932(%rip), %rax      # 0xc7d8
movl (%rdi), %edi
callq *(%rax)
pushq $0x10
popq %r15
xorl %r12d, %r12d
leaq 0x58b0(%rip), %r13      # 0xc768
pushq $0x20
popq %r14
movslq 0x28(%rbx), %rax
cmpq %rax, %r12
jge 0x6f34
movq 0x30(%rbx), %rbp
movl -0x10(%rbp,%r15), %esi
testl %esi, %esi
je 0x6f2b
movl $0x8892, %edi           # imm = 0x8892
leaq 0x551a(%rip), %rax      # 0xc3f8
callq *(%rax)
xorl %edi, %edi
pushq $0x3
popq %rsi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl %r14d, %r8d
xorl %r9d, %r9d
callq *(%r13)
pushq $0x1
popq %rdi
pushq $0x2
popq %rsi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl %r14d, %r8d
pushq $0xc
popq %r9
callq *(%r13)
movq -0x8(%rbp,%r15), %rdi
callq 0x679f
movl (%rbp,%r15), %edx
pushq $0x6
popq %rdi
xorl %esi, %esi
leaq 0x53ef(%rip), %rax      # 0xc318
callq *(%rax)
incq %r12
addq $0x20, %r15
jmp 0x6ebc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/bsp.c
// Function: freeBsp
void freeBsp(Bsp *bsp){
	for(int i=0; i < bsp->numTextures; i++){
		freeTex(bsp->textures[i]);
	}
	for(int i=0; i < bsp->numFaces; i++){
		free(bsp->faces[i].verts);
	}
	free(bsp->faces);
	free(bsp->textures);
	free(bsp->verts);
	free(bsp->planes);
	free(bsp->texInfo);
	free(bsp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x4(%rbx), %rax
cmpq %rax, %r14
jge 0x6f69
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x67b3
incq %r14
jmp 0x6f4e
pushq $0x18
popq %r14
xorl %r15d, %r15d
movslq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
cmpq %rax, %r15
jge 0x6f8f
movq (%rdi,%r14), %rdi
callq 0x1150
incq %r15
addq $0x20, %r14
jmp 0x6f70
callq 0x1150
movq 0x8(%rbx), %rdi
callq 0x1150
movq 0x10(%rbx), %rdi
callq 0x1150
movq 0x20(%rbx), %rdi
callq 0x1150
movq 0x18(%rbx), %rdi
callq 0x1150
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1150
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/cam.c
// Function: makeCam
Cam *makeCam(){
	Cam *cam = malloc(sizeof(Cam));
	
	cam->pos = (vec3Float){0,0,0};
	cam->fwd = (vec3Float){0,0,-1};
	cam->angle = (vec3Float){0,0,0};
	cam->right = (vec3Float){1,0,0};
	cam->up = (vec3Float){0,1,0};
	
	return cam;
}

// Assembly:
pushq %rax
pushq $0x3c
popq %rdi
callq 0x1160
andl $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movss 0x2899(%rip), %xmm0     # 0x987c
movups %xmm0, 0x14(%rax)
movss 0x2889(%rip), %xmm0     # 0x9878
movups %xmm0, 0x24(%rax)
movlps %xmm0, 0x34(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/Hazematman[P]BSP-Renderer/cam.c
// Function: turnCam
void turnCam(Cam *cam, float anglex, float angley){
	cam->angle.x -= anglex;
	cam->angle.y += angley;
	cam->angle.x += PI/2.0f;
	if(cam->angle.x >= PI){
		cam->angle.x = PI;
	} else if(cam->angle.x <= 0){
		cam->angle.x = 0;
	}

	if(cam->angle.y > 2.0*PI){
		cam->angle.y = fabs(cam->angle.y)-2.0f*PI;
	} else if(cam->angle.y < -2.0f*PI){
		cam->angle.y = -(fabs(cam->angle.y)-2.0f*PI);
	}
	cam->angle.x -= PI/2.0f;
	updateLookAt(cam);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movss 0x18(%rdi), %xmm2
subss %xmm0, %xmm2
addss 0x1c(%rdi), %xmm1
addss 0x28ec(%rip), %xmm2     # 0x9964
movss %xmm1, 0x1c(%rdi)
movss 0x28e3(%rip), %xmm0     # 0x9968
ucomiss %xmm0, %xmm2
jae 0x7098
xorps %xmm0, %xmm0
ucomiss %xmm2, %xmm0
movaps %xmm2, %xmm0
jb 0x7098
xorps %xmm0, %xmm0
ucomiss 0x28cd(%rip), %xmm1     # 0x996c
jbe 0x70ab
addss 0x28c7(%rip), %xmm1     # 0x9970
jmp 0x70ce
movss 0x28bd(%rip), %xmm2     # 0x9970
ucomiss %xmm1, %xmm2
jbe 0x70d3
andps 0x28c1(%rip), %xmm1     # 0x9980
addss 0x28a9(%rip), %xmm1     # 0x9970
xorps 0x27f2(%rip), %xmm1     # 0x98c0
movss %xmm1, 0x1c(%rbx)
addss 0x2899(%rip), %xmm0     # 0x9974
addss 0x2881(%rip), %xmm0     # 0x9964
movss %xmm0, 0x18(%rbx)
callq 0x10d0
movss %xmm0, 0x4(%rsp)
movss 0x1c(%rbx), %xmm0
callq 0x10a0
mulss 0x4(%rsp), %xmm0
leaq 0xc(%rbx), %r14
movss %xmm0, 0xc(%rbx)
movss 0x18(%rbx), %xmm0
callq 0x10a0
movss %xmm0, 0x10(%rbx)
movss 0x18(%rbx), %xmm0
callq 0x10d0
movss %xmm0, 0x4(%rsp)
movss 0x1c(%rbx), %xmm0
callq 0x10d0
xorps 0x2784(%rip), %xmm0     # 0x98c0
mulss 0x4(%rsp), %xmm0
movss %xmm0, 0x14(%rbx)
movss 0x2825(%rip), %xmm0     # 0x9974
addss 0x18(%rbx), %xmm0
movss %xmm0, 0x18(%rbx)
leaq 0x24(%rbx), %rdi
addq $0x30, %rbx
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x68eb
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/pwrite1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char buf[BUFLEN];
	char tmpfile[] = "/tmp/willitscale.XXXXXX";
	int fd = mkstemp(tmpfile);

	memset(buf, 0, sizeof(buf));
	assert(fd >= 0);
	unlink(tmpfile);

	while (1) {
		assert(pwrite(fd, buf, BUFLEN, 0) == BUFLEN);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1020, %rsp           # imm = 0x1020
movq %rdi, %rbx
movaps 0x7ab(%rip), %xmm0      # 0x32f0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movabsq $0x5858585858582e, %rax # imm = 0x5858585858582E
movq %rax, 0x10(%rdi)
callq 0x21c0
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %esi, %esi
callq 0x2130
testl %ebp, %ebp
js 0x2bb9
movq %rsp, %rdi
callq 0x2080
leaq 0x20(%rsp), %r14
movl $0x1000, %edx           # imm = 0x1000
movl %ebp, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x21d0
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x2ba0
incq (%rbx)
jmp 0x2b82
leaq 0x721(%rip), %rdi       # 0x32c8
leaq 0x6d7(%rip), %rsi       # 0x3285
leaq 0x6e0(%rip), %rcx       # 0x3295
pushq $0x16
jmp 0x2bd0
leaq 0x6bd(%rip), %rdi       # 0x327d
leaq 0x6be(%rip), %rsi       # 0x3285
leaq 0x6c7(%rip), %rcx       # 0x3295
pushq $0x12
popq %rdx
callq 0x2120