LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: slowhline
static void slowhline(int xr, int yp)
{
	int xl, r;

	xl = lastx[yp]; if (xl > xr) return;
	r = horizlookup2[yp-globalhoriz+horizycent];
	asm1 = globalx1*r;
	asm2 = globaly2*r;

	asm3 = (intptr_t)globalpalwritten + ((int)getpalookup((int)mulscale16(r,globvis),globalshade)<<8);
	if (!(globalorientation&256))
	{
		mhline((void *)globalbufplc,globaly1*r+globalxpanning-asm1*(xr-xl),(xr-xl)<<16,0L,
			globalx2*r+globalypanning-asm2*(xr-xl),(void *)(ylookup[yp]+xl+frameoffset));
		return;
	}
	thline((void *)globalbufplc,globaly1*r+globalxpanning-asm1*(xr-xl),(xr-xl)<<16,0L,
		globalx2*r+globalypanning-asm2*(xr-xl),(void *)(ylookup[yp]+xl+frameoffset));
}

// Assembly:
movslq %esi, %rax
leaq 0x41463a(%rip), %rcx    # 0x453d30
movslq (%rcx,%rax,4), %rcx
cmpl %ecx, %edi
jge 0x3f6ff
retq
movl %edi, %edx
movq 0x3d7580(%rip), %rsi    # 0x416c88
movl 0x23c38e(%rip), %edi    # 0x27ba9c
movl %eax, %r8d
subl %edi, %r8d
movslq 0x3d7575(%rip), %rdi    # 0x416c90
movslq %r8d, %r8
addq %rdi, %r8
movslq (%rsi,%r8,4), %r8
movl 0x3d510c(%rip), %r10d   # 0x414838
imull %r8d, %r10d
movl %r10d, 0x3d751d(%rip)   # 0x416c54
movl 0x3d5106(%rip), %r9d    # 0x414844
imull %r8d, %r9d
movslq 0x3d50e7(%rip), %rsi    # 0x414830
imulq %r8, %rsi
shrq $0x10, %rsi
sarl $0x8, %esi
addl 0x3d50d2(%rip), %esi    # 0x41482c
xorl %edi, %edi
testl %esi, %esi
cmovgl %esi, %edi
movswl 0x3d50c0(%rip), %esi    # 0x414828
decl %esi
cmpl %esi, %edi
cmovll %edi, %esi
shll $0x8, %esi
movslq %esi, %rsi
addq 0x3d088c(%rip), %rsi    # 0x410008
movl %r9d, 0x3d74d5(%rip)    # 0x416c58
movq %rsi, 0x3d74d6(%rip)    # 0x416c60
movq 0x3d508f(%rip), %rdi    # 0x414820
movl 0x3d50a4(%rip), %r11d   # 0x41483c
imull %r8d, %r11d
movl 0x41433e(%rip), %esi    # 0x453ae0
subl %ecx, %edx
imull %edx, %r10d
subl %r10d, %esi
addl %r11d, %esi
movl 0x3d508b(%rip), %r10d   # 0x414840
imull %r8d, %r10d
movl 0x414324(%rip), %r8d    # 0x453ae4
imull %edx, %r9d
shll $0x10, %edx
subl %r9d, %r8d
addl %r10d, %r8d
leaq 0x3d74cc(%rip), %r9     # 0x416ca0
movslq (%r9,%rax,4), %r9
addq %rcx, %r9
addq 0x397fae(%rip), %r9     # 0x3d7790
testb $0x1, 0x3d0818(%rip)    # 0x410001
jne 0x3f7f2
xorl %ecx, %ecx
jmp 0x6fd7c
xorl %ecx, %ecx
jmp 0x6fe20
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: ceilspritehline
static void ceilspritehline(int x2, int y)
{
	int x1, v, bx, by;

	//x = x1 + (x2-x1)t + (y1-y2)u  ~  x = 160v
	//y = y1 + (y2-y1)t + (x2-x1)u  ~  y = (scrx-160)v
	//z = z1 = z2                   ~  z = posz + (scry-horiz)v

	x1 = lastx[y]; if (x2 < x1) return;

	v = mulscale20(globalzd,horizlookup[y-globalhoriz+horizycent]);
	bx = mulscale14(globalx2*x1+globalx1,v) + globalxpanning;
	by = mulscale14(globaly2*x1+globaly1,v) + globalypanning;
	asm1 = mulscale14(globalx2,v);
	asm2 = mulscale14(globaly2,v);

	asm3 = (intptr_t)palookup[globalpal] + (getpalookup((int)mulscale28(klabs(v),globvis),globalshade)<<8);

	if ((globalorientation&2) == 0)
		mhline((void *)globalbufplc,bx,(x2-x1)<<16,0L,by,(void *)(ylookup[y]+x1+frameoffset));
	else
	{
		thline((void *)globalbufplc,bx,(x2-x1)<<16,0L,by,(void *)(ylookup[y]+x1+frameoffset));
	}
}

// Assembly:
movslq %esi, %rax
leaq 0x412fef(%rip), %rcx    # 0x453d30
movslq (%rcx,%rax,4), %rcx
cmpl %ecx, %edi
jge 0x40d4a
retq
movl %edi, %edx
movslq 0x412d99(%rip), %rsi    # 0x453aec
movq 0x3d5f26(%rip), %rdi    # 0x416c80
movl 0x23ad3b(%rip), %r8d    # 0x27ba9c
movl %eax, %r9d
subl %r8d, %r9d
movslq 0x3d5f22(%rip), %r8     # 0x416c90
movslq %r9d, %r9
addq %r8, %r9
movslq (%rdi,%r9,4), %rdi
imulq %rsi, %rdi
shrq $0x14, %rdi
movslq 0x3d3ab9(%rip), %r10    # 0x414840
movq %r10, %r8
imulq %rcx, %r8
movslq 0x3d3aa3(%rip), %rsi    # 0x414838
addq %r8, %rsi
movslq %edi, %r9
imulq %r9, %rsi
shrq $0xe, %rsi
addl 0x412d37(%rip), %esi    # 0x453ae0
movslq 0x3d3a94(%rip), %rdi    # 0x414844
movq %rdi, %r11
imulq %rcx, %r11
movslq 0x3d3a7e(%rip), %r8     # 0x41483c
addq %r11, %r8
imulq %r9, %r8
shrq $0xe, %r8
addl 0x412d14(%rip), %r8d    # 0x453ae4
imulq %r9, %r10
shrq $0xe, %r10
movl %r10d, 0x3d5e75(%rip)   # 0x416c54
imulq %r9, %rdi
shrq $0xe, %rdi
movslq 0x3cf216(%rip), %r10    # 0x410004
movl %r9d, %r11d
negl %r11d
cmovsl %r9d, %r11d
movslq 0x3d3a31(%rip), %r9     # 0x414830
imulq %r9, %r11
shrq $0x1c, %r11
sarl $0x8, %r11d
addl 0x3d3a1a(%rip), %r11d   # 0x41482c
xorl %r9d, %r9d
testl %r11d, %r11d
cmovgl %r11d, %r9d
movswl 0x3d3a04(%rip), %r11d   # 0x414828
decl %r11d
cmpl %r11d, %r9d
cmovll %r9d, %r11d
leaq 0x357cab(%rip), %r9     # 0x398ae0
shll $0x8, %r11d
movslq %r11d, %r11
addq (%r9,%r10,8), %r11
movl %edi, 0x3d5e12(%rip)    # 0x416c58
movq %r11, 0x3d5e13(%rip)    # 0x416c60
subl %ecx, %edx
shll $0x10, %edx
leaq 0x3d5e47(%rip), %rdi    # 0x416ca0
movslq (%rdi,%rax,4), %r9
addq %rcx, %r9
movq 0x3d39b9(%rip), %rdi    # 0x414820
addq 0x396922(%rip), %r9     # 0x3d7790
testb $0x2, 0x3cf18b(%rip)    # 0x410000
jne 0x40e7e
xorl %ecx, %ecx
jmp 0x6fd7c
xorl %ecx, %ecx
jmp 0x6fe20
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: screencapture_openfile
static BFILE *screencapture_openfile(const char *ext)
{
	char *seq;
	BFILE *fil;

	do {	// JBF 2004022: So we don't overwrite existing screenshots
		if (capturecount > 9999) {
			return NULL;
		}

		seq = strrchr(capturename, '.'); if (!seq) return NULL;
		seq -= 4;
		seq[0] = ((capturecount/1000)%10)+48;
		seq[1] = ((capturecount/100)%10)+48;
		seq[2] = ((capturecount/10)%10)+48;
		seq[3] = (capturecount%10)+48;
		seq[5] = ext[0];
		seq[6] = ext[1];
		seq[7] = ext[2];

		if ((fil = Bfopen(capturename, "rb")) == NULL) break;
		Bfclose(fil);
		capturecount++;
	} while (1);
	fil = Bfopen(capturename, "wb");
	if (fil) capturecount++;
	return fil;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movswl 0x575ce8(%rip), %r13d   # 0x5b6b80
cmpl $0x270f, %r13d          # imm = 0x270F
jle 0x40ea8
xorl %ebx, %ebx
jmp 0x40ffa
movq %rdi, %r14
leaq 0x63dae(%rip), %r15     # 0xa4c60
xorl %ebx, %ebx
movl $0xffff, %ebp           # imm = 0xFFFF
leaq 0x368ea(%rip), %r12     # 0x777aa
movq %r15, %rdi
movl $0x2e, %esi
callq 0x69e0
testq %rax, %rax
je 0x40ffa
movswl %r13w, %ecx
imull $0xffff8313, %ecx, %esi # imm = 0xFFFF8313
shrl $0x10, %esi
addl %r13d, %esi
movswl %si, %edx
andl %ebp, %esi
shrl $0xf, %esi
sarl $0x9, %edx
addl %esi, %edx
imull $0x67, %edx, %esi
movswl %si, %edi
andl %ebp, %esi
shrl $0xf, %esi
shrl $0xa, %edi
addb %sil, %dil
movzbl %dil, %esi
addl %esi, %esi
leal (%rsi,%rsi,4), %esi
subb %sil, %dl
addb $0x30, %dl
movb %dl, -0x4(%rax)
imull $0x147b, %ecx, %edx     # imm = 0x147B
movl %edx, %esi
shrl $0x1f, %esi
sarl $0x13, %edx
addl %esi, %edx
imull $0x6667, %edx, %esi     # imm = 0x6667
movl %esi, %edi
shrl $0x1f, %edi
shrl $0x12, %esi
addl %edi, %esi
addl %esi, %esi
leal (%rsi,%rsi,4), %esi
subl %esi, %edx
addb $0x30, %dl
movb %dl, -0x3(%rax)
imull $0x6667, %ecx, %ecx     # imm = 0x6667
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x12, %ecx
addl %edx, %ecx
imull $0x6667, %ecx, %edx     # imm = 0x6667
movl %edx, %esi
shrl $0x1f, %esi
shrl $0x12, %edx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %esi
subl %edx, %esi
addb $0x30, %sil
movb %sil, -0x2(%rax)
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %r13d
addb $0x30, %r13b
movb %r13b, -0x1(%rax)
movb (%r14), %cl
movb %cl, 0x1(%rax)
movb 0x1(%r14), %cl
movb %cl, 0x2(%rax)
movb 0x2(%r14), %cl
movb %cl, 0x3(%rax)
movq %r15, %rdi
movq %r12, %rsi
callq 0x6ce0
testq %rax, %rax
je 0x40fd4
movq %rax, %rdi
callq 0x6480
movzwl 0x575bc8(%rip), %r13d   # 0x5b6b80
incl %r13d
movw %r13w, 0x575bbd(%rip)   # 0x5b6b80
movswl %r13w, %eax
cmpl $0x270f, %eax           # imm = 0x270F
jle 0x40ec0
jmp 0x40ffa
leaq 0x63c85(%rip), %rdi     # 0xa4c60
leaq 0x367cb(%rip), %rsi     # 0x777ad
callq 0x6ce0
testq %rax, %rax
je 0x40ea1
movq %rax, %rbx
incw 0x575b86(%rip)          # 0x5b6b80
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: screencapture_writepcxline
static void screencapture_writepcxline(unsigned char *buf, int bytes, int elements, BFILE *fp, void *v)
{
	(void)v;
	if (elements == 3) {
		writepcxline(buf,   bytes, 3, fp);
		writepcxline(buf+1, bytes, 3, fp);
		writepcxline(buf+2, bytes, 3, fp);
		return;
	}
	writepcxline(buf, bytes, 1, fp);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %esi, %ebp
movq %rdi, %r14
cmpl $0x3, %edx
jne 0x41341
movq %r14, %rdi
movl %ebp, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x41354
leaq 0x1(%r14), %rdi
movl %ebp, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x41354
addq $0x2, %r14
movq %r14, %rdi
movl %ebp, %esi
movl $0x3, %edx
jmp 0x4134b
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %edx
movq %rbx, %rcx
popq %rbx
popq %r14
popq %rbp
jmp 0x41354
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: writepcxline
static void writepcxline(unsigned char *buf, int bytes, int step, BFILE *fp)
{
	unsigned char ths, last;
	int srcIndex;
	unsigned char runCount;

	runCount = 1;
	last = *buf;

	for (srcIndex=1; srcIndex<bytes; srcIndex++) {
		buf += step;
		ths = *buf;
		if (ths == last) {
			runCount++;
			if (runCount == 63) {
				writepcxbyte(last, runCount, fp);
				runCount = 0;
			}
		} else {
			if (runCount)
				writepcxbyte(last, runCount, fp);

			last = ths;
			runCount = 1;
		}
	}

	if (runCount) writepcxbyte(last, runCount, fp);
	if (bytes&1) writepcxbyte(0, 1, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %esi, %r14d
movb (%rdi), %bpl
movb $0x1, %al
cmpl $0x2, %esi
jl 0x413c9
movq %rdi, %r15
movl %edx, %r12d
movq %r14, (%rsp)
leal -0x1(%r14), %r13d
addq %r12, %r15
movl %ebp, %ecx
movb (%r15), %bpl
cmpb %cl, %bpl
jne 0x41399
incb %al
cmpb $0x3f, %al
jne 0x413b7
movb $0x3f, %dl
xorl %r14d, %r14d
movl %ecx, %ebp
jmp 0x413a4
movb $0x1, %r14b
movl %eax, %edx
testb %al, %al
movb $0x1, %al
je 0x413b9
movzbl %cl, %edi
movzbl %dl, %esi
movq %rbx, %rdx
callq 0x41405
movl %r14d, %eax
jmp 0x413b9
movl %ecx, %ebp
addq %r12, %r15
decl %r13d
jne 0x41380
testb %al, %al
movq (%rsp), %r14
je 0x413d8
movzbl %bpl, %edi
movzbl %al, %esi
movq %rbx, %rdx
callq 0x41405
testb $0x1, %r14b
jne 0x413ed
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6920
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: writepcxbyte
static int writepcxbyte(unsigned char colour, unsigned char count, BFILE *fp)
{
	if (!count) return 0;
	if (count == 1 && (colour & 0xc0) != 0xc0) {
		Bfputc(colour, fp);
		return 1;
	} else {
		Bfputc(0xc0 | count, fp);
		Bfputc(colour, fp);
		return 2;
	}
}

// Assembly:
testl %esi, %esi
je 0x41440
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movzbl %dil, %ebp
cmpl $0x1, %esi
jne 0x41420
movl %ebp, %eax
notl %eax
testb $-0x40, %al
jne 0x41430
orb $-0x40, %sil
movzbl %sil, %edi
movq %rbx, %rsi
callq 0x6920
movl %ebp, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6920
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: screencapture_writepngline
static void screencapture_writepngline(unsigned char *buf, int bytes, int elements, BFILE *fp, void *v)
{
	unsigned char header[6];
	unsigned short blklen;
	int i;
	struct pngsums *sums = (struct pngsums *)v;

	blklen = (unsigned short)B_LITTLE16(1 + bytes * elements);	// One extra for the filter type.
	header[0] = 0;	// BFINAL = 0, BTYPE = 00.
	memcpy(&header[1], &blklen, 2);
	blklen = ~blklen;
	memcpy(&header[3], &blklen, 2);

	header[5] = 0;	// No filter.
	sums->adlers2 = (sums->adlers2 + sums->adlers1) % 65521;
	crc32block(&sums->crc, header, sizeof(header));
	Bfwrite(header, sizeof(header), 1, fp);

	for (i=0; i < bytes * elements; i++) {
		sums->adlers1 = (sums->adlers1 + buf[i]) % 65521;
		sums->adlers2 = (sums->adlers2 + sums->adlers1) % 65521;
	}
	crc32block(&sums->crc, buf, bytes * elements);
	Bfwrite(buf, bytes, elements, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movq %rcx, %rbp
movl %esi, %r15d
movq %rdi, %r14
movl %edx, 0xc(%rsp)
movl %edx, %r13d
imull %esi, %r13d
leal 0x1(%r13), %eax
xorl %ecx, %ecx
leaq 0x12(%rsp), %rbx
movb %cl, (%rbx)
movw %ax, 0x1(%rbx)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
subl %r13d, %eax
movw %ax, 0x3(%rbx)
movb %cl, 0x5(%rbx)
movzwl 0x6(%r8), %eax
movzwl 0x4(%r8), %ecx
addl %eax, %ecx
imulq $0x2001f, %rcx, %rax    # imm = 0x2001F
shrq $0x21, %rax
imull $0xfff1, %eax, %eax     # imm = 0xFFF1
subl %eax, %ecx
movw %cx, 0x6(%r8)
movq %r8, %rdi
movq %rbx, %rsi
movl $0x6, %edx
callq 0x702b6
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rdi
movq %rbp, %rcx
callq 0x6b90
testl %r13d, %r13d
jle 0x41530
movzwl 0x4(%r12), %edx
movzwl 0x6(%r12), %eax
movl %r13d, %ecx
xorl %esi, %esi
movl $0x80078071, %edi       # imm = 0x80078071
movzwl %dx, %edx
movzbl (%r14,%rsi), %r8d
addl %edx, %r8d
movl %r8d, %edx
subl $0xfff1, %edx           # imm = 0xFFF1
cmovbl %r8d, %edx
movw %dx, 0x4(%r12)
movzwl %ax, %eax
addl %edx, %eax
movq %rax, %r8
imulq %rdi, %r8
shrq $0x2f, %r8
imull $0xfff1, %r8d, %r8d     # imm = 0xFFF1
subl %r8d, %eax
movw %ax, 0x6(%r12)
incq %rsi
cmpq %rsi, %rcx
jne 0x414ea
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x702b6
movslq %r15d, %rsi
movslq 0xc(%rsp), %rdx
movq %r14, %rdi
movq %rbp, %rcx
callq 0x6b90
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: kzcheckhashsiz
static int kzcheckhashsiz (int siz)
{
	int i;

	if (!kzhashbuf) //Initialize hash table on first call
	{
		memset(kzhashead,-1,sizeof(kzhashead));
		kzhashbuf = (char *)malloc(KZHASHINITSIZE); if (!kzhashbuf) return(0);
		kzhashpos = 0; kzlastfnam = -1; kzhashsiz = KZHASHINITSIZE;
	}
	if (kzhashpos+siz > kzhashsiz) //Make sure string fits in kzhashbuf
	{
		i = kzhashsiz; do { i <<= 1; } while (kzhashpos+siz > i);
		kzhashbuf = (char *)realloc(kzhashbuf,i); if (!kzhashbuf) return(0);
		kzhashsiz = i;
	}
	return(1);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x56f4a6(%rip), %rdi    # 0x5b6ba8
testq %rdi, %rdi
je 0x47715
movl 0x56f4a7(%rip), %eax    # 0x5b6bb4
movl 0x56f49d(%rip), %ebp    # 0x5b6bb0
jmp 0x47769
leaq 0x56f4a4(%rip), %rdi    # 0x5b6bc0
movl $0x400, %edx            # imm = 0x400
movl $0xff, %esi
callq 0x62f0
movl $0x2000, %edi           # imm = 0x2000
callq 0x69a0
movq %rax, 0x56f46c(%rip)    # 0x5b6ba8
testq %rax, %rax
je 0x47796
movq %rax, %rdi
movl $0x0, 0x56f466(%rip)    # 0x5b6bb4
movl $0xffffffff, 0x56f868(%rip) # imm = 0xFFFFFFFF
movl $0x2000, 0x56f44e(%rip) # imm = 0x2000
xorl %eax, %eax
movl $0x2000, %ebp           # imm = 0x2000
addl %ebx, %eax
movl $0x1, %ebx
cmpl %ebp, %eax
jle 0x47798
addl %ebp, %ebp
cmpl %ebp, %eax
jg 0x47774
movslq %ebp, %rsi
callq 0x6120
movq %rax, 0x56f41f(%rip)    # 0x5b6ba8
testq %rax, %rax
je 0x47796
movl %ebp, 0x56f41c(%rip)    # 0x5b6bb0
jmp 0x47798
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: kzcalchash
static int kzcalchash (const char *st)
{
	int i, hashind;
	char ch;

	for(i=0,hashind=0;st[i];i++)
	{
		ch = st[i];
		if ((ch >= 'a') && (ch <= 'z')) ch -= 32;
		if (ch == '/') ch = '\\';
		hashind = (ch - hashind*3);
	}
	return(hashind%(sizeof(kzhashead)/sizeof(kzhashead[0])));
}

// Assembly:
movb (%rdi), %dl
testb %dl, %dl
je 0x477e3
incq %rdi
xorl %eax, %eax
movl $0x5c, %ecx
leal -0x61(%rdx), %esi
leal -0x20(%rdx), %r8d
cmpb $0x1a, %sil
movzbl %dl, %edx
movzbl %r8b, %esi
cmovael %edx, %esi
cmpb $0x2f, %sil
cmovel %ecx, %esi
leal (%rax,%rax,2), %edx
movzbl %sil, %eax
subl %edx, %eax
movb (%rdi), %dl
incq %rdi
testb %dl, %dl
jne 0x477b1
movzbl %al, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: initpngtables
static void initpngtables(void)
{
	int i, j, k;

		//hxbit[0-58][0-1] is a combination of 4 different tables:
		//   1st parameter: [0-29] are distances, [30-58] are lengths
		//   2nd parameter: [0]: extra bits, [1]: base number

	j = 1; k = 0;
	for(i=0;i<30;i++)
	{
		hxbit[i][1] = j; j += (1<<k);
		hxbit[i][0] = k; k += ((i&1) && (i >= 2));
	}
	j = 3; k = 0;
	for(i=257;i<285;i++)
	{
		hxbit[i+30-257][1] = j; j += (1<<k);
		hxbit[i+30-257][0] = k; k += ((!(i&3)) && (i >= 264));
	}
	hxbit[285+30-257][1] = 258; hxbit[285+30-257][0] = 0;

	k = getcputype();
	if (k&(1<<15))
	{
		gotcmov = 4;
		for(i=0;i<512;i++) abstab10[512+i] = abstab10[512-i] = i;
	}
}

// Assembly:
movl $0x1, %edx
xorl %esi, %esi
leaq 0x588d8c(%rip), %rax    # 0x5d0800
xorl %ecx, %ecx
movl %edx, 0x4(%rax,%rsi,8)
movl $0x1, %edi
shll %cl, %edi
addl %edi, %edx
movl %ecx, (%rax,%rsi,8)
cmpq $0x2, %rsi
setae %dil
andb %sil, %dil
movzbl %dil, %edi
addl %edi, %ecx
incq %rsi
cmpq $0x1e, %rsi
jne 0x47a76
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x101, %esi            # imm = 0x101
movl $0x1, %edi
shll %cl, %edi
movl %edx, -0x714(%rax,%rsi,8)
addl %edi, %edx
movl %ecx, -0x718(%rax,%rsi,8)
testb $0x3, %sil
sete %dil
cmpq $0x108, %rsi            # imm = 0x108
setae %r8b
andb %dil, %r8b
movzbl %r8b, %edi
addl %edi, %ecx
incq %rsi
cmpq $0x11d, %rsi            # imm = 0x11D
jne 0x47aac
movabsq $0x10200000000, %rax    # imm = 0x10200000000
movq %rax, 0x588ed4(%rip)    # 0x5d09d0
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: hufgencode
static void hufgencode (int *inbuf, int inum, int *hitab, int *hbmax)
{
	int i, tbuf[31];

	for(i=30;i;i--) tbuf[i] = 0;
	for(i=inum-1;i>=0;i--) tbuf[inbuf[i]]++;
	tbuf[0] = hbmax[0] = 0; //Hack to remove symbols of length 0?
	for(i=0;i<31;i++) hbmax[i+1] = hbmax[i]+tbuf[i];
	for(i=0;i<inum;i++) if (inbuf[i]) hitab[hbmax[inbuf[i]]++] = i;
}

// Assembly:
pushq %rax
xorps %xmm0, %xmm0
movups %xmm0, -0x1c(%rsp)
movups %xmm0, -0x2c(%rsp)
movups %xmm0, -0x3c(%rsp)
movups %xmm0, -0x4c(%rsp)
movups %xmm0, -0x5c(%rsp)
movups %xmm0, -0x6c(%rsp)
movups %xmm0, -0x7c(%rsp)
movq $0x0, -0xc(%rsp)
movl %esi, %eax
testl %esi, %esi
jle 0x49be6
leaq 0x1(%rax), %r8
movslq -0x8(%rdi,%r8,4), %r9
incl -0x80(%rsp,%r9,4)
decq %r8
cmpq $0x1, %r8
ja 0x49bd3
xorl %r8d, %r8d
movl %r8d, (%rcx)
movl %r8d, -0x80(%rsp)
xorl %r9d, %r9d
addl -0x80(%rsp,%r9,4), %r8d
movl %r8d, 0x4(%rcx,%r9,4)
incq %r9
cmpq $0x1f, %r9
jne 0x49bf4
testl %esi, %esi
jle 0x49c2e
xorl %esi, %esi
movslq (%rdi,%rsi,4), %r8
testq %r8, %r8
je 0x49c26
movslq (%rcx,%r8,4), %r9
leal 0x1(%r9), %r10d
movl %r10d, (%rcx,%r8,4)
movl %esi, (%rdx,%r9,4)
incq %rsi
cmpq %rsi, %rax
jne 0x49c0d
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: hufgetsym
static int hufgetsym (int *hitab, int *hbmax)
{
	int v, n;

	v = n = 0;
	do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } while (v >= 0);
	return(hitab[hbmax[n]+v]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, (%rsp)
movq 0x57d51f(%rip), %rax    # 0x5c7168
movl 0x57d510(%rip), %r13d   # 0x5c7160
addq $0x4, %r14
xorl %ebx, %ebx
movl $0xfffc, %ebp           # imm = 0xFFFC
movl $0xfff80020, %r12d      # imm = 0xFFF80020
movl %r13d, %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx), %r15d
leal 0x1(%r13), %ecx
movl %ecx, 0x57d4e8(%rip)    # 0x5c7160
cmpl $-0x1, %r13d
jl 0x49d5d
cmpb $0x0, 0x56d4b7(%rip)    # 0x5b7140
je 0x49cdb
movl 0x57d4cb(%rip), %eax    # 0x5c715c
movl %eax, 0x56d4c9(%rip)    # 0x5b7160
movl 0x56d343(%rip), %eax    # 0x5b6fe0
subl 0x56d345(%rip), %eax    # 0x5b6fe8
cmpl %ebp, %eax
cmovgel %ebp, %eax
movslq %eax, %rdx
movq 0x56d316(%rip), %rcx    # 0x5b6fc8
movl $0x1, %esi
leaq 0x56d4a6(%rip), %rdi    # 0x5b7164
callq 0x6550
addl %eax, 0x56d31f(%rip)    # 0x5b6fe8
movl 0x57d491(%rip), %ecx    # 0x5c7160
addl %r12d, %ecx
movq 0x57d48f(%rip), %rdx    # 0x5c7168
jmp 0x49d54
movq 0x58711e(%rip), %rdx    # 0x5d0e00
testq %rdx, %rdx
je 0x49d0c
movq %rdx, 0x57d47a(%rip)    # 0x5c7168
movq $0x0, 0x587107(%rip) # 0x5d0e00
movl 0x5aa5b1(%rip), %eax    # 0x5f42b0
shll $0x3, %eax
movl %r13d, %ecx
subl %eax, %ecx
addl $0x21, %ecx
jmp 0x49d54
movl 0x8(%rax), %ecx
bswapl %ecx
movl %ecx, 0x5aa599(%rip)    # 0x5f42b0
movslq %ecx, %rcx
addq %rax, %rcx
addq $0xc, %rcx
movq %rcx, 0x5870d8(%rip)    # 0x5d0e00
movl (%rax), %ecx
movl %ecx, 0x5aa584(%rip)    # 0x5f42b4
cmpl $0x54414449, 0xc(%rax)  # imm = 0x54414449
jne 0x49d42
movl 0x10(%rax), %eax
movl %eax, 0x5aa576(%rip)    # 0x5f42b8
leaq 0x5aa56f(%rip), %rdx    # 0x5f42b8
movq %rdx, 0x57d418(%rip)    # 0x5c7168
leal -0x1f(%r13), %ecx
movl %ecx, 0x57d406(%rip)    # 0x5c7160
movq %rdx, %rax
addl %ebx, %ebx
andl $0x7, %r13d
xorl %edx, %edx
btl %r13d, %r15d
setb %dl
orl %ebx, %edx
movslq -0x4(%r14), %rsi
movslq %edx, %rdx
addq %rsi, %rdx
movl (%r14), %esi
addq $0x4, %r14
movl %edx, %ebx
subl %esi, %ebx
movl %ecx, %r13d
jns 0x49c61
movq (%rsp), %rax
movl (%rax,%rdx,4), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: qhufgencode
static void qhufgencode (int *hitab, int *hbmax, int *qhval, unsigned char *qhbit, int numbits)
{
	int i, j, k, n, r;

		//r is the bit reverse of i. Ex: if: i = 1011100111, r = 1110011101
	i = r = 0;
	for(n=1;n<=numbits;n++)
		for(k=hbmax[n-1];k<hbmax[n];k++)
			for(j=i+pow2mask[numbits-n];i<=j;i++)
			{
				r = bitrev(i,numbits);
				qhval[r] = hitab[k];
				qhbit[r] = (unsigned char)n;
			}
	for(j=pow2mask[numbits];i<=j;i++)
	{
		r = bitrev(i,numbits);

		//k = 0;
		//for(n=0;n<numbits;n++)
		//   k = (k<<1) + ((r>>n)&1) + hbmax[n]-hbmax[n+1];
		//
		//n = numbits;
		//k = hbmax[n]-r;
		//
		//j = peekbits(LOGQHUFSIZ); i = qhufval[j]; j = qhufbit[j];
		//
		//i = j = 0;
		//do
		//{
		//   i = (i<<1)+getbits(1)+nbuf0[j]-nbuf0[j+1]; j++;
		//} while (i >= 0);
		//i = ibuf0[nbuf0[j]+i];
		//qhval[r] = k;

		qhbit[r] = 0; //n-32;
	}

	//   //hufgetsym_skipb related code:
	//for(k=n=0;n<numbits;n++) k = (k<<1)+hbmax[n]-hbmax[n+1];
	//return(k);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rax
movl %r8d, %ecx
movq %rcx, -0x10(%rsp)
testl %r8d, %r8d
movq %r8, -0x8(%rsp)
jle 0x49e5d
movl $0x1, %r11d
movl %r8d, %ecx
shll %cl, %r11d
leal 0x1(%r8), %ecx
xorl %r9d, %r9d
movl $0x1, %ebx
movslq -0x4(%rsi,%rbx,4), %r15
cmpl (%rsi,%rbx,4), %r15d
jge 0x49e53
movq -0x10(%rsp), %r10
subq %rbx, %r10
leaq 0x2dcc9(%rip), %r8      # 0x77ac0
movl (%r8,%r10,4), %r12d
movl %r9d, %r13d
leal (%r12,%r13), %ebp
cmpl %ebp, %r9d
cmovgl %r9d, %ebp
leal 0x1(%rbp), %r9d
movl $0x1, %r10d
xorl %r14d, %r14d
xorl %r8d, %r8d
testl %r13d, %r10d
setne %r8b
leal (%r8,%r14,2), %r14d
addl %r10d, %r10d
cmpl %r11d, %r10d
jl 0x49e16
movl (%rdi,%r15,4), %r8d
movslq %r14d, %r10
movl %r8d, (%rdx,%r10,4)
movb %bl, (%rax,%r10)
leal 0x1(%r13), %r8d
cmpl %ebp, %r13d
movl %r8d, %r13d
jne 0x49e0d
movslq (%rsi,%rbx,4), %r8
incq %r15
cmpq %r8, %r15
jl 0x49dfb
incq %rbx
cmpq %rcx, %rbx
jne 0x49ddd
jmp 0x49e60
xorl %r9d, %r9d
leaq 0x2dc59(%rip), %rcx     # 0x77ac0
movq -0x10(%rsp), %rdx
movl (%rcx,%rdx,4), %edx
cmpl %edx, %r9d
movq -0x8(%rsp), %rcx
jg 0x49eb7
movl $0x1, %esi
shll %cl, %esi
testl %ecx, %ecx
je 0x49ea5
movl $0x1, %edi
xorl %r10d, %r10d
xorl %r8d, %r8d
testl %r9d, %edi
setne %r8b
leal (%r8,%r10,2), %r10d
addl %edi, %edi
cmpl %esi, %edi
jl 0x49e8c
movslq %r10d, %rdi
jmp 0x49ea7
xorl %edi, %edi
movb $0x0, (%rax,%rdi)
leal 0x1(%r9), %edi
cmpl %edx, %r9d
movl %edi, %r9d
jne 0x49e80
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: kzseek
int kzseek (int offset, int whence)
{
	if (!kzfs.fil) return(-1);
	switch (whence)
	{
		case SEEK_CUR: kzfs.pos += offset; break;
		case SEEK_END: kzfs.pos = kzfs.leng+offset; break;
		case SEEK_SET: default: kzfs.pos = offset;
	}
	if (kzfs.pos < 0) kzfs.pos = 0;
	if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng;
	return(kzfs.pos);
}

// Assembly:
cmpq $0x0, 0x56d0eb(%rip)    # 0x5b6fc8
je 0x49ef1
cmpl $0x2, %esi
je 0x49ef7
cmpl $0x1, %esi
jne 0x49efd
addl 0x56d109(%rip), %edi    # 0x5b6ff8
jmp 0x49efd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
addl 0x56d0f3(%rip), %edi    # 0x5b6ff0
xorl %eax, %eax
testl %edi, %edi
cmovgl %edi, %eax
movl 0x56d0e6(%rip), %ecx    # 0x5b6ff0
cmpl %ecx, %eax
movl %eax, %edx
cmovgl %ecx, %edx
movl %edx, 0x56d0e1(%rip)    # 0x5b6ff8
cmovgel %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: kpzload
void kpzload (const char *filnam, intptr_t *pic, int *bpl, int *xsiz, int *ysiz)
{
	char *buf;
	int leng;

	(*pic) = 0;
	if (!kzopen(filnam)) return;
	leng = kzfilelength();
	buf = (char *)malloc(leng); if (!buf) return;
	kzread(buf,leng);
	kzclose();

	kpgetdim(buf,leng,xsiz,ysiz);
	(*bpl) = ((*xsiz)<<2);
	(*pic) = (intptr_t)malloc((*ysiz)*(*bpl)); if (!(*pic)) { free(buf); return; }
	if (kprender(buf,leng,*pic,*bpl,*xsiz,*ysiz,0,0) < 0) { free(buf); free((void *)*pic); (*pic) = 0; return; }
	free(buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq $0x0, (%rsi)
callq 0x477e6
testl %eax, %eax
je 0x4a082
xorl %ebp, %ebp
cmpq $0x1, 0x56cff8(%rip)    # 0x5b6fc8
sbbl %ebp, %ebp
orl 0x56d018(%rip), %ebp    # 0x5b6ff0
movslq %ebp, %rdi
callq 0x69a0
testq %rax, %rax
je 0x4a082
movq %rax, %r13
movq %rax, %rdi
movl %ebp, %esi
callq 0x47ea9
movq 0x56cfcb(%rip), %rdi    # 0x5b6fc8
testq %rdi, %rdi
je 0x4a012
callq 0x6480
movq $0x0, 0x56cfb6(%rip) # 0x5b6fc8
movq %r13, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x41560
movl (%r15), %eax
shll $0x2, %eax
movl %eax, (%r12)
movslq (%r14), %rcx
movslq %eax, %rdi
imulq %rcx, %rdi
callq 0x69a0
movq %rax, (%rbx)
testq %rax, %rax
je 0x4a091
movl (%r12), %ecx
movl (%r15), %r8d
movl (%r14), %r9d
xorl %r10d, %r10d
movq %r13, %rdi
movl %ebp, %esi
movq %rax, %rdx
pushq %r10
pushq %r10
callq 0x417cd
addq $0x10, %rsp
movl %eax, %ebp
movq %r13, %rdi
callq 0x61c0
testl %ebp, %ebp
jns 0x4a082
movq (%rbx), %rdi
callq 0x61c0
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x61c0
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: huffgetval
static void huffgetval (int index, int curbits, int num, int *daval, int *dabits)
{
	int b, v, pow2, *hmax;

	hmax = &hufmaxatbit[index][0];
	pow2 = pow2long[curbits-1];
	if (num&pow2) v = 1; else v = 0;
	for(b=1;b<=16;b++)
	{
		if (v < hmax[b])
		{
			*dabits = b;
			*daval = huftable[index][hufvalatbit[index][b]+v];
			return;
		}
		pow2 >>= 1; v <<= 1;
		if (num&pow2) v++;
	}
	*dabits = 16; *daval = 0;
}

// Assembly:
pushq %rbx
movslq %edi, %rax
leaq (%rax,%rax,4), %rdi
shlq $0x4, %rdi
leaq 0x58660b(%rip), %r9     # 0x5d0fc0
addq %rdi, %r9
decl %esi
leaq 0x2d07f(%rip), %r10     # 0x77a40
movl (%r10,%rsi,4), %r11d
xorl %esi, %esi
testl %edx, %r11d
setne %sil
movl $0x1, %r10d
cmpl (%r9,%r10,4), %esi
jl 0x4a9fc
sarl %r11d
xorl %ebx, %ebx
testl %edx, %r11d
setne %bl
leal (%rbx,%rsi,2), %esi
incq %r10
cmpq $0x11, %r10
jne 0x4a9d4
movl $0x10, (%r8)
xorl %eax, %eax
jmp 0x4aa25
movl %r10d, (%r8)
leaq 0x58683a(%rip), %rdx    # 0x5d1240
addq %rdi, %rdx
movslq (%rdx,%r10,4), %rdx
movslq %esi, %rsi
addq %rdx, %rsi
shlq $0x8, %rax
leaq 0x586aa2(%rip), %rdx    # 0x5d14c0
addq %rax, %rdx
movzbl (%rdx,%rsi), %eax
movl %eax, (%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Cleanup
void OSD_Cleanup(void)
{
	symbol_t *s;

	for (; symbols; symbols=s) {
		s=symbols->next;
		Bfree(symbols);
	}

	osdinited=0;
}

// Assembly:
movq 0x5a8ecd(%rip), %rdi    # 0x5f42c0
testq %rdi, %rdi
je 0x4b412
pushq %rbx
movq 0x8(%rdi), %rbx
callq 0x61c0
movq %rbx, 0x5a8eb7(%rip)    # 0x5f42c0
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x4b3f9
popq %rbx
movb $0x0, 0x5a8eaf(%rip)    # 0x5f42c8
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Init
void OSD_Init(void)
{
    if (osdinited) return;
	osdinited=1;

	Bmemset(osdtext, 0, TEXTSIZE);
	osdlines=1;

	atexit(OSD_Cleanup);

	OSD_RegisterFunction("listsymbols","listsymbols: lists all the recognized symbols",osdcmd_listsymbols);
	OSD_RegisterFunction("help","help: displays help on the named symbol",osdcmd_help);
	OSD_RegisterFunction("osdrows","osdrows: sets the number of visible lines of the OSD",osdcmd_osdvars);
	OSD_RegisterFunction("clear","clear: clear the OSD",osdcmd_clear);
	OSD_RegisterFunction("echo","echo: write text to the OSD",osdcmd_echo);
}

// Assembly:
cmpb $0x0, 0x5a8ea7(%rip)    # 0x5f42c8
je 0x4b424
retq
pushq %rax
movb $0x1, 0x5a8e9c(%rip)    # 0x5f42c8
leaq 0x5a8e9d(%rip), %rdi    # 0x5f42d0
movl $0x4000, %edx           # imm = 0x4000
xorl %esi, %esi
callq 0x62f0
movl $0x1, 0x59837(%rip)     # 0xa4c80
leaq -0x64(%rip), %rdi       # 0x4b3ec
callq 0x72d50
leaq 0x2c7e4(%rip), %rdi     # 0x77c40
leaq 0x2c7e9(%rip), %rsi     # 0x77c4c
leaq 0x190(%rip), %rdx       # 0x4b5fa
callq 0x4b4d8
leaq 0x28f66(%rip), %rdi     # 0x743dc
leaq 0x2c7fd(%rip), %rsi     # 0x77c7a
leaq 0x1bb(%rip), %rdx       # 0x4b63f
callq 0x4b4d8
leaq 0x2c812(%rip), %rdi     # 0x77ca2
leaq 0x2c813(%rip), %rsi     # 0x77caa
leaq 0x1ef(%rip), %rdx       # 0x4b68d
callq 0x4b4d8
leaq 0x2c835(%rip), %rdi     # 0x77cdf
leaq 0x2c834(%rip), %rsi     # 0x77ce5
leaq 0x255(%rip), %rdx       # 0x4b70d
callq 0x4b4d8
leaq 0x2b82c(%rip), %rdi     # 0x76cf0
leaq 0x2c82f(%rip), %rsi     # 0x77cfa
leaq 0x275(%rip), %rdx       # 0x4b747
popq %rax
jmp 0x4b4d8
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: osdcmd_listsymbols
static int osdcmd_listsymbols(const osdfuncparm_t *parm)
{
	symbol_t *i;

	(void)parm;

	OSD_Printf("Symbol listing:\n");
	for (i=symbols; i!=NULL; i=i->next)
		OSD_Printf("     %s\n", i->name);

	return OSDCMD_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x2c940(%rip), %rdi     # 0x77f45
xorl %eax, %eax
callq 0x4cb1d
movq 0x5a8cad(%rip), %r14    # 0x5f42c0
testq %r14, %r14
je 0x4b635
leaq 0x2eae8(%rip), %rbx     # 0x7a107
movq (%r14), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4cb1d
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x4b61f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: osdcmd_help
static int osdcmd_help(const osdfuncparm_t *parm)
{
	symbol_t *symb;

	if (parm->numparms != 1) return OSDCMD_SHOWHELP;
	symb = findexactsymbol(parm->parms[0]);
	if (!symb) {
		OSD_Printf("Help Error: \"%s\" is not a defined variable or function\n", parm->parms[0]);
	} else {
		OSD_Printf("%s\n", symb->help);
	}

	return OSDCMD_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, %ebx
cmpl $0x1, (%rdi)
jne 0x4b683
movq 0x10(%rdi), %rax
movq (%rax), %r14
movq %r14, %rdi
callq 0x4cf63
testq %rax, %rax
je 0x4b670
movq 0x10(%rax), %rsi
leaq 0x2eaa0(%rip), %rdi     # 0x7a10c
xorl %ebx, %ebx
jmp 0x4b67c
leaq 0x2c8df(%rip), %rdi     # 0x77f56
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x4cb1d
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: osdcmd_osdvars
static int osdcmd_osdvars(const osdfuncparm_t *parm)
{
	int showval = (parm->numparms < 1);

	if (!Bstrcasecmp(parm->name, "osdrows")) {
		if (showval) { OSD_Printf("osdrows is %d\n", osdrows); return OSDCMD_OK; }
		else {
			osdrows = atoi(parm->parms[0]);
			if (osdrows < 1) osdrows = 1;
			else if (osdrows > osdmaxrows) osdrows = osdmaxrows;
			return OSDCMD_OK;
		}
	}
	return OSDCMD_SHOWHELP;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x8(%rdi), %rdi
leaq 0x2c603(%rip), %rsi     # 0x77ca2
callq 0x6880
movl $0x1, %ebx
testl %eax, %eax
je 0x4b6b7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x0, (%r14)
jle 0x4b6e7
movq 0x10(%r14), %rax
movq (%rax), %rdi
callq 0x6310
movl %eax, 0x59615(%rip)     # 0xa4ce4
testl %eax, %eax
jle 0x4b6ff
movl 0x59607(%rip), %ecx     # 0xa4ce0
xorl %ebx, %ebx
cmpl %ecx, %eax
jle 0x4b6ad
movl %ecx, 0x595ff(%rip)     # 0xa4ce4
jmp 0x4b6ad
movl 0x595f7(%rip), %esi     # 0xa4ce4
leaq 0x2c89a(%rip), %rdi     # 0x77f8e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4cb1d
jmp 0x4b6ad
movl $0x1, 0x595db(%rip)     # 0xa4ce4
xorl %ebx, %ebx
jmp 0x4b6ad
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: osdcmd_clear
static int osdcmd_clear(const osdfuncparm_t *parm)
{
	if (parm->numparms != 0) return OSDCMD_SHOWHELP;
	Bmemset(osdtext, 0, TEXTSIZE);
	osdlines=1;
	osdhead=0;
	osdpos=0;

	return OSDCMD_OK;
}

// Assembly:
pushq %rbx
movl $0x1, %ebx
cmpl $0x0, (%rdi)
jne 0x4b743
leaq 0x5a8bb1(%rip), %rdi    # 0x5f42d0
xorl %ebx, %ebx
movl $0x4000, %edx           # imm = 0x4000
xorl %esi, %esi
callq 0x62f0
movl $0x1, 0x59549(%rip)     # 0xa4c80
movl %ebx, 0x5acbc7(%rip)    # 0x5f8304
movl %ebx, 0x5acbbd(%rip)    # 0x5f8300
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: osdcmd_echo
static int osdcmd_echo(const osdfuncparm_t *parm)
{
	int i;

	if (parm->numparms == 0) return OSDCMD_SHOWHELP;
	for (i = 0; i < parm->numparms; i++) {
		if (i) OSD_Puts(" ");
		OSD_Puts(parm->parms[i]);
	}
	OSD_Puts("\n");

	return OSDCMD_OK;
}

// Assembly:
cmpl $0x0, (%rdi)
je 0x4b799
pushq %r15
pushq %r14
pushq %rbx
jle 0x4b785
movq %rdi, %rbx
xorl %r15d, %r15d
leaq 0x27eec(%rip), %r14     # 0x7364c
testq %r15, %r15
je 0x4b76d
movq %r14, %rdi
callq 0x4cbd3
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x4cbd3
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x4b760
leaq 0x2ba80(%rip), %rdi     # 0x7720c
callq 0x4cbd3
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_SetFunctions
void OSD_SetFunctions(
		void (*drawchar)(int,int,char,int,int),
		void (*drawstr)(int,int,char*,int,int,int),
		void (*drawcursor)(int,int,int,int),
		int (*colwidth)(int),
		int (*rowheight)(int),
		void (*clearbg)(int,int),
		int (*gtime)(void),
		void (*showosd)(int)
	)
{
	drawosdchar = drawchar;
	drawosdstr = drawstr;
	drawosdcursor = drawcursor;
	getcolumnwidth = colwidth;
	getrowheight = rowheight;
	clearbackground = clearbg;
	gettime = gtime;
	onshowosd = showosd;

	if (!drawosdchar) drawosdchar = _internal_drawosdchar;
	if (!drawosdstr) drawosdstr = _internal_drawosdstr;
	if (!drawosdcursor) drawosdcursor = _internal_drawosdcursor;
	if (!getcolumnwidth) getcolumnwidth = _internal_getcolumnwidth;
	if (!getrowheight) getrowheight = _internal_getrowheight;
	if (!clearbackground) clearbackground = _internal_clearbackground;
	if (!gettime) gettime = _internal_gettime;
	if (!onshowosd) onshowosd = _internal_onshowosd;
}

// Assembly:
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %r10
movq %rdi, 0x594d8(%rip)     # 0xa4c88
movq %rsi, 0x594d9(%rip)     # 0xa4c90
movq %rdx, 0x594da(%rip)     # 0xa4c98
movq %rcx, 0x594db(%rip)     # 0xa4ca0
movq %r8, 0x594dc(%rip)      # 0xa4ca8
movq %r9, 0x594dd(%rip)      # 0xa4cb0
movq %r10, 0x594de(%rip)     # 0xa4cb8
movq %rax, 0x594df(%rip)     # 0xa4cc0
testq %rdi, %rdi
jne 0x4b7f4
leaq 0x8e(%rip), %rdi        # 0x4b87b
movq %rdi, 0x59494(%rip)     # 0xa4c88
testq %rsi, %rsi
jne 0x4b807
leaq 0x128(%rip), %rsi       # 0x4b928
movq %rsi, 0x59489(%rip)     # 0xa4c90
testq %rdx, %rdx
jne 0x4b81a
leaq 0x1fd(%rip), %rdx       # 0x4ba10
movq %rdx, 0x5947e(%rip)     # 0xa4c98
testq %rcx, %rcx
jne 0x4b82d
leaq 0x28a(%rip), %rcx       # 0x4bab0
movq %rcx, 0x59473(%rip)     # 0xa4ca0
testq %r8, %r8
jne 0x4b840
leaq 0x285(%rip), %rcx       # 0x4babe
movq %rcx, 0x59468(%rip)     # 0xa4ca8
testq %r9, %r9
jne 0x4b853
leaq 0x28d(%rip), %rcx       # 0x4bad9
movq %rcx, 0x5945d(%rip)     # 0xa4cb0
testq %r10, %r10
jne 0x4b866
leaq 0x27b(%rip), %rcx       # 0x4bada
movq %rcx, 0x59452(%rip)     # 0xa4cb8
testq %rax, %rax
je 0x4b86c
retq
leaq 0x26c(%rip), %rax       # 0x4badf
movq %rax, 0x59446(%rip)     # 0xa4cc0
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: internal_drawosdchar
static void _internal_drawosdchar(int x, int y, char ch, int shade, int pal)
{
	char st[2] = { 0,0 };
	int colour, shadow;

	(void)shade;

	st[0] = ch;

	if (qsetmode == 200) {
		colour = palmap256[pal%4];
		shadow = palmap256[0];
	} else {
		colour = palmap16[pal%4];
		shadow = palmap16[0];
		// printext256 happens to work in 2D mode.
	}
	printext256(4+(x*8)+1,4+(y*14)+1, shadow, -1, st, 2);
	printext256(4+(x*8),4+(y*14), colour, -1, st, 2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %eax, %eax
movw %ax, 0x6(%rsp)
movb %dl, 0x6(%rsp)
leaq 0x16d194(%rip), %rcx    # 0x1b8a28
leal 0x3(%r8), %edx
testl %r8d, %r8d
cmovnsl %r8d, %edx
andl $-0x4, %edx
subl %edx, %r8d
cmpl $0xc8, (%rcx)
movslq %r8d, %rcx
jne 0x4b8c0
leaq 0x59439(%rip), %rdx     # 0xa4cf0
movzwl 0x59432(%rip), %eax     # 0xa4cf0
jmp 0x4b8c7
leaq 0x2c729(%rip), %rdx     # 0x77ff0
movswl (%rdx,%rcx,4), %ebx
leal 0x4(,%rdi,8), %ebp
leal 0x5(,%rdi,8), %edi
leal (%rsi,%rsi), %ecx
shll $0x4, %esi
subl %ecx, %esi
leal 0x4(%rsi), %r14d
addl $0x5, %esi
movswl %ax, %edx
leaq 0x6(%rsp), %r15
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r15, %r8
movl $0x2, %r9d
callq 0x3d8b3
movl %ebp, %edi
movl %r14d, %esi
movl %ebx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r15, %r8
movl $0x2, %r9d
callq 0x3d8b3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: internal_drawosdstr
static void _internal_drawosdstr(int x, int y, char *ch, int len, int shade, int pal)
{
	char st[1024];
	int colour, shadow;

	(void)shade;

	if (len>1023) len=1023;
	memcpy(st,ch,len);
	st[len]=0;

	if (qsetmode == 200) {
		colour = palmap256[pal%4];
		shadow = palmap256[0];
	} else {
		colour = palmap16[pal%4];
		shadow = palmap16[0];
		// printext256 happens to work in 2D mode.
	}
	printext256(4+(x*8)+1,4+(y*14)+1, shadow, -1, st, 2);
	printext256(4+(x*8),4+(y*14), colour, -1, st, 2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movl %r9d, %r12d
movl %esi, %r14d
movl %edi, %r15d
movl $0x3ff, %eax            # imm = 0x3FF
cmpl %eax, %ecx
cmovll %ecx, %eax
movslq %eax, %r13
movq %rsp, %rbx
movq %rbx, %rdi
movq %rdx, %rsi
movq %r13, %rdx
callq 0x60c0
movb $0x0, (%rsp,%r13)
leaq 0x16d0bc(%rip), %rax    # 0x1b8a28
leal 0x3(%r12), %ecx
testl %r12d, %r12d
cmovnsl %r12d, %ecx
andl $-0x4, %ecx
subl %ecx, %r12d
xorl %ecx, %ecx
cmpl $0xc8, (%rax)
movslq %r12d, %rax
leaq 0x59360(%rip), %rdx     # 0xa4cf0
leaq 0x2c659(%rip), %rsi     # 0x77ff0
cmoveq %rdx, %rsi
cmovew 0x5934d(%rip), %cx      # 0xa4cf0
movswl (%rsi,%rax,4), %ebp
leal 0x4(,%r15,8), %r12d
leal 0x5(,%r15,8), %edi
leal (%r14,%r14), %eax
shll $0x4, %r14d
subl %eax, %r14d
leal 0x4(%r14), %r15d
addl $0x5, %r14d
movswl %cx, %edx
movl %r14d, %esi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rbx, %r8
movl $0x2, %r9d
callq 0x3d8b3
movl %r12d, %edi
movl %r15d, %esi
movl %ebp, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rbx, %r8
movl $0x2, %r9d
callq 0x3d8b3
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: internal_drawosdcursor
static void _internal_drawosdcursor(int x, int y, int type, int lastkeypress)
{
	char st[2] = { '\x16', 0 };  // solid lower third of character cell
	int colour, yoff = 2;

	unsigned blinkcycle = gettime() - (unsigned)lastkeypress;
	if (blinkcycle % 1000 > 500) return;  // blink each half-second.

	if (type) {
		st[0] = '\xdb';  // solid block
		yoff = 0;
	}

	if (qsetmode == 200) {
		colour = palmap256[2];
	} else {
		colour = palmap16[2];
		// printext256 happens to work in 2D mode.
	}
	printext256(4+(x*8),4+(y*14)+yoff, colour, -1, st, 2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %ebx
movl %edi, %r14d
movw $0x16, 0x6(%rsp)
callq *0x5928a(%rip)          # 0xa4cb8
subl %r15d, %eax
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
shrq $0x26, %rcx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
cmpl $0x1f4, %eax            # imm = 0x1F4
ja 0x4baa5
testl %ebp, %ebp
je 0x4ba58
movb $-0x25, 0x6(%rsp)
xorl %eax, %eax
jmp 0x4ba5d
movl $0x2, %eax
leaq 0x16cfc4(%rip), %rcx    # 0x1b8a28
cmpl $0xc8, (%rcx)
movw $0x7, %cx
jne 0x4ba77
movzwl 0x59281(%rip), %ecx     # 0xa4cf8
leal 0x4(,%r14,8), %edi
leal (%rbx,%rbx), %edx
shll $0x4, %ebx
subl %edx, %ebx
leal (%rbx,%rax), %esi
addl $0x4, %esi
movswl %cx, %edx
leaq 0x6(%rsp), %r8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x2, %r9d
callq 0x3d8b3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_ShowDisplay
void OSD_ShowDisplay(int onf)
{
	if (onf < 0) {
		onf = !osdvisible;
	}
	osdvisible = (onf != 0);
	osdeditcontrol = 0;
	osdeditshift = 0;

	grabmouse(osdvisible == 0);
	onshowosd(osdvisible);
	releaseallbuttons();
	bflushchars();

	if (osdvisible) {
		findwhite();
	}
}

// Assembly:
pushq %rax
xorl %eax, %eax
cmpb $0x0, 0x5abb33(%rip)    # 0x5f82dc
sete %al
xorl %ecx, %ecx
testl %edi, %edi
setne %cl
cmovsl %eax, %ecx
movb %cl, 0x5abb20(%rip)     # 0x5f82dc
movb $0x0, 0x5abb1d(%rip)    # 0x5f82e0
xorb $0x1, %cl
movzbl %cl, %edi
callq 0x6e2a9
movzbl 0x5abb07(%rip), %edi    # 0x5f82dc
callq *0x584e5(%rip)          # 0xa4cc0
callq 0x6e36f
callq 0x1f0c4
cmpb $0x0, 0x5abaf0(%rip)    # 0x5f82dc
je 0x4c7f4
popq %rax
jmp 0x4c91d
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_ResizeDisplay
void OSD_ResizeDisplay(int w, int h)
{
	int newcols;
	int newmaxlines;
	char newtext[TEXTSIZE];
	int i,j,k;

	newcols = getcolumnwidth(w);
	newmaxlines = TEXTSIZE / newcols;

	j = min(newmaxlines, osdmaxlines);
	k = min(newcols, osdcols);

	memset(newtext, 0, TEXTSIZE);
	for (i=0;i<j;i++) {
		memcpy(newtext+newcols*i, osdtext+osdcols*i, k);
	}

	memcpy(osdtext, newtext, TEXTSIZE);
	osdcols = newcols;
	osdmaxlines = newmaxlines;
	osdmaxrows = getrowheight(h)-2;

	if (osdrows > osdmaxrows) osdrows = osdmaxrows;

	osdpos = 0;
	osdhead = 0;
	osdeditwinstart = 0;
	osdeditwinend = editlinewidth;

	if (osdvisible) {
		findwhite();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4018, %rsp           # imm = 0x4018
movl %esi, 0xc(%rsp)
callq *0x5848f(%rip)          # 0xa4ca0
movl %eax, %ecx
movl $0x4000, %eax           # imm = 0x4000
xorl %edx, %edx
movl %ecx, 0x4(%rsp)
idivl %ecx
movl 0x584b2(%rip), %ebp     # 0xa4cd8
cmpl %ebp, %eax
movl %eax, 0x8(%rsp)
cmovll %eax, %ebp
movslq 0x584a6(%rip), %rbx     # 0xa4cdc
leaq 0x10(%rsp), %r15
movl $0x4000, %edx           # imm = 0x4000
movq %r15, %rdi
xorl %esi, %esi
callq 0x62f0
testl %ebp, %ebp
jle 0x4c881
movl 0x4(%rsp), %ecx
cmpl %ebx, %ecx
movl %ebx, %eax
cmovll %ecx, %eax
movslq %eax, %r12
movslq %ecx, %r14
movl %ebp, %ebp
leaq 0x5a7a68(%rip), %r13    # 0x5f42d0
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x60c0
addq %rbx, %r13
addq %r14, %r15
decq %rbp
jne 0x4c868
leaq 0x5a7a48(%rip), %rdi    # 0x5f42d0
leaq 0x10(%rsp), %rsi
movl $0x4000, %edx           # imm = 0x4000
callq 0x60c0
movl 0x4(%rsp), %eax
movl %eax, 0x5843b(%rip)     # 0xa4cdc
movl 0x8(%rsp), %eax
movl %eax, 0x5842d(%rip)     # 0xa4cd8
movl 0xc(%rsp), %edi
callq *0x583f3(%rip)          # 0xa4ca8
addl $-0x2, %eax
movl %eax, 0x58422(%rip)     # 0xa4ce0
cmpl %eax, 0x58420(%rip)     # 0xa4ce4
jle 0x4c8cc
movl %eax, 0x58418(%rip)     # 0xa4ce4
xorl %eax, %eax
movl %eax, 0x5aba2c(%rip)    # 0x5f8300
movl %eax, 0x5aba2a(%rip)    # 0x5f8304
movl %eax, 0x5aba28(%rip)    # 0x5f8308
movl 0x583f6(%rip), %eax     # 0xa4cdc
addl $-0x4, %eax
movl %eax, 0x583f9(%rip)     # 0xa4ce8
cmpb $0x0, 0x5ab9e6(%rip)    # 0x5f82dc
je 0x4c90b
addq $0x4018, %rsp           # imm = 0x4018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4c91d
addq $0x4018, %rsp           # imm = 0x4018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: findwhite
static void findwhite(void)
{
	if (qsetmode == 200) {
		palmap256[0] = getclosestcol(0,0,0);    // black
		palmap256[1] = getclosestcol(63,63,63);	// white
		palmap256[2] = getclosestcol(42,42,42);	// light grey
		palmap256[3] = getclosestcol(21,21,63);	// light blue
	}
}

// Assembly:
leaq 0x16c104(%rip), %rax    # 0x1b8a28
cmpl $0xc8, (%rax)
jne 0x4c990
pushq %rax
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24f9e
movl %eax, 0x583b2(%rip)     # 0xa4cf0
movl $0x3f, %edi
movl $0x3f, %esi
movl $0x3f, %edx
callq 0x24f9e
movl %eax, 0x5839c(%rip)     # 0xa4cf4
movl $0x2a, %edi
movl $0x2a, %esi
movl $0x2a, %edx
callq 0x24f9e
movl %eax, 0x58386(%rip)     # 0xa4cf8
movl $0x15, %edi
movl $0x15, %esi
movl $0x3f, %edx
callq 0x24f9e
movl %eax, 0x58370(%rip)     # 0xa4cfc
addq $0x8, %rsp
retq