LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: loopinside
short loopinside(int x, int y, short startwall)
{
	int x1, y1, x2, y2, templong;
	short i, cnt;

	cnt = clockdir(startwall);
	i = startwall;
	do
	{
		x1 = wall[i].x; x2 = wall[wall[i].point2].x;
		if ((x1 >= x) || (x2 >= x))
		{
			y1 = wall[i].y; y2 = wall[wall[i].point2].y;
			if (y1 > y2)
			{
				templong = x1, x1 = x2, x2 = templong;
				templong = y1, y1 = y2, y2 = templong;
			}
			if ((y1 <= y) && (y2 > y))
				if (x1*(y-y2)+x2*(y1-y) <= x*(y1-y2))
					cnt ^= 1;
		}
		i = wall[i].point2;
	}
	while (i != startwall);
	return(cnt);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
movl %edx, %edi
callq 0x1a735
movslq %ebx, %rdx
shlq $0x5, %rdx
leaq 0x1971f9(%rip), %rcx    # 0x1b1a50
movl (%rcx,%rdx), %esi
movl %ebx, %edx
movl %esi, %edi
movswq %dx, %r8
shlq $0x5, %r8
movzwl 0x8(%rcx,%r8), %edx
movswq %dx, %r9
shlq $0x5, %r9
movl (%rcx,%r9), %esi
cmpl %r14d, %edi
setl %r10b
cmpl %r14d, %esi
setl %r11b
testb %r11b, %r10b
jne 0x1a8dc
addq %rcx, %r8
movl 0x4(%r8), %r8d
movl 0x4(%rcx,%r9), %r11d
cmpl %r11d, %r8d
jle 0x1a8a6
movl %r11d, %r9d
movl %edi, %r10d
movl %esi, %edi
jmp 0x1a8af
movl %r8d, %r9d
movl %esi, %r10d
movl %r11d, %r8d
movl %r9d, %r11d
subl %ebp, %r11d
jg 0x1a8dc
movl %ebp, %r15d
subl %r8d, %r15d
jge 0x1a8dc
imull %r15d, %edi
imull %r11d, %r10d
addl %edi, %r10d
subl %r8d, %r9d
imull %r14d, %r9d
xorl %edi, %edi
cmpl %r9d, %r10d
setle %dil
xorl %edi, %eax
cmpw %bx, %dx
jne 0x1a85c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: movewalls
int movewalls(int start, int offs)
{
	int i;

	if (offs < 0)  //Delete
	{
		for(i=start;i<numwalls+offs;i++)
			Bmemcpy(&wall[i],&wall[i-offs],sizeof(walltype));
	}
	else if (offs > 0)  //Insert
	{
		for(i=numwalls+offs-1;i>=start+offs;i--)
			Bmemcpy(&wall[i],&wall[i-offs],sizeof(walltype));
	}
	numwalls += offs;
	for(i=0;i<numwalls;i++)
	{
		if (wall[i].nextwall >= start) wall[i].nextwall += offs;
		if (wall[i].point2 >= start) wall[i].point2 += offs;
	}
	return(0);
}

// Assembly:
leaq 0x3f4ae7(%rip), %rax    # 0x40fc68
testl %esi, %esi
js 0x1b1dd
movzwl (%rax), %eax
je 0x1b224
movswl %ax, %ecx
addl %esi, %ecx
leal (%rsi,%rdi), %r8d
movslq %ecx, %rcx
movl %esi, %edx
movslq %r8d, %r8
shlq $0x5, %rdx
negq %rdx
movq %rcx, %r9
shlq $0x5, %r9
leaq 0x19689c(%rip), %r10    # 0x1b1a50
addq %r10, %r9
addq $-0x20, %r9
cmpq %r8, %rcx
jle 0x1b224
decq %rcx
movaps (%r9,%rdx), %xmm0
movaps 0x10(%r9,%rdx), %xmm1
movaps %xmm1, 0x10(%r9)
movaps %xmm0, (%r9)
addq $-0x20, %r9
jmp 0x1b1bb
movswl (%rax), %eax
movl %eax, %edx
addl %esi, %edx
movslq %edi, %rcx
movslq %edx, %rdx
movslq %esi, %r8
movq %rcx, %r9
shlq $0x5, %r9
addq 0x70dfd(%rip), %r9      # 0x8bff8
shlq $0x5, %r8
negq %r8
cmpq %rdx, %rcx
jge 0x1b224
movaps (%r9,%r8), %xmm0
movaps 0x10(%r9,%r8), %xmm1
movaps %xmm1, 0x10(%r9)
movaps %xmm0, (%r9)
incq %rcx
addq $0x20, %r9
jmp 0x1b202
addl %esi, %eax
leaq 0x3f4a3b(%rip), %rcx    # 0x40fc68
movw %ax, (%rcx)
xorl %ecx, %ecx
testw %ax, %ax
cmovlel %ecx, %eax
movzwl %ax, %eax
shll $0x5, %eax
leaq 0x19680b(%rip), %rdx    # 0x1b1a50
cmpq %rcx, %rax
je 0x1b278
movswl 0xa(%rdx,%rcx), %r8d
cmpl %edi, %r8d
jl 0x1b25e
addl %esi, %r8d
movw %r8w, 0xa(%rdx,%rcx)
movswl 0x8(%rdx,%rcx), %r8d
cmpl %edi, %r8d
jl 0x1b272
addl %esi, %r8d
movw %r8w, 0x8(%rdx,%rcx)
addq $0x20, %rcx
jmp 0x1b245
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: numloopsofsector
int numloopsofsector(short sectnum)
{
	int i, numloops, startwall, endwall;

	numloops = 0;
	startwall = sector[sectnum].wallptr;
	endwall = startwall + sector[sectnum].wallnum;
	for(i=startwall;i<endwall;i++)
		if (wall[i].point2 < i) numloops++;
	return(numloops);
}

// Assembly:
movslq %edi, %rax
imulq $0x28, %rax, %rax
leaq 0x2217d7(%rip), %rdx    # 0x23ca60
movswq (%rdx,%rax), %rcx
movswq 0x2(%rdx,%rax), %rdx
addq %rcx, %rdx
movq %rcx, %rax
shlq $0x5, %rax
leaq 0x1967ab(%rip), %rsi    # 0x1b1a50
addq %rax, %rsi
addq $0x8, %rsi
xorl %eax, %eax
cmpq %rdx, %rcx
jge 0x1b2cd
movswq (%rsi), %rdi
xorl %r8d, %r8d
cmpq %rdi, %rcx
setg %r8b
addl %r8d, %eax
incq %rcx
addq $0x20, %rsi
jmp 0x1b2ae
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: getfilenames
int getfilenames(char *path, char *kind)
{
	CACHE1D_FIND_REC *r;
	int type = 0;

	if (pathsearchmode == PATHSEARCH_GAME && grponlymode) {
		type = CACHE1D_OPT_NOSTACK;
	}

	clearfilenames();
	finddirs = klistpath(path,"*",CACHE1D_FIND_DIR|CACHE1D_FIND_DRIVE|type);
	findfiles = klistpath(path,kind,CACHE1D_FIND_FILE|type);
	for (r = finddirs; r; r=r->next) numdirs++;
	for (r = findfiles; r; r=r->next) numfiles++;

	finddirshigh = finddirs;
	findfileshigh = findfiles;
	currentlist = 0;
	if (findfileshigh) currentlist = 1;

	return(0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x192420(%rip), %rax    # 0x1ad700
cmpl $0x0, (%rax)
movq %rdi, %r14
sete %al
cmpl $0x0, 0x10b628(%rip)    # 0x126918
setne %cl
andb %al, %cl
movzbl %cl, %r15d
shll $0x8, %r15d
callq 0x1216c
leal 0x6(%r15), %edx
leaq 0x4d158(%rip), %rsi     # 0x68465
movq %r14, %rdi
callq 0x1e33b
movq %rax, 0x1582b4(%rip)    # 0x1735d0
leaq 0x1582ad(%rip), %r12    # 0x1735d0
incl %r15d
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x1e33b
movq %rax, 0x15829d(%rip)    # 0x1735d8
movl 0x15829f(%rip), %ecx    # 0x1735e0
incl %ecx
movq (%r12), %r12
testq %r12, %r12
je 0x1b358
movl %ecx, 0x15828e(%rip)    # 0x1735e0
addq $0x10, %r12
jmp 0x1b341
movl 0x158286(%rip), %ecx    # 0x1735e4
incl %ecx
movq %rax, %rdx
testq %rdx, %rdx
je 0x1b376
movl %ecx, 0x158276(%rip)    # 0x1735e4
movq 0x10(%rdx), %rdx
incl %ecx
jmp 0x1b363
movq 0x158253(%rip), %rcx    # 0x1735d0
movq %rcx, 0x158264(%rip)    # 0x1735e8
movq %rax, 0x158265(%rip)    # 0x1735f0
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, 0x15825f(%rip)    # 0x1735f8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: GetWallZPeg
int GetWallZPeg(int nWall)
{
	int z=0, nSector, nNextSector;

	nSector = sectorofwall((short)nWall);
	nNextSector = wall[nWall].nextsector;
	if (nNextSector == -1)
	{
			//1-sided wall
		if (wall[nWall].cstat&4) z = sector[nSector].floorz;
								  else z = sector[nSector].ceilingz;
	}
	else
	{
			//2-sided wall
		if (wall[nWall].cstat&4)
			z = sector[nSector].ceilingz;
		else
		{
			if (sector[nNextSector].ceilingz > sector[nSector].ceilingz)
				z = sector[nNextSector].ceilingz;   //top step
			if (sector[nNextSector].floorz < sector[nSector].floorz)
				z = sector[nNextSector].floorz;   //bottom step
		}
	}
	return(z);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movswl %bx, %edi
callq 0x39217
movslq %ebx, %rdx
shlq $0x5, %rdx
leaq 0x196238(%rip), %rsi    # 0x1b1a50
movswq 0xc(%rsi,%rdx), %rcx
movzwl 0xe(%rsi,%rdx), %edx
cmpq $-0x1, %rcx
je 0x1b859
testb $0x4, %dl
jne 0x1b871
imulq $0x28, %rcx, %rcx
leaq 0x221227(%rip), %rdx    # 0x23ca60
cltq
imulq $0x28, %rax, %rsi
movl 0x4(%rdx,%rcx), %edi
movl 0x8(%rdx,%rcx), %ecx
xorl %eax, %eax
cmpl 0x4(%rdx,%rsi), %edi
cmovgl %edi, %eax
cmpl 0x8(%rdx,%rsi), %ecx
cmovll %ecx, %eax
jmp 0x1b882
cltq
testb $0x4, %dl
je 0x1b873
imulq $0x28, %rax, %rax
leaq 0x2211f5(%rip), %rcx    # 0x23ca60
movl 0x8(%rcx,%rax), %eax
jmp 0x1b882
cltq
imulq $0x28, %rax, %rax
leaq 0x2211e2(%rip), %rcx    # 0x23ca60
movl 0x4(%rcx,%rax), %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: AlignWalls
void AlignWalls(int nWall0, int z0, int nWall1, int z1, int nTile)
{
	int n;

		//do the x alignment
	wall[nWall1].cstat &= ~0x0108;    //Set to non-flip
	wall[nWall1].xpanning = (unsigned char)((wall[nWall0].xpanning+(wall[nWall0].xrepeat<<3))%tilesizx[nTile]);

	z1 = GetWallZPeg(nWall1);

	for(n=(picsiz[nTile]>>4);((1<<n)<tilesizy[nTile]);n++);

	wall[nWall1].yrepeat = wall[nWall0].yrepeat;
	wall[nWall1].ypanning = (unsigned char)(wall[nWall0].ypanning+(((z1-z0)*wall[nWall0].yrepeat)>>(n+3)));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movslq %edx, %rcx
movq %rcx, %rsi
shlq $0x5, %rsi
leaq 0x1961b1(%rip), %r9     # 0x1b1a50
andw $0xfef7, 0xe(%r9,%rsi)  # imm = 0xFEF7
leaq (%r9,%rsi), %r14
movslq %edi, %rax
shlq $0x5, %rax
leaq (%r9,%rax), %r15
movzbl 0x18(%r9,%rax), %edx
movzbl 0x16(%r9,%rax), %eax
leal (%rdx,%rax,8), %eax
movslq %r8d, %r12
leaq 0x3ed751(%rip), %rdi    # 0x409020
xorl %edx, %edx
idivw (%rdi,%r12,2)
movb %dl, 0x18(%r9,%rsi)
movl %ecx, %edi
callq 0x1b7ff
leaq 0x3f1f67(%rip), %rcx    # 0x40d850
movzbl (%rcx,%r12), %ecx
shrl $0x4, %ecx
leaq 0x3deee8(%rip), %rdx    # 0x3fa7e0
movswl (%rdx,%r12,2), %edx
pushq $0x1
popq %rsi
movl %esi, %edi
shll %cl, %edi
incl %ecx
cmpl %edx, %edi
jl 0x1b900
movzbl 0x17(%r15), %edx
subl %ebx, %eax
imull %edx, %eax
addb $0x2, %cl
sarl %cl, %eax
movb %dl, 0x17(%r14)
addb 0x19(%r15), %al
movb %al, 0x19(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/config.c
// Function: writesetup
int writesetup(const char *fn)
{
	BFILE *fp;
	int item;

	fp = Bfopen(fn,"wt");
	if (!fp) return -1;

	tmpbrightness = brightness;
#if USE_POLYMOST
	tmprenderer = getrendermode();
#endif
#ifdef RENDERTYPEWIN
	tmpmaxrefreshfreq = win_getmaxrefreshfreq();
#endif

	for (item = 0; configspec[item].name; item++) {
		if (configspec[item].doc) {
			if (item > 0) fputs("\n", fp);
			fputs(configspec[item].doc, fp);
		}
		fputs(configspec[item].name, fp);
		fputs(" = ", fp);
		switch (configspec[item].type) {
			case type_bool: {
				fprintf(fp, "%d\n", (*(int*)configspec[item].store != 0));
				break;
			}
			case type_int: {
				fprintf(fp, "%d\n", *(int*)configspec[item].store);
				break;
			}
			case type_hex: {
				fprintf(fp, "%X\n", *(int*)configspec[item].store);
				break;
			}
			case type_fixed16: {
				fprintf(fp, "%g\n", (double)(*(int*)configspec[item].store) / 65536.0);
				break;
			}
			case type_double: {
				fprintf(fp, "%g\n", *(double*)configspec[item].store);
				break;
			}
			default: {
				fputs("?\n", fp);
				break;
			}
		}
	}

	Bfclose(fp);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4c9b5(%rip), %rsi     # 0x684f0
callq 0x6ce0
testq %rax, %rax
je 0x1bc6f
movq %rax, %rbx
leaq 0x10adc9(%rip), %rax    # 0x12691c
movswl (%rax), %eax
movl %eax, 0x814c4(%rip)     # 0x9d020
callq 0x39c14
movl %eax, 0x814b5(%rip)     # 0x9d01c
leaq 0x6fa62(%rip), %r13     # 0x8b5d0
leaq 0x4e467(%rip), %r15     # 0x69fdc
xorl %r14d, %r14d
cmpq $0x400, %r14            # imm = 0x400
je 0x1bc63
movq (%r14,%r13), %rbp
movq 0x18(%r14,%r13), %r12
testq %r12, %r12
je 0x1bbb2
testq %r14, %r14
je 0x1bba7
leaq 0x5052d(%rip), %rdi     # 0x6c0cc
movq %rbx, %rsi
callq 0x6320
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6320
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6320
leaq 0x4ceb3(%rip), %rdi     # 0x68a77
movq %rbx, %rsi
callq 0x6320
movl 0x8(%r14,%r13), %eax
cmpq $0x4, %rax
ja 0x1bc4b
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x10(%r14,%r13), %rax
xorl %edx, %edx
cmpl $0x0, (%rax)
setne %dl
jmp 0x1bc09
movq 0x10(%r14,%r13), %rax
cvtsi2sdl (%rax), %xmm0
mulsd 0x4e3c0(%rip), %xmm0    # 0x69fc0
jmp 0x1bc38
movq 0x10(%r14,%r13), %rax
movl (%rax), %edx
movq %rbx, %rdi
leaq 0x4f474(%rip), %rsi     # 0x6b087
jmp 0x1bc26
movq 0x10(%r14,%r13), %rax
movl (%rax), %edx
movq %rbx, %rdi
leaq 0x4e408(%rip), %rsi     # 0x6a02e
xorl %eax, %eax
callq 0x61e0
jmp 0x1bc5a
movq 0x10(%r14,%r13), %rax
movsd (%rax), %xmm0
movq %rbx, %rdi
leaq 0x4e3f0(%rip), %rsi     # 0x6a032
movb $0x1, %al
callq 0x61e0
jmp 0x1bc5a
leaq 0x4e3e4(%rip), %rdi     # 0x6a036
movq %rbx, %rsi
callq 0x6320
addq $0x20, %r14
jmp 0x1bb78
movq %rbx, %rdi
callq 0x6480
xorl %eax, %eax
jmp 0x1bc72
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: setup_messages_mode
static void setup_messages_mode(gboolean allowcancel)
{
    gtk_notebook_set_current_page(GTK_NOTEBOOK(controls.tabs), TAB_MESSAGES);

    // Disable all the controls on the Configuration page.
    gtk_container_foreach(GTK_CONTAINER(controls.configbox),
            foreach_gtk_widget_set_sensitive, (gpointer)FALSE);
    gtk_widget_set_sensitive(controls.alwaysshowcheck, FALSE);

    gtk_widget_set_sensitive(controls.cancelbutton, allowcancel);
    gtk_widget_set_sensitive(controls.startbutton, FALSE);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x15b091(%rip), %r14    # 0x177030
callq 0x6b80
movq %r14, %rdi
movq %rax, %rsi
callq 0x6140
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x6d20
movq 0x15b077(%rip), %r14    # 0x177038
callq 0x6860
movq %r14, %rdi
movq %rax, %rsi
callq 0x6140
leaq 0x8fd(%rip), %rsi       # 0x1c8d5
movq %rax, %rdi
xorl %edx, %edx
callq 0x6870
movq 0x15b057(%rip), %rdi    # 0x177040
xorl %esi, %esi
callq 0x6cb0
movq 0x15b031(%rip), %rdi    # 0x177028
movl %ebx, %esi
callq 0x6cb0
movq 0x15b01b(%rip), %rdi    # 0x177020
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6cb0
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: startwin_close
int startwin_close(void)
{
    if (!gtkenabled) return 0;
    if (!startwin) return 1;

    quiteventonclose = FALSE;
    gtk_widget_destroy(GTK_WIDGET(startwin));
    startwin = NULL;

    while (gtk_events_pending()) {
        gtk_main_iteration();
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x6ac056(%rip), %rax    # 0x6c8074
xorl %ebx, %ebx
cmpl $0x0, (%rax)
je 0x1c06b
movq 0x15afe4(%rip), %r14    # 0x177010
testq %r14, %r14
je 0x1c068
movb $0x0, 0x15afe0(%rip)    # 0x177018
callq 0x6c90
movq %r14, %rdi
movq %rax, %rsi
callq 0x6140
movq %rax, %rdi
callq 0x6180
andq $0x0, 0x15afb8(%rip)    # 0x177010
callq 0x6ac0
testl %eax, %eax
je 0x1c06b
callq 0x6040
jmp 0x1c058
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: startwin_puts
int startwin_puts(const char *str)
{
    GtkTextBuffer *textbuffer;
    GtkTextIter enditer;
    GtkTextMark *mark;
    const char *aptr, *bptr;

    if (!gtkenabled || !str) return 0;
    if (!startwin) return 1;

    textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(controls.messagestext));

    gtk_text_buffer_get_end_iter(textbuffer, &enditer);
    for (aptr = bptr = str; *aptr != 0; ) {
        switch (*bptr) {
            case '\b':
                if (bptr > aptr) {
                    // Insert any normal characters seen so far.
                    gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
                }
                gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
                aptr = ++bptr;
                break;
            case 0:
                if (bptr > aptr) {
                    gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
                }
                aptr = bptr;
                break;
            default:
                bptr++;
                break;
        }
    }

    mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(controls.messagestext), mark, 0.0, FALSE, 0.0, 1.0);
    gtk_text_buffer_delete_mark(textbuffer, mark);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
xorl %r12d, %r12d
testq %rdi, %rdi
je 0x1c18d
leaq 0x6abfe0(%rip), %rax    # 0x6c8074
cmpl $0x0, (%rax)
je 0x1c18d
cmpq $0x0, 0x15af6b(%rip)    # 0x177010
je 0x1c189
movq %rdi, %r14
movq 0x15af93(%rip), %rbx    # 0x177048
callq 0x66d0
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
movq %rax, %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x6ae0
pushq $0x1
popq %rbp
movq %r14, %rdx
movb (%r14), %al
xorl %ecx, %ecx
testb %al, %al
je 0x1c13c
movzbl (%r14), %esi
testl %esi, %esi
je 0x1c12a
cmpl $0x8, %esi
je 0x1c104
incq %r14
incl %ecx
jmp 0x1c0ec
cmpq %rdx, %r14
jbe 0x1c116
decl %ecx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x68f0
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x65a0
incq %r14
jmp 0x1c0e4
cmpq %rdx, %r14
jbe 0x1c0e4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x68f0
jmp 0x1c0e4
xorl %r12d, %r12d
movq %rsp, %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6a50
movq %rax, %r14
movq 0x15aeef(%rip), %rdi    # 0x177048
movq %r15, %rsi
callq 0x6140
movsd 0x4e997(%rip), %xmm2    # 0x6ab00
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6030
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6050
jmp 0x1c18d
pushq $0x1
popq %r12
movl %r12d, %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: startwin_run
int startwin_run(struct startwin_settings *settings)
{
    if (!gtkenabled || !startwin) return 0;

    set_settings(settings);
    setup_config_mode();
    startwinloop = TRUE;
    while (startwinloop) {
        gtk_main_iteration_do(TRUE);
    }
    setup_messages_mode(FALSE);
    set_settings(NULL);

    return retval;
}

// Assembly:
leaq 0x6abea5(%rip), %rcx    # 0x6c8074
xorl %eax, %eax
cmpl $0x0, (%rcx)
je 0x1c31a
cmpq $0x0, 0x15ae2e(%rip)    # 0x177010
je 0x1c31a
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, 0x15ae8d(%rip)    # 0x177080
movq 0x15ae36(%rip), %rbx    # 0x177030
callq 0x6b80
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
movq %rax, %rdi
xorl %esi, %esi
callq 0x6d20
movq 0x15ae1d(%rip), %rbx    # 0x177038
callq 0x6860
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
leaq 0x6a3(%rip), %rsi       # 0x1c8d5
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0x6870
movq 0x15adfc(%rip), %rbx    # 0x177040
callq 0x6c10
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
movq 0x15ae22(%rip), %rcx    # 0x177080
movl 0x18(%rcx), %esi
movq %rax, %rdi
callq 0x6d30
movq 0x15add0(%rip), %rdi    # 0x177040
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x6cb0
movq 0x15adef(%rip), %rdi    # 0x177070
movq %r14, %rsi
callq 0x6140
movq 0x15adf0(%rip), %rcx    # 0x177080
movl (%rcx), %esi
movq %rax, %rdi
callq 0x6d30
movq 0x15adcf(%rip), %rdi    # 0x177070
movl %ebx, %esi
callq 0x6cb0
movl %ebx, %edi
callq 0x1c525
movq 0x15adaa(%rip), %rdi    # 0x177060
movl %ebx, %esi
callq 0x6cb0
movq 0x15ad8c(%rip), %rdi    # 0x177050
movl %ebx, %esi
callq 0x6cb0
movq 0x15ad56(%rip), %rdi    # 0x177028
movl %ebx, %esi
callq 0x6cb0
movq 0x15ad40(%rip), %rdi    # 0x177020
movl %ebx, %esi
callq 0x6cb0
movb $0x1, 0x15ad8a(%rip)    # 0x177078
movl %ebx, %edi
callq 0x63f0
cmpb $0x0, 0x15ad7c(%rip)    # 0x177078
jne 0x1c2ee
xorl %edi, %edi
callq 0x1bf92
andq $0x0, 0x15ad73(%rip)    # 0x177080
movl 0x80d11(%rip), %eax     # 0x9d024
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: get_and_connect_signal
static GObject * get_and_connect_signal(GtkBuilder *builder, const char *name, const char *signal_name, GCallback handler)
{
    GObject *object;

    object = gtk_builder_get_object(builder, name);
    if (!object) {
        buildprintf("gtk_builder_get_object: %s not found\n", name);
        return 0;
    }
    g_signal_connect(object, signal_name, handler, NULL);
    return object;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
callq 0x6820
movq %rax, %rbx
testq %rax, %rax
je 0x1c351
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x6200
jmp 0x1c362
leaq 0x4e8ab(%rip), %rdi     # 0x6ac03
movq %r15, %rsi
xorl %eax, %eax
callq 0x22427
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: on_startgtk_delete_event
static gboolean on_startgtk_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
    (void)widget; (void)event; (void)user_data;

    startwinloop = FALSE;   // Break the loop.
    retval = STARTWIN_CANCEL;
    quitevent = quitevent || quiteventonclose;
    return TRUE;    // FALSE would let the event go through. We want the game to decide when to close.
}

// Assembly:
andl $0x0, 0x80cac(%rip)     # 0x9d024
leaq 0x15ad21(%rip), %rax    # 0x1770a0
cmpb $0x0, (%rax)
movb $0x0, 0x15acef(%rip)    # 0x177078
setne %cl
orb 0x15ac86(%rip), %cl     # 0x177018
andb $0x1, %cl
movb %cl, (%rax)
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: on_startbutton_clicked
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
{
    int mode = -1;
    GtkTreeIter iter;

    (void)button; (void)user_data;

    if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(controls.vmode3dcombo), &iter)) {
        gtk_tree_model_get(GTK_TREE_MODEL(controls.vmode3dlist), &iter, 1 /*index*/, &mode, -1);
    }
    if (mode >= 0) {
        settings->xdim3d = validmode[mode].xdim;
        settings->ydim3d = validmode[mode].ydim;
        settings->bpp3d = validmode[mode].bpp;
        settings->fullscreen = validmode[mode].fs;
    }
    if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(controls.vmode2dcombo), &iter)) {
        gtk_tree_model_get(GTK_TREE_MODEL(controls.vmode2dlist), &iter, 1 /*index*/, &mode, -1);
    }
    if (mode >= 0) {
        settings->xdim2d = validmode[mode].xdim;
        settings->ydim2d = validmode[mode].ydim;
    }

    settings->forcesetup = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(controls.alwaysshowcheck));

    startwinloop = FALSE;   // Break the loop.
    retval = STARTWIN_RUN;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
orl $-0x1, 0x4(%rsp)
movq 0x15acb2(%rip), %r14    # 0x177060
callq 0x6640
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x6140
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x6cc0
testl %eax, %eax
je 0x1c43d
movq 0x15ac8f(%rip), %r14    # 0x177068
callq 0x6440
movq %r14, %rdi
movq %rax, %rsi
callq 0x6140
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x4(%rsp), %r14
pushq $-0x1
popq %r8
movq %rax, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x66b0
movslq (%r14), %rax
testq %rax, %rax
js 0x1c43d
shlq $0x4, %rax
leaq 0x418a36(%rip), %rcx    # 0x434e50
movl (%rcx,%rax), %edx
movq 0x15ac5c(%rip), %rsi    # 0x177080
movl %edx, 0xc(%rsi)
movl 0x4(%rcx,%rax), %edx
movl %edx, 0x10(%rsi)
movzbl 0x8(%rcx,%rax), %edx
movl %edx, 0x14(%rsi)
movzbl 0x9(%rcx,%rax), %eax
movl %eax, (%rsi)
movq 0x15ac0c(%rip), %rdi    # 0x177050
movq %rbx, %rsi
callq 0x6140
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x6cc0
testl %eax, %eax
je 0x1c48f
movq 0x15abf4(%rip), %rbx    # 0x177058
callq 0x6440
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x4(%rsp), %rcx
pushq $-0x1
popq %r8
movq %rax, %rdi
xorl %eax, %eax
callq 0x66b0
movslq 0x4(%rsp), %rax
testq %rax, %rax
js 0x1c4b8
shlq $0x4, %rax
leaq 0x4189ac(%rip), %rcx    # 0x434e50
movl (%rcx,%rax), %edx
movq 0x15abd2(%rip), %rsi    # 0x177080
movl %edx, 0x4(%rsi)
movl 0x4(%rcx,%rax), %eax
movl %eax, 0x8(%rsi)
movq 0x15ab81(%rip), %rbx    # 0x177040
callq 0x6c10
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6140
movq %rax, %rdi
callq 0x62d0
movq 0x15aba2(%rip), %rcx    # 0x177080
movl %eax, 0x18(%rcx)
movb $0x0, 0x15ab90(%rip)    # 0x177078
movl $0x1, 0x80b32(%rip)     # 0x9d024
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/baselayer.c
// Function: bgetkey
int bgetkey(void)
{
	int c;
	if (keyfifoplc == keyfifoend) return 0;
	c = keyfifo[keyfifoplc];
	if (!keyfifo[(keyfifoplc+1)&(KEYFIFOSIZ-1)]) c = -c;
	keyfifoplc = (keyfifoplc+2)&(KEYFIFOSIZ-1);
	return c;
}

// Assembly:
movslq 0x15a661(%rip), %rcx    # 0x177140
xorl %eax, %eax
cmpl 0x15a65d(%rip), %ecx    # 0x177144
je 0x1cb10
leaq 0x15a660(%rip), %rdx    # 0x177150
movl (%rdx,%rcx,4), %esi
leal 0x1(%rcx), %edi
andl $0x3f, %edi
movl %esi, %eax
negl %eax
cmpl $0x0, (%rdx,%rdi,4)
cmovnel %esi, %eax
addl $0x2, %ecx
andl $0x3f, %ecx
movl %ecx, 0x15a630(%rip)    # 0x177140
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/baselayer.c
// Function: baselayer_init
int baselayer_init(void)
{
    OSD_Init();

	OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA, PCX, PNG)",osdcmd_vars);

	OSD_RegisterFunction("novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars);
	OSD_RegisterFunction("usevoxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars);
	OSD_RegisterFunction("usegammabrightness","usegammabrightness: set brightness using system gamma (2), shader (1), or palette (0)",osdcmd_vars);
	OSD_RegisterFunction("listvidmodes","listvidmodes [bpp|win|fs]: show all available video mode combinations",osdcmd_listvidmodes);

#if USE_POLYMOST
	OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
			"Mode numbers are:\n"
			"   0 - Classic Build software\n"
			"   1 - Polygonal flat-shaded software\n"
			"   2 - Polygonal textured software\n"
#if USE_OPENGL
			"   3 - Polygonal OpenGL\n"
#endif
			,
			osdfunc_setrendermode);
#endif //USE_POLYMOST

#if defined(DEBUGGINGAIDS) && USE_POLYMOST && USE_OPENGL
	OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
#endif

	return 0;
}

// Assembly:
pushq %rbx
callq 0x42ba3
leaq 0x4e129(%rip), %rdi     # 0x6ac68
leaq 0x4e136(%rip), %rsi     # 0x6ac7c
leaq 0x82(%rip), %rbx        # 0x1cbcf
movq %rbx, %rdx
callq 0x42c61
leaq 0x4e16c(%rip), %rdi     # 0x6acc8
leaq 0x4e16f(%rip), %rsi     # 0x6acd2
movq %rbx, %rdx
callq 0x42c61
leaq 0x4e1a6(%rip), %rdi     # 0x6ad18
leaq 0x4e1a9(%rip), %rsi     # 0x6ad22
movq %rbx, %rdx
callq 0x42c61
leaq 0x4d638(%rip), %rdi     # 0x6a1c0
leaq 0x4e1cf(%rip), %rsi     # 0x6ad5e
movq %rbx, %rdx
callq 0x42c61
leaq 0x4e216(%rip), %rdi     # 0x6adb4
leaq 0x4e21c(%rip), %rsi     # 0x6adc1
leaq 0x1f9(%rip), %rdx       # 0x1cda5
callq 0x42c61
leaq 0x4e24f(%rip), %rdi     # 0x6ae07
leaq 0x4e256(%rip), %rsi     # 0x6ae15
leaq 0x30e(%rip), %rdx       # 0x1ced4
callq 0x42c61
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/baselayer.c
// Function: osdcmd_listvidmodes
static int osdcmd_listvidmodes(const osdfuncparm_t *parm)
{
	int filterbpp = -1, filterfs = -1, found = 0;

	for (int i = 0; i < parm->numparms; i++) {
		if (strcasecmp(parm->parms[i], "win") == 0) {
			filterfs = 0;
		} else if (strcasecmp(parm->parms[i], "fs") == 0) {
			filterfs = 1;
		} else {
			char *e = NULL;
			long l = strtol(parm->parms[i], &e, 10);
			if (!e || *e != 0) return OSDCMD_SHOWHELP;
			filterbpp = (int)l;
		}
	}

	for (int i = 0; i < validmodecnt; i++) {
		if (filterbpp >= 0 && validmode[i].bpp != filterbpp) continue;
		if (filterfs >= 0 && (validmode[i].fs & 1) != filterfs) continue;
		buildprintf(" %4dx%-4d %d-bit %s\n", validmode[i].xdim, validmode[i].ydim,
			validmode[i].bpp, (validmode[i].fs & 1) ? "fullscreen" : "windowed");
		found++;
	}
	buildprintf("%d modes identified\n", found);
	return OSDCMD_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $-0x1
popq %rbx
xorl %r15d, %r15d
pushq $0x1
popq %rbp
movl %ebx, %r12d
movslq (%r14), %rax
cmpq %rax, %r15
jge 0x1ce32
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %r13
movq %r13, %rdi
leaq 0x4e177(%rip), %rsi     # 0x6af50
callq 0x6880
testl %eax, %eax
je 0x1ce28
movq %r13, %rdi
leaq 0x4e168(%rip), %rsi     # 0x6af54
callq 0x6880
movl %ebp, %ecx
testl %eax, %eax
je 0x1ce2a
andq $0x0, (%rsp)
movq %r13, %rdi
movq %rsp, %rsi
pushq $0xa
popq %rdx
callq 0x6940
movq %rax, %rbx
movq (%rsp), %rax
testq %rax, %rax
je 0x1cec3
cmpb $0x0, (%rax)
jne 0x1cec3
movl %r12d, %ecx
jmp 0x1ce2a
xorl %ecx, %ecx
incq %r15
movl %ecx, %r12d
jmp 0x1cdbf
leaq 0x418017(%rip), %r13    # 0x434e50
addq $0x9, %r13
leaq 0x339a6c(%rip), %rbp    # 0x3568b0
movl (%rbp), %eax
xorl %r15d, %r15d
xorl %r14d, %r14d
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0x1ceb0
testl %ebx, %ebx
js 0x1ce62
movzbl -0x1(%r13), %ecx
cmpl %ecx, %ebx
jne 0x1cea7
movzbl (%r13), %ecx
andl $0x1, %ecx
testl %r12d, %r12d
js 0x1ce74
cmpl %ecx, %r12d
jne 0x1cea7
leaq 0x4e0f1(%rip), %r8      # 0x6af6c
testb %cl, %cl
je 0x1ce86
leaq 0x4d205(%rip), %r8      # 0x6a08b
movl -0x9(%r13), %esi
movl -0x5(%r13), %edx
movzbl -0x1(%r13), %ecx
leaq 0x4e0bd(%rip), %rdi     # 0x6af57
xorl %eax, %eax
callq 0x22427
incl %r14d
movl (%rbp), %eax
incq %r15
addq $0x10, %r13
jmp 0x1ce4d
leaq 0x4e0be(%rip), %rdi     # 0x6af75
xorl %ebp, %ebp
movl %r14d, %esi
xorl %eax, %eax
callq 0x22427
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/baselayer.c
// Function: osdfunc_setrendermode
static int osdfunc_setrendermode(const osdfuncparm_t *parm)
{
	int m;
	char *p;

	char *modestrs[] = {
		"classic software", "polygonal flat-shaded software",
		"polygonal textured software", "polygonal OpenGL"
	};

	if (parm->numparms != 1) return OSDCMD_SHOWHELP;
	m = (int)strtol(parm->parms[0], &p, 10);

	if (m < 0 || m > 3 || *p) return OSDCMD_SHOWHELP;

	setrendermode(m);
	buildprintf("Rendering method changed to %s\n", modestrs[ getrendermode() ] );

	return OSDCMD_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
pushq $0x1
popq %rbx
cmpl $0x1, (%rdi)
jne 0x1cf30
movq 0x10(%rdi), %rax
movq (%rax), %rdi
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x6940
cmpl $0x3, %eax
ja 0x1cf30
movq 0x8(%rsp), %rcx
cmpb $0x0, (%rcx)
jne 0x1cf30
movl %eax, %edi
callq 0x39be6
callq 0x39c14
cltq
leaq 0x4e0fb(%rip), %rcx     # 0x6b014
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
leaq 0x4e0c0(%rip), %rdi     # 0x6afe7
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22427
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: initcache
void initcache(void *dacachestart, size_t dacachesize)
{
	int i;

	for(i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);

	cachestart = ((intptr_t)dacachestart + 15) & ~15;
	cachesize = (dacachesize - ((-(intptr_t)dacachestart) & 15)) & ~15;

	cac[0].leng = cachesize;
	cac[0].lock = &zerochar;
	cacnum = 1;

	buildprintf("initcache(): Initialised with %zu bytes\n", cachesize);
}

// Assembly:
movl $0xc7, %r9d
leaq 0x15a48f(%rip), %rcx    # 0x1773d4
movl $0xc7, %r8d
subq $0x1, %r8
jb 0x1cf66
movl $0x10000000, %eax       # imm = 0x10000000
xorl %edx, %edx
divl %r9d
movl %eax, (%rcx)
addq $0x4, %rcx
movq %r8, %r9
jmp 0x1cf4b
leaq 0xf(%rdi), %rax
andq $-0x10, %rax
movq %rax, 0x15a443(%rip)    # 0x1773b8
negl %edi
andl $0xf, %edi
subq %rdi, %rsi
andq $-0x10, %rsi
movq %rsi, 0x15a768(%rip)    # 0x1776f0
movq %rsi, 0x15a779(%rip)    # 0x177708
leaq 0x15a41e(%rip), %rax    # 0x1773b4
movq %rax, 0x15a773(%rip)    # 0x177710
movl $0x1, 0x15a419(%rip)    # 0x1773c0
leaq 0x4e076(%rip), %rdi     # 0x6b024
xorl %eax, %eax
jmp 0x22427
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: reportandexit
static void reportandexit(char *errormessage)
{
    int i;
    size_t j;

    j = 0;
    for(i=0;i<cacnum;i++)
    {
        buildprintf("%d- ",i);
        if (cac[i].hand) {
            buildprintf("ptr: 0x%p, ",*cac[i].hand);
        } else {
            buildprintf("ptr: NULL, ");
        }
        buildprintf("leng: %zu, ",cac[i].leng);
        if (cac[i].lock) {
            buildprintf("lock: %d\n",*cac[i].lock);
        } else {
            buildprintf("lock: NULL\n");
        }
        j += cac[i].leng;
    }
	buildprintf("Cachesize = %zu\n",cachesize);
	buildprintf("Cacnum = %d\n",cacnum);
	buildprintf("Cache length sum = %zu\n",j);
	buildprintf("ERROR: %s\n",errormessage);
	exit(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, (%rsp)
leaq 0x15a445(%rip), %rbx    # 0x177710
leaq 0x4dedb(%rip), %r15     # 0x6b1ad
leaq 0x4def1(%rip), %r13     # 0x6b1ca
leaq 0x4ded2(%rip), %r12     # 0x6b1b2
xorl %ebp, %ebp
xorl %r14d, %r14d
movslq 0x15a0d4(%rip), %rax    # 0x1773c0
cmpq %rax, %rbp
jge 0x1d36a
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x22427
movq -0x10(%rbx), %rax
testq %rax, %rax
je 0x1d315
movq (%rax), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x22427
jmp 0x1d323
leaq 0x4dea2(%rip), %rdi     # 0x6b1be
xorl %eax, %eax
callq 0x22427
movq -0x8(%rbx), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x22427
movq (%rbx), %rax
testq %rax, %rax
je 0x1d34c
movzbl (%rax), %esi
leaq 0x4dd3e(%rip), %rdi     # 0x6b081
xorl %eax, %eax
callq 0x22427
jmp 0x1d35a
leaq 0x4de83(%rip), %rdi     # 0x6b1d6
xorl %eax, %eax
callq 0x22427
addq -0x8(%rbx), %r14
incq %rbp
addq $0x18, %rbx
jmp 0x1d2e5
movq 0x15a37f(%rip), %rsi    # 0x1776f0
leaq 0x4de6a(%rip), %rdi     # 0x6b1e2
xorl %eax, %eax
callq 0x22427
movl 0x15a03b(%rip), %esi    # 0x1773c0
leaq 0x4de67(%rip), %rdi     # 0x6b1f3
xorl %eax, %eax
callq 0x22427
leaq 0x4de66(%rip), %rdi     # 0x6b200
movq %r14, %rsi
xorl %eax, %eax
callq 0x22427
leaq 0x4de6d(%rip), %rdi     # 0x6b218
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x22427
xorl %edi, %edi
callq 0x66a0
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: suckcache
void suckcache(void *suckptr)
{
	int i;

		//Can't exit early, because invalid pointer might be same even though lock = 0
	for(i=0;i<cacnum;i++)
		if (*cac[i].hand == suckptr)
		{
			if (*cac[i].lock) *cac[i].hand = 0;
			cac[i].lock = &zerochar;
			cac[i].hand = 0;

				//Combine empty blocks
			if ((i > 0) && (*cac[i-1].lock == 0))
			{
				cac[i-1].leng += cac[i].leng;
				cacnum--; copybuf(&cac[i+1],&cac[i],(cacnum-i)*sizeof(cactype));
			}
			else if ((i < cacnum-1) && (*cac[i+1].lock == 0))
			{
				cac[i+1].leng += cac[i].leng;
				cacnum--; copybuf(&cac[i+1],&cac[i],(cacnum-i)*sizeof(cactype));
			}
		}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
leaq 0x15a32b(%rip), %r12    # 0x177700
leaq 0x159fd8(%rip), %r13    # 0x1773b4
movq %r12, %r14
xorl %ebp, %ebp
movslq 0x159fd8(%rip), %rax    # 0x1773c0
cmpq %rax, %rbp
jge 0x1d479
movq (%r14), %rcx
cmpq %rbx, (%rcx)
je 0x1d405
incq %rbp
decl %r15d
addq $0x18, %r14
jmp 0x1d3e1
movq 0x10(%r14), %rdx
cmpb $0x0, (%rdx)
je 0x1d412
andq $0x0, (%rcx)
movq %r13, 0x10(%r14)
andq $0x0, (%r14)
testq %rbp, %rbp
je 0x1d428
movq -0x8(%r14), %rcx
cmpb $0x0, (%rcx)
je 0x1d44d
decq %rax
cmpq %rax, %rbp
jge 0x1d3f9
movq 0x28(%r14), %rcx
cmpb $0x0, (%rcx)
jne 0x1d3f9
leaq 0x18(%r14), %rdi
movq 0x8(%r14), %rcx
addq %rcx, 0x20(%r14)
movl %eax, 0x159f75(%rip)    # 0x1773c0
jmp 0x1d469
movq 0x8(%r14), %rcx
addq %rcx, -0x10(%r14)
decl %eax
movl %eax, 0x159f63(%rip)    # 0x1773c0
imulq $0x18, %rbp, %rcx
leaq (%rcx,%r12), %rdi
addq $0x18, %rdi
addl %r15d, %eax
imull $0x18, %eax, %edx
movq %r14, %rsi
callq 0x444be
jmp 0x1d3f9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: agecache
void agecache(void)
{
	int cnt;
	unsigned char ch;

	if (agecount >= cacnum) agecount = cacnum-1;
	if (agecount < 0) return;
	for(cnt=(cacnum>>4);cnt>=0;cnt--)
	{
		ch = (*cac[agecount].lock);
		if (((ch-2)&255) < 198)
			(*cac[agecount].lock) = ch-1;

		agecount--; if (agecount < 0) agecount = cacnum-1;
	}
}

// Assembly:
movl 0x159f36(%rip), %edx    # 0x1773c4
movl 0x159f2c(%rip), %eax    # 0x1773c0
cmpl %eax, %edx
jl 0x1d4a1
leal -0x1(%rax), %edx
movl %edx, 0x159f23(%rip)    # 0x1773c4
testl %edx, %edx
js 0x1d4f9
sarl $0x4, %eax
leaq 0x15a251(%rip), %rcx    # 0x177700
testl %eax, %eax
js 0x1d4f9
movslq %edx, %rsi
imulq $0x18, %rsi, %rsi
movq 0x10(%rsi,%rcx), %rsi
movb (%rsi), %dil
leal -0x2(%rdi), %r8d
cmpb $-0x3b, %r8b
ja 0x1d4d8
decb %dil
movb %dil, (%rsi)
movl 0x159eec(%rip), %edx    # 0x1773c4
leal -0x1(%rdx), %esi
movl %esi, 0x159ee3(%rip)    # 0x1773c4
testl %edx, %edx
jg 0x1d4f3
movl 0x159ed5(%rip), %esi    # 0x1773c0
decl %esi
movl %esi, 0x159ed1(%rip)    # 0x1773c4
decl %eax
movl %esi, %edx
jmp 0x1d4af
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: addsearchpath
int addsearchpath(const char *p)
{
	struct stat st;
	char *s;
	searchpath_t *srch;

	if (Bstat(p, &st) < 0) {
		if (errno == ENOENT) return -2;
		return -1;
	}
	if (!(st.st_mode & BS_IFDIR)) return -1;

	srch = (searchpath_t*)malloc(sizeof(searchpath_t));
	if (!srch) return -1;

	srch->next    = searchpathhead;
	srch->pathlen = strlen(p)+1;
	srch->path    = (char*)malloc(srch->pathlen + 1);
	if (!srch->path) {
		free(srch);
		return -1;
	}
	strcpy(srch->path, p);
	for (s=srch->path; *s; s++) ;
	s--;
	if (s<srch->path || toupperlookup[(int)(unsigned char)*s] != '/') strcat(srch->path, "/");

	searchpathhead = srch;
	if (srch->pathlen > maxsearchpathlen) maxsearchpathlen = srch->pathlen;
	buildprintf("Added %s to search path.\n", srch->path);

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %r12
movq %rsp, %rsi
callq 0x6110
testl %eax, %eax
js 0x1d5d0
pushq $-0x1
popq %rbx
testb $0x40, 0x19(%rsp)
je 0x1d5df
pushq $0x18
popq %rdi
callq 0x69a0
testq %rax, %rax
je 0x1d5df
movq %rax, %r14
movq 0x1901c2(%rip), %rax    # 0x1ad708
movq %rax, (%r14)
movq %r12, %rdi
callq 0x6420
leaq 0x1(%rax), %r13
movq %r13, 0x10(%r14)
leaq 0x2(%rax), %rdi
callq 0x69a0
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x1d5f2
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
callq 0x6430
leaq -0x2(%r15), %rax
cmpb $0x0, 0x2(%rax)
leaq 0x1(%rax), %rax
jne 0x1d581
cmpq %r15, %rax
jb 0x1d595
cmpb $0x2f, (%rax)
je 0x1d5a4
movq %r15, %rdi
callq 0x6420
movw $0x2f, (%r15,%rax)
movq %r14, 0x19015d(%rip)    # 0x1ad708
cmpq 0x19015e(%rip), %r13    # 0x1ad710
jbe 0x1d5bb
movq %r13, 0x190155(%rip)    # 0x1ad710
leaq 0x4db5b(%rip), %rdi     # 0x6b11d
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x22427
jmp 0x1d5df
callq 0x6a90
xorl %ebx, %ebx
cmpl $0x2, (%rax)
sete %bl
notl %ebx
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x61c0
jmp 0x1d5df
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: findfrompath
int findfrompath(const char *fn, char **where)
{
	searchpath_t *sp;
	char *pfn, *ffn;
	size_t allocsiz;

	// pathsearchmode == 0: tests current dir and then the dirs of the path stack
	// pathsearchmode == 1: tests fn without modification, then like for pathsearchmode == 0
	
	if (pathsearchmode) {
		// test unmolested filename first
		if (access(fn, F_OK) >= 0) {
			*where = strdup(fn);
			return 0;
		}
	}

	for (; toupperlookup[(int)(unsigned char)*fn] == '/'; fn++);
	ffn = strdup(fn);
	if (!ffn) return -1;
	Bcorrectfilename(ffn,0);	// compress relative paths
	
	allocsiz = max(maxsearchpathlen, 2u);	// "./" (aka. curdir)
	allocsiz += strlen(ffn);
	allocsiz += 1;	// a nul
	
	pfn = (char *)malloc(allocsiz);
	if (!pfn) { free(ffn); return -1; }

	strcpy(pfn, "./");
	strcat(pfn, ffn);
	if (access(pfn, F_OK) >= 0) {
		*where = pfn;
		free(ffn);
		return 0;
	}
	
	for (sp = searchpathhead; sp; sp = sp->next) {
		strcpy(pfn, sp->path);
		strcat(pfn, ffn);
		//buildprintf("Trying %s\n", pfn);
		if (access(pfn, F_OK) >= 0) {
			*where = pfn;
			free(ffn);
			return 0;
		}
	}
	free(pfn); free(ffn);
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x0, 0x1900ee(%rip)    # 0x1ad700
je 0x1d634
xorl %ebx, %ebx
movq %r15, %rdi
xorl %esi, %esi
callq 0x6160
testl %eax, %eax
js 0x1d634
movq %r15, %rdi
callq 0x6060
movq %rax, (%r14)
jmp 0x1d708
decq %r15
cmpb $0x2f, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x1d637
movq %r15, %rdi
callq 0x6060
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x1d708
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x1f656
movq 0x1900a6(%rip), %rax    # 0x1ad710
cmpq $0x3, %rax
pushq $0x2
popq %r12
cmovaeq %rax, %r12
movq %r15, %rdi
callq 0x6420
leaq (%rax,%r12), %rdi
incq %rdi
callq 0x69a0
testq %rax, %rax
je 0x1d700
movq %rax, %r12
movb $0x0, 0x2(%rax)
movw $0x2f2e, (%rax)         # imm = 0x2F2E
movq %rax, %rdi
movq %r15, %rsi
callq 0x6710
movq %r12, %rdi
xorl %esi, %esi
callq 0x6160
testl %eax, %eax
jns 0x1d6e9
leaq 0x19004d(%rip), %r13    # 0x1ad708
movq (%r13), %r13
testq %r13, %r13
je 0x1d6f8
movq 0x8(%r13), %rsi
movq %r12, %rdi
callq 0x6430
movq %r12, %rdi
movq %r15, %rsi
callq 0x6710
movq %r12, %rdi
xorl %esi, %esi
callq 0x6160
testl %eax, %eax
js 0x1d6bb
movq %r12, (%r14)
movq %r15, %rdi
callq 0x61c0
xorl %ebx, %ebx
jmp 0x1d708
movq %r12, %rdi
callq 0x61c0
movq %r15, %rdi
callq 0x61c0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: fopenfrompath
BFILE* fopenfrompath(const char *fn, const char *mode)
{
	int fh;
	BFILE *h;
	int bmode = 0, smode = 0;
	const char *c;

	for (c=mode; c[0]; ) {
			 if (c[0] == 'r' && c[1] == '+') { bmode = BO_RDWR; smode = BS_IREAD|BS_IWRITE; c+=2; }
		else if (c[0] == 'r')                { bmode = BO_RDONLY; smode = BS_IREAD; c+=1; }
		else if (c[0] == 'w' && c[1] == '+') { bmode = BO_RDWR|BO_CREAT|BO_TRUNC; smode = BS_IREAD|BS_IWRITE; c+=2; }
		else if (c[0] == 'w')                { bmode = BO_WRONLY|BO_CREAT|BO_TRUNC; smode = BS_IREAD|BS_IWRITE; c+=2; }
		else if (c[0] == 'a' && c[1] == '+') { bmode = BO_RDWR|BO_CREAT; smode=BS_IREAD|BS_IWRITE; c+=2; }
		else if (c[0] == 'a')                { bmode = BO_WRONLY|BO_CREAT; smode=BS_IREAD|BS_IWRITE; c+=1; }
		else if (c[0] == 'b')                { bmode |= BO_BINARY; c+=1; }
		else if (c[1] == 't')                { bmode |= BO_TEXT; c+=1; }
		else c++;
	}
	fh = openfrompath(fn,bmode,smode);
	if (fh < 0) return NULL;
	
	h = fdopen(fh,mode);
	if (!h) close(fh);

	return h;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
xorl %esi, %esi
pushq $0x2
popq %rax
xorl %edx, %edx
movq %rbx, %rcx
incq %rcx
movzbl -0x1(%rcx), %r8d
testl %r8d, %r8d
je 0x1d7d9
cmpl $0x61, %r8d
je 0x1d7a5
cmpl $0x77, %r8d
je 0x1d7c0
cmpl $0x72, %r8d
jne 0x1d76b
movl $0x100, %edx            # imm = 0x100
cmpb $0x2b, (%rcx)
movl $0x0, %esi
jne 0x1d76b
incq %rcx
movl $0x180, %edx            # imm = 0x180
movl %eax, %esi
jmp 0x1d76b
leaq 0x1(%rcx), %rdx
xorl %esi, %esi
cmpb $0x2b, (%rcx)
sete %sil
cmoveq %rdx, %rcx
addl $0x41, %esi
movl $0x180, %edx            # imm = 0x180
jmp 0x1d76b
xorl %esi, %esi
cmpb $0x2b, (%rcx)
sete %sil
incq %rcx
addl $0x241, %esi            # imm = 0x241
movl $0x180, %edx            # imm = 0x180
jmp 0x1d76b
callq 0x1d714
testl %eax, %eax
js 0x1d7fa
movl %eax, %ebp
movl %eax, %edi
movq %rbx, %rsi
callq 0x60b0
testq %rax, %rax
jne 0x1d7fc
movl %ebp, %edi
callq 0x6220
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: uninitsinglegroupfile
void uninitsinglegroupfile(int grphandle)
{
	int i, grpnum = -1;

	for(i=numgroupfiles-1;i>=0;i--)
		if (groupfil[i] != -1 && groupfil[i] == grphandle)
		{
			kfree(gfilelist[i]);
			kfree(gfileoffs[i]);
			Bclose(groupfil[i]);
			groupfil[i] = -1;
			grpnum = i;
			break;
		}

	if (grpnum == -1) return;

	// JBF 20040111
	numgroupfiles--;

	// move any group files following this one back
	for (i=grpnum+1; i<MAXGROUPFILES; i++)
		if (groupfil[i] != -1) {
			groupfil[i-1]    = groupfil[i];
			gnumfiles[i-1]   = gnumfiles[i];
			groupfilpos[i-1] = groupfilpos[i];
			gfilelist[i-1]   = gfilelist[i];
			gfileoffs[i-1]   = gfileoffs[i];
			groupfil[i] = -1;
		}

	// fix up the open files that need attention
	for(i=0;i<MAXOPENFILES;i++) {
		if (filegrp[i] >= 254)         // external file (255) or ZIPped file (254)
			continue;
		else if (filegrp[i] == grpnum)   // close file in group we closed
			filehan[i] = -1;
		else if (filegrp[i] > grpnum)   // move back a file in a group after the one we closed
			filegrp[i]--;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x18fc9b(%rip), %edx    # 0x1ad718
leaq 0x7f5bc(%rip), %r14     # 0x9d040
leaq (%r14,%rdx,4), %r12
xorl %ebp, %ebp
movl %edx, %ebx
testl %ebx, %ebx
jle 0x1db94
decl %ebx
movl -0x4(%r12,%rbp,4), %eax
cmpl $-0x1, %eax
sete %cl
cmpl %edi, %eax
setne %al
decq %rbp
orb %cl, %al
jne 0x1da8c
leaq 0x18fc8c(%rip), %r15    # 0x1ad740
leaq (%r15,%rdx,8), %rax
movq (%rax,%rbp,8), %rdi
movq %rdx, (%rsp)
callq 0x2149d
leaq 0x18fc94(%rip), %r13    # 0x1ad760
movq (%rsp), %rax
leaq (,%rax,8), %rax
addq %r13, %rax
movq (%rax,%rbp,8), %rdi
callq 0x2149d
movl (%r12,%rbp,4), %edi
callq 0x6220
orl $-0x1, (%r12,%rbp,4)
decl 0x18fc20(%rip)          # 0x1ad718
movl %ebx, %esi
leal 0x1(%rbx), %eax
leaq 0x18fc2c(%rip), %rcx    # 0x1ad730
leaq 0x18fc15(%rip), %rdx    # 0x1ad720
movq %rsi, %rdi
cmpl $0x3, %edi
jge 0x1db53
leaq 0x1(%rdi), %rsi
movl 0x4(%r14,%rdi,4), %r8d
cmpl $-0x1, %r8d
je 0x1db0b
movl %r8d, (%r14,%rdi,4)
movl 0x4(%rcx,%rdi,4), %r8d
movl %r8d, (%rcx,%rdi,4)
movl 0x4(%rdx,%rdi,4), %r8d
movl %r8d, (%rdx,%rdi,4)
movq 0x8(%r15,%rdi,8), %r8
movq %r8, (%r15,%rdi,8)
movq 0x8(%r13,%rdi,8), %r8
movq %r8, (%r13,%rdi,8)
orl $-0x1, 0x4(%r14,%rdi,4)
jmp 0x1db0b
leaq 0x18fc26(%rip), %rcx    # 0x1ad780
xorl %edx, %edx
leaq 0x7f4ed(%rip), %rsi     # 0x9d050
cmpq $0x100, %rdx            # imm = 0x100
je 0x1db94
movzbl (%rcx), %edi
cmpl $0xfd, %edi
ja 0x1db8b
cmpl %ebx, %edi
jne 0x1db81
orl $-0x1, (%rdx,%rsi)
jmp 0x1db8b
cmpl %edi, %eax
jg 0x1db8b
decb %dil
movb %dil, (%rcx)
addq $0x4, %rdx
incq %rcx
jmp 0x1db63
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: uninitgroupfile
void uninitgroupfile(void)
{
	int i;

	for(i=numgroupfiles-1;i>=0;i--)
		if (groupfil[i] != -1)
		{
			kfree(gfilelist[i]);
			kfree(gfileoffs[i]);
			Bclose(groupfil[i]);
			groupfil[i] = -1;
		}
	numgroupfiles = 0;

	// JBF 20040111: "close" any files open in groups
	for(i=0;i<MAXOPENFILES;i++) {
		if (filegrp[i] < 254)   // JBF 20040130: not external or ZIPped
			filehan[i] = -1;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x18fb67(%rip), %ebx    # 0x1ad718
leaq 0x7f488(%rip), %r14     # 0x9d040
leaq 0x18fb81(%rip), %r15    # 0x1ad740
leaq 0x18fb9a(%rip), %r12    # 0x1ad760
testl %ebx, %ebx
jle 0x1dbfb
cmpl $-0x1, -0x4(%r14,%rbx,4)
je 0x1dbf6
movq -0x8(%r15,%rbx,8), %rdi
callq 0x2149d
movq -0x8(%r12,%rbx,8), %rdi
callq 0x2149d
movl -0x4(%r14,%rbx,4), %edi
callq 0x6220
orl $-0x1, -0x4(%r14,%rbx,4)
decq %rbx
jmp 0x1dbc6
andl $0x0, 0x18fb16(%rip)    # 0x1ad718
leaq 0x7f447(%rip), %rax     # 0x9d050
xorl %ecx, %ecx
leaq 0x18fb6e(%rip), %rdx    # 0x1ad780
cmpq $0x40, %rcx
je 0x1dc2a
cmpb $-0x3, (%rcx,%rdx)
ja 0x1dc21
orl $-0x1, (%rax)
incq %rcx
addq $0x4, %rax
jmp 0x1dc12
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq