LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Draw
void OSD_Draw(void)
{
	unsigned topoffs;
	int row, lines, x, len;

	if (!osdvisible || !osdinited) return;

	topoffs = osdhead * osdcols;
	row = osdrows-1;
	lines = min( osdlines-osdhead, osdrows );

	clearbackground(osdcols,osdrows+1);

	for (; lines>0; lines--, row--) {
		drawosdstr(0,row,osdtext+topoffs,osdcols,osdtextshade,osdtextpal);
		topoffs+=osdcols;
	}

	drawosdchar(2,osdrows,'>',osdpromptshade,osdpromptpal);
	if (osdeditcaps) drawosdchar(0,osdrows,'C',osdpromptshade,osdpromptpal);

	len = min(osdcols-1-3, osdeditlen-osdeditwinstart);
	for (x=0; x<len; x++)
		drawosdchar(3+x,osdrows,osdeditbuf[osdeditwinstart+x],osdeditshade,osdeditpal);

	drawosdcursor(3+osdeditcursor-osdeditwinstart,osdrows,osdovertype,keytime);
}

// Assembly:
cmpb $0x0, 0x5ab944(%rip)    # 0x5f82dc
je 0x4cb1c
testb $0x1, 0x5a7923(%rip)    # 0x5f42c8
je 0x4cb1c
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x5ab94b(%rip), %r15d   # 0x5f8304
movl 0x5831d(%rip), %ebx     # 0xa4cdc
movl 0x5831e(%rip), %r14d    # 0xa4ce4
movl 0x582b4(%rip), %ebp     # 0xa4c80
subl %r15d, %ebp
cmpl %r14d, %ebp
cmovgel %r14d, %ebp
leal 0x1(%r14), %esi
movl %ebx, %edi
callq *0x582ce(%rip)          # 0xa4cb0
testl %ebp, %ebp
jle 0x4ca2c
imull %r15d, %ebx
movl 0x582ec(%rip), %ecx     # 0xa4cdc
incl %ebp
decl %r14d
leaq 0x5a78d4(%rip), %r15    # 0x5f42d0
movl %ebx, %edx
addq %r15, %rdx
movl 0x5ab8d0(%rip), %r8d    # 0x5f82d8
movl 0x582c1(%rip), %r9d     # 0xa4cd0
xorl %edi, %edi
movl %r14d, %esi
callq *0x58276(%rip)          # 0xa4c90
movl 0x582bc(%rip), %ecx     # 0xa4cdc
addl %ecx, %ebx
decl %ebp
decl %r14d
cmpl $0x1, %ebp
ja 0x4c9fc
movl 0x582b2(%rip), %esi     # 0xa4ce4
movl 0x5ab898(%rip), %ecx    # 0x5f82d0
movl 0x58289(%rip), %r8d     # 0xa4cc8
movl $0x2, %edi
movl $0x3e, %edx
callq *0x58239(%rip)          # 0xa4c88
cmpl $0x0, 0x5ab8a6(%rip)    # 0x5f82fc
je 0x4ca78
movl 0x58286(%rip), %esi     # 0xa4ce4
movl 0x5ab86c(%rip), %ecx    # 0x5f82d0
movl 0x5825d(%rip), %r8d     # 0xa4cc8
xorl %edi, %edi
movl $0x43, %edx
callq *0x58210(%rip)          # 0xa4c88
movslq 0x5825d(%rip), %rbx     # 0xa4cdc
leal -0x4(%rbx), %edx
movslq 0x5ab883(%rip), %rcx    # 0x5f830c
movslq 0x5ab878(%rip), %rax    # 0x5f8308
subq %rax, %rcx
cmpl %ecx, %edx
cmovgel %ecx, %edx
testl %edx, %edx
jle 0x4caeb
addq $-0x4, %rbx
cmpq %rcx, %rbx
cmovgeq %rcx, %rbx
xorl %r14d, %r14d
leaq 0x5ab85f(%rip), %r15    # 0x5f8310
leal 0x3(%r14), %edi
movl 0x58229(%rip), %esi     # 0xa4ce4
movslq 0x5ab846(%rip), %rax    # 0x5f8308
addq %r14, %rax
movsbl (%r15,%rax), %edx
movl 0x5ab804(%rip), %ecx    # 0x5f82d4
movl 0x581f5(%rip), %r8d     # 0xa4ccc
callq *0x581ab(%rip)          # 0xa4c88
incq %r14
cmpl %r14d, %ebx
jne 0x4cab1
movl 0x5ab81d(%rip), %eax    # 0x5f8308
movq 0x581a6(%rip), %r8      # 0xa4c98
movl 0x5aba18(%rip), %edi    # 0x5f8510
subl %eax, %edi
addl $0x3, %edi
movl 0x581e1(%rip), %esi     # 0xa4ce4
movl 0x5ab7ef(%rip), %edx    # 0x5f82f8
movl 0x5ab7d9(%rip), %ecx    # 0x5f82e8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%r8
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Printf
void OSD_Printf(const char *fmt, ...)
{
	char tmpstr[1024];
	va_list va;

	if (!osdinited) return;

	va_start(va, fmt);
	vsnprintf(tmpstr, sizeof(tmpstr), fmt, va);
	va_end(va);

	OSD_Puts(tmpstr);
}

// Assembly:
pushq %rbx
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x4cb79
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
cmpb $0x1, 0x5a7748(%rip)    # 0x5f42c8
jne 0x4cbca
movq %rdi, %r10
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x4e0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x6740
movq %rbx, %rdi
callq 0x4cbd3
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Puts
void OSD_Puts(const char *str)
{
    const char *chp;

	if (!osdinited) return;

	for (chp = str; *chp; chp++) {
		if (*chp == '\r') osdpos=0;
		else if (*chp == '\n') {
			osdpos=0;
			linefeed();
		} else {
			osdtext[osdpos++] = *chp;
			if (osdpos == osdcols) {
				osdpos = 0;
				linefeed();
			}
		}
	}
}

// Assembly:
cmpb $0x1, 0x5a76ee(%rip)    # 0x5f42c8
jne 0x4ccab
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x5ab709(%rip), %eax    # 0x5f8300
movl 0x58083(%rip), %ebp     # 0xa4c80
movslq 0x580d8(%rip), %r14     # 0xa4cdc
leaq 0x5a76c5(%rip), %r15    # 0x5f42d0
leaq (%r15,%r14), %rcx
movq %rcx, 0x10(%rsp)
movl $0x4000, %r13d          # imm = 0x4000
subq %r14, %r13
movl 0x580b5(%rip), %ecx     # 0xa4cd8
movl %ecx, 0xc(%rsp)
movzbl (%rbx), %ecx
cmpl $0xa, %ecx
je 0x4cc4e
cmpl $0xd, %ecx
je 0x4cc88
testl %ecx, %ecx
je 0x4cc9d
leal 0x1(%rax), %r12d
movl %r12d, 0x5ab6bd(%rip)   # 0x5f8300
cltq
movb %cl, (%rax,%r15)
cmpl %r14d, %r12d
jne 0x4cc95
movl $0x0, 0x5ab6a8(%rip)    # 0x5f8300
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x61a0
xorl %r12d, %r12d
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x62f0
cmpl 0xc(%rsp), %ebp
jge 0x4cc95
incl %ebp
movl %ebp, 0x57ffa(%rip)     # 0xa4c80
jmp 0x4cc95
movl $0x0, 0x5ab66e(%rip)    # 0x5f8300
xorl %r12d, %r12d
incq %rbx
movl %r12d, %eax
jmp 0x4cc27
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/osd.c
// Function: OSD_DispatchQueued
void OSD_DispatchQueued(void)
{
	int cmd;

	if (!osdexeccount) return;

	cmd=osdexeccount-1;
	osdexeccount=0;

	for (; cmd>=0; cmd--) {
		OSD_Dispatch((const char *)osdhistorybuf[cmd]);
	}
}

// Assembly:
movl 0x5ab862(%rip), %eax    # 0x5f8514
testq %rax, %rax
je 0x4cd02
movl $0x0, 0x5ab853(%rip)    # 0x5f8514
testl %eax, %eax
jle 0x4cd02
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1(%rax), %r14
shlq $0x9, %rax
leaq 0x5ab848(%rip), %rcx    # 0x5f8520
leaq (%rax,%rcx), %rbx
addq $-0x200, %rbx           # imm = 0xFE00
movq %rbx, %rdi
callq 0x4cd03
decq %r14
addq $-0x200, %rbx           # imm = 0xFE00
cmpq $0x1, %r14
ja 0x4cce3
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Dispatch
int OSD_Dispatch(const char *cmd)
{
	char *workbuf, *wp, *wtp, *state;
	char *parms[MAXPARMS];
	int  numparms, restart = 0;
	osdfuncparm_t ofp;
	symbol_t *symb;
	//int i;

	workbuf = state = Bstrdup(cmd);
	if (!workbuf) return -1;

	do {
		numparms = 0;
		Bmemset(parms, 0, sizeof(parms));
		wp = strtoken(state, &wtp, &restart);
		if (!wp) {
			state = wtp;
			continue;
		}

		symb = findexactsymbol(wp);
		if (!symb) {
			OSD_Printf("Error: \"%s\" is not defined\n", wp);
			free(workbuf);
			return -1;
		}

		ofp.name = wp;
		while (wtp && !restart) {
			wp = strtoken(NULL, &wtp, &restart);
			if (wp && numparms < MAXPARMS) parms[numparms++] = wp;
		}
		ofp.numparms = numparms;
		ofp.parms    = (const char **)parms;
		ofp.raw      = cmd;
		switch (symb->func(&ofp)) {
			case OSDCMD_OK: break;
			case OSDCMD_SHOWHELP: OSD_Printf("%s\n", symb->help); break;
		}

		state = wtp;
	} while (wtp && restart);

	free(workbuf);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1048, %rsp           # imm = 0x1048
movl $0x0, 0x4(%rsp)
movq %rdi, 0x18(%rsp)
callq 0x6060
testq %rax, %rax
je 0x4ce34
leaq 0x40(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rax, 0x10(%rsp)
movq %rax, %rbp
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0x62f0
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ce6f
testq %rax, %rax
je 0x4ce18
movq %rax, %rbp
movq %rax, %rdi
callq 0x4cf63
testq %rax, %rax
je 0x4ce3b
movq %rax, %rbx
movq %rbp, 0x28(%rsp)
cmpq $0x0, 0x8(%rsp)
setne %al
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
sete %cl
andb %al, %cl
xorl %ebp, %ebp
cmpb $0x1, %cl
jne 0x4cde4
xorl %edi, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ce6f
testq %rax, %rax
setne %cl
cmpl $0x200, %ebp            # imm = 0x200
setl %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4cdd2
movslq %ebp, %rcx
incl %ebp
movq %rax, 0x40(%rsp,%rcx,8)
cmpq $0x0, 0x8(%rsp)
movl 0x4(%rsp), %r14d
je 0x4cde4
testl %r14d, %r14d
je 0x4cda5
movl %ebp, 0x20(%rsp)
movq %r15, 0x30(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x20(%rsp), %rdi
callq *0x18(%rbx)
cmpl $0x1, %eax
jne 0x4ce1d
movq 0x10(%rbx), %rsi
leaq 0x2d2fd(%rip), %rdi     # 0x7a10c
xorl %eax, %eax
callq 0x4cb1d
jmp 0x4ce1d
movl 0x4(%rsp), %r14d
movq 0x8(%rsp), %rbp
xorl %ebx, %ebx
testq %rbp, %rbp
je 0x4ce51
testl %r14d, %r14d
jne 0x4cd46
jmp 0x4ce51
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4ce5b
leaq 0x2aed4(%rip), %rdi     # 0x77d16
movq %rbp, %rsi
xorl %eax, %eax
callq 0x4cb1d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
callq 0x61c0
movl %ebx, %eax
addq $0x1048, %rsp           # imm = 0x1048
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: strtoken
static char *strtoken(char *s, char **ptrptr, int *restart)
{
	char *p, *p2, *start;

	*restart = 0;
	if (!ptrptr) return NULL;

	// if s != NULL, we process from the start of s, otherwise
	// we just continue with where ptrptr points to
	if (s) p = s;
	else p = *ptrptr;

	if (!p) return NULL;

	// eat up any leading whitespace
	while (*p != 0 && *p != ';' && *p == ' ') p++;

	// a semicolon is an end of statement delimiter like a \0 is, so we signal
	// the caller to 'restart' for the rest of the string pointed at by *ptrptr
	if (*p == ';') {
		*restart = 1;
		*ptrptr = p+1;
		return NULL;
	}
	// or if we hit the end of the input, signal all done by nulling *ptrptr
	else if (*p == 0) {
		*ptrptr = NULL;
		return NULL;
	}

	if (*p == '\"') {
		// quoted string
		start = ++p;
		p2 = p;
		while (*p != 0) {
			if (*p == '\"') {
				p++;
				break;
			} else if (*p == '\\') {
				switch (*(++p)) {
					case 'n': *p2 = '\n'; break;
					case 'r': *p2 = '\r'; break;
					default: *p2 = *p; break;
				}
			} else {
				*p2 = *p;
			}
			p2++, p++;
		}
		*p2 = 0;
	} else {
		start = p;
		while (*p != 0 && *p != ';' && *p != ' ') p++;
	}

	// if we hit the end of input, signal all done by nulling *ptrptr
	if (*p == 0) {
		*ptrptr = NULL;
	}
	// or if we came upon a semicolon, signal caller to restart with the
	// string at *ptrptr
	else if (*p == ';') {
		*p = 0;
		*ptrptr = p+1;
		*restart = 1;
	}
	// otherwise, clip off the token and carry on
	else {
		*(p++) = 0;
		*ptrptr = p;
	}

	return start;
}

// Assembly:
movl $0x0, (%rdx)
testq %rsi, %rsi
je 0x4ceba
movq %rdi, %rax
testq %rdi, %rdi
jne 0x4ce8f
movq (%rsi), %rax
testq %rax, %rax
jne 0x4ce8f
jmp 0x4ceba
incq %rax
movzbl (%rax), %edi
cmpl $0x20, %edi
je 0x4ce8c
testl %edi, %edi
je 0x4ceb3
cmpl $0x22, %edi
je 0x4cebd
cmpl $0x3b, %edi
jne 0x4cf04
movl $0x1, (%rdx)
incq %rax
movq %rax, (%rsi)
jmp 0x4ceba
movq $0x0, (%rsi)
xorl %eax, %eax
retq
incq %rax
movq %rax, %rcx
movq %rax, %rdi
movzbl (%rcx), %r8d
cmpl $0x5c, %r8d
je 0x4cedd
testl %r8d, %r8d
je 0x4cf2d
cmpl $0x22, %r8d
jne 0x4cef9
jmp 0x4cf2a
movzbl 0x1(%rcx), %r8d
incq %rcx
cmpl $0x6e, %r8d
je 0x4cef6
cmpl $0x72, %r8d
jne 0x4cef9
movb $0xd, %r8b
jmp 0x4cef9
movb $0xa, %r8b
movb %r8b, (%rdi)
incq %rdi
incq %rcx
jmp 0x4cec6
movabsq $0x800000100000001, %r8 # imm = 0x800000100000001
movq %rax, %rcx
cmpb $0x3b, %dil
ja 0x4cf21
movzbl %dil, %r9d
btq %r9, %r8
jb 0x4cf33
movb 0x1(%rcx), %dil
incq %rcx
jmp 0x4cf11
incq %rcx
movb $0x0, (%rdi)
movb (%rcx), %dil
cmpb $0x3b, %dil
je 0x4cf49
movzbl %dil, %edx
testl %edx, %edx
jne 0x4cf59
movq $0x0, (%rsi)
retq
movb $0x0, (%rcx)
incq %rcx
movq %rcx, (%rsi)
movl $0x1, (%rdx)
retq
movb $0x0, (%rcx)
incq %rcx
movq %rcx, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: addnewsymbol
static symbol_t *addnewsymbol(const char *name)
{
	symbol_t *newsymb, *s, *t;

	newsymb = (symbol_t *)Bmalloc(sizeof(symbol_t));
	if (!newsymb) { return NULL; }
	Bmemset(newsymb, 0, sizeof(symbol_t));

	// link it to the main chain
	if (!symbols) {
		symbols = newsymb;
	} else {
		if (Bstrcasecmp(name, symbols->name) <= 0) {
			t = symbols;
			symbols = newsymb;
			symbols->next = t;
		} else {
			s = symbols;
			while (s->next) {
				if (Bstrcasecmp(s->next->name, name) > 0) break;
				s=s->next;
			}
			t = s->next;
			s->next = newsymb;
			newsymb->next = t;
		}
	}

	return newsymb;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x20, %esi
callq 0x6930
movq %rax, %rbx
testq %rax, %rax
je 0x4d00e
movq 0x5a72fc(%rip), %r15    # 0x5f42c0
testq %r15, %r15
je 0x4d007
movq (%r15), %rsi
movq %r14, %rdi
callq 0x6880
testl %eax, %eax
jg 0x4cfe1
movq %rbx, 0x5a72e1(%rip)    # 0x5f42c0
jmp 0x4d001
movq %r15, %r12
movq 0x8(%r15), %r15
testq %r15, %r15
je 0x4cffc
movq (%r15), %rdi
movq %r14, %rsi
callq 0x6880
testl %eax, %eax
jle 0x4cfe1
movq %rbx, 0x8(%r12)
movq %r15, 0x8(%rbx)
jmp 0x4d00e
movq %rbx, 0x5a72b2(%rip)    # 0x5f42c0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: findsymbol
static symbol_t *findsymbol(const char *name, symbol_t *startingat)
{
	if (!startingat) startingat = symbols;
	if (!startingat) return NULL;

	for (; startingat; startingat=startingat->next)
		if (!Bstrncasecmp(name, startingat->name, Bstrlen(name))) return startingat;

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x4d031
movq 0x5a728f(%rip), %rbx    # 0x5f42c0
testq %rbx, %rbx
je 0x4d063
leaq 0x5ad4e3(%rip), %r14    # 0x5fa520
movq %r14, %rdi
callq 0x6420
movq %rax, %r15
movq (%rbx), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x6a40
testl %eax, %eax
je 0x4d065
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x4d048
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/pragmas.c
// Function: swapbuf4
void swapbuf4(void *a, void *b, int c)
{
	int *p = (int*)a, *q = (int*)b;
	int x, y;
	while ((c--) > 0) {
		x = *q;
		y = *p;
		*(q++) = y;
		*(p++) = x;
	}
}

// Assembly:
testl %edx, %edx
jle 0x4d3fd
incl %edx
xorl %eax, %eax
movl (%rsi,%rax), %ecx
movl (%rdi,%rax), %r8d
movl %r8d, (%rsi,%rax)
movl %ecx, (%rdi,%rax)
decl %edx
addq $0x4, %rax
cmpl $0x1, %edx
ja 0x4d3e4
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/pragmas.c
// Function: clearbufbyte
void clearbufbyte(void *D, int c, int a)
{
	char *p = (char*)D;
	int m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
	int n[4] = { 0,8,16,24 };
	int z=0;
	while ((c--) > 0) {
		*(p++) = (char)((a & m[z])>>n[z]);
		z=(z+1)&3;
	}
}

// Assembly:
testl %esi, %esi
jle 0x4d436
incl %esi
xorl %eax, %eax
leaq 0x2abf3(%rip), %r8      # 0x78000
leaq 0x2abfc(%rip), %r9      # 0x78010
movl %eax, %ecx
movl (%r8,%rcx,4), %r10d
andl %edx, %r10d
movb (%r9,%rcx,4), %cl
sarl %cl, %r10d
movb %r10b, (%rdi)
incq %rdi
incl %eax
andl $0x3, %eax
decl %esi
cmpl $0x1, %esi
ja 0x4d414
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_gettoken
char *scriptfile_gettoken(scriptfile *sf)
{
	char *start;

	skipoverws(sf);
	if (sf->textptr >= sf->eof) return NULL;

	start = sf->ltextptr = sf->textptr;
	skipovertoken(sf);
	return start;
}

// Assembly:
movq 0x18(%rdi), %rax
movq 0x20(%rdi), %rcx
cmpq %rcx, %rax
jae 0x4d481
cmpb $0x0, (%rax)
jne 0x4d481
incq %rax
movq %rax, 0x18(%rdi)
cmpq %rcx, %rax
jae 0x4d49f
movq %rax, 0x10(%rdi)
movq %rax, %rdx
cmpb $0x0, (%rdx)
je 0x4d49e
incq %rdx
movq %rdx, 0x18(%rdi)
cmpq %rcx, %rdx
jne 0x4d48d
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_getlinum
int scriptfile_getlinum (scriptfile *sf, char *ptr)
{
	int i, stp;
	ptrdiff_t ind;

	//for(i=0;i<sf->linenum;i++) if (sf->lineoffs[i] >= ind) return(i+1); //brute force algo

	ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf);

	for(stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
	for(i=0;stp;stp>>=1)
		if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
	return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
}

// Assembly:
movq (%rdi), %rax
movl 0x30(%rdi), %ecx
movl $0x1, %r8d
movl %r8d, %edx
leal (%rdx,%rdx), %r8d
cmpl %ecx, %r8d
jl 0x4d518
subq %rax, %rsi
xorl %eax, %eax
leal (%rax,%rdx), %r8d
cmpl %ecx, %r8d
jge 0x4d548
movq 0x38(%rdi), %r9
movslq %r8d, %r10
movslq (%r9,%r10,4), %r9
cmpq %r9, %rsi
jg 0x4d545
movl %eax, %r8d
movl %r8d, %eax
movl %edx, %r8d
sarl %r8d
cmpl $0x1, %edx
movl %r8d, %edx
ja 0x4d529
incl %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_getnumber_radix
static int scriptfile_getnumber_radix(scriptfile *sf, int *num, int radix)
{
	skipoverws(sf);
	if (sf->textptr >= sf->eof)
	{
		buildprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
		return -1;
	}

	while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9'))
		sf->textptr++; //hack to treat octal numbers like decimal
	
	sf->ltextptr = sf->textptr;
	(*num) = (int)strtol((const char *)sf->textptr,&sf->textptr,radix);
	if (!ISWS(*sf->textptr) && *sf->textptr) {
		char *p = sf->textptr;
		skipovertoken(sf);
		buildprintf("Error on line %s:%d: expecting int, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p);
		return -2;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %rax
cmpq %rax, %rsi
jae 0x4d584
cmpb $0x0, (%rsi)
jne 0x4d584
incq %rsi
movq %rsi, (%r14)
cmpq %rax, %rsi
jae 0x4d5b0
cmpb $0x30, (%rsi)
jne 0x4d5d9
incq %rsi
movb (%rsi), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x4d5d6
movq %rsi, (%r14)
leaq 0x1(%rsi), %rax
cmpb $0x30, (%rsi)
movq %rax, %rsi
je 0x4d591
decq %rax
movq %rax, %rsi
jmp 0x4d5d9
movq 0x28(%rbx), %r14
movq %rbx, %rdi
callq 0x4d50c
leaq 0x2aa7d(%rip), %rdi     # 0x78040
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x25221
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4d60b
decq %rsi
movq %rsi, 0x10(%rbx)
movq %rsi, %rdi
movq %r14, %rsi
callq 0x6940
movl %eax, (%r15)
movq 0x18(%rbx), %r15
movzbl (%r15), %ecx
cmpq $0x20, %rcx
ja 0x4d611
xorl %eax, %eax
movabsq $0x100002601, %rdx      # imm = 0x100002601
btq %rcx, %rdx
jae 0x4d611
popq %rbx
popq %r14
popq %r15
retq
movq 0x20(%rbx), %rax
cmpq %rax, %r15
jae 0x4d62f
leaq 0x1(%r15), %rcx
movq %rcx, (%r14)
cmpq %rax, %rcx
je 0x4d62f
cmpb $0x0, (%rcx)
leaq 0x1(%rcx), %rcx
jne 0x4d61e
movq 0x10(%rbx), %rsi
movq 0x28(%rbx), %r14
movq %rbx, %rdi
callq 0x4d50c
leaq 0x2aaa4(%rip), %rdi     # 0x780ea
movq %r14, %rsi
movl %eax, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x25221
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x4d60b
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_getsymbol
int scriptfile_getsymbol(scriptfile *sf, int *num)
{
	char *t, *e;
	int v;

	t = scriptfile_gettoken(sf);
	if (!t) return -1;

	v = (int)strtol(t, &e, 10);
	if (*e) {
		// looks like a string, so find it in the symbol table
		if (scriptfile_getsymbolvalue(t, num)) return 0;
		buildprintf("Error on line %s:%d: expecting symbol, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),t);
		return -2;   // not found
	}

	*num = v;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
callq 0x4d468
testq %rax, %rax
je 0x4d8c0
movq %rax, %rbx
movq %rsp, %r12
movq %rax, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x6940
movq (%r12), %rcx
cmpb $0x0, (%rcx)
je 0x4d8c7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d8d8
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x4d8cc
movq 0x10(%r14), %rsi
movq 0x28(%r14), %r15
movq %r14, %rdi
callq 0x4d50c
leaq 0x2a7eb(%rip), %rdi     # 0x78095
movq %r15, %rsi
movl %eax, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x25221
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x4d8cc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4d8cc
movl %eax, (%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_getsymbolvalue
int scriptfile_getsymbolvalue(const char *name, int *val)
{
	char *scanner = symbtab;

	if (!symbtab) return 0;
	while (scanner - symbtab < (ptrdiff_t)symbtablength) {
		if (!strcasecmp(name, scanner)) {
			*val = *(int*)(scanner + strlen(scanner) + 1);
			return 1;
		}

		scanner += strlen(scanner) + 1 + sizeof(int);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x5ace3e(%rip), %r13    # 0x5fa728
xorl %ebx, %ebx
testq %r13, %r13
je 0x4d944
movq 0x5ace38(%rip), %r14    # 0x5fa730
testq %r14, %r14
jle 0x4d944
movq %rdi, %r15
movq %rsi, (%rsp)
movq %r13, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x6880
movl %eax, %ebp
movq %r12, %rdi
callq 0x6420
testl %ebp, %ebp
je 0x4d934
addq %rax, %r12
addq $0x5, %r12
movq %r12, %rax
subq %r13, %rax
cmpq %r14, %rax
jl 0x4d907
jmp 0x4d944
movl 0x1(%r12,%rax), %eax
movq (%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %ebx
movl %ebx, %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/scriptfile.c
// Function: scriptfile_getbraces
int scriptfile_getbraces(scriptfile *sf, char **braceend)
{
	int bracecnt;
	char *bracestart;

	skipoverws(sf);
	if (sf->textptr >= sf->eof)
	{
		buildprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
		return -1;
	}

	if (sf->textptr[0] != '{') {
		buildprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
		return -1;
	}
	bracestart = ++sf->textptr; bracecnt = 1;
	while (1)
	{
		if (sf->textptr >= sf->eof) return(0);
		if (sf->textptr[0] == '{') bracecnt++;
		if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; }
		sf->textptr++;
	}
	(*braceend) = sf->textptr;
	sf->textptr = bracestart;
	return 0;
}

// Assembly:
movq %rsi, %rcx
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %r8
cmpq %r8, %rsi
jae 0x4d971
cmpb $0x0, (%rsi)
jne 0x4d971
incq %rsi
movq %rsi, 0x18(%rdi)
pushq %rbx
cmpq %r8, %rsi
jae 0x4d9c7
cmpb $0x7b, (%rsi)
jne 0x4d9d9
leaq 0x1(%rsi), %rdx
movq %rdx, 0x18(%rdi)
xorl %eax, %eax
cmpq %r8, %rdx
jae 0x4d9fa
notq %rsi
addq %r8, %rsi
movl $0x1, %r8d
movq %rdx, %r9
movb (%r9), %bl
xorl %r10d, %r10d
cmpb $0x7b, %bl
sete %r11b
cmpb $0x7d, %bl
jne 0x4d9b3
decl %r8d
jne 0x4d9b9
jmp 0x4d9fc
movb %r11b, %r10b
addl %r10d, %r8d
incq %r9
movq %r9, 0x18(%rdi)
decq %rsi
jne 0x4d99a
jmp 0x4d9fa
movq 0x28(%rdi), %rbx
callq 0x4d50c
leaq 0x2a669(%rip), %rdi     # 0x78040
jmp 0x4d9e9
movq 0x28(%rdi), %rbx
callq 0x4d50c
leaq 0x2a6dd(%rip), %rdi     # 0x780c6
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x25221
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
movq %r9, (%rcx)
movq %rdx, 0x18(%rdi)
jmp 0x4d9fa
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_fromfile
scriptfile *scriptfile_fromfile(const char *fn)
{
	int fp;
	scriptfile *sf;
	char *tx;
	unsigned int flen;

	fp = kopen4load(fn,0);
	if (fp<0) return NULL;

	flen = kfilelength(fp);
	tx = (char *) malloc(flen + 2);
	if (!tx) {
		kclose(fp);
		return NULL;
	}

	sf = (scriptfile*) malloc(sizeof(scriptfile));
	if (!sf) {
		kclose(fp);
		free(tx);
		return NULL;
	}

	kread(fp, tx, flen);
	tx[flen] = tx[flen+1] = 0;

	kclose(fp);

	scriptfile_preparse(sf,tx,flen);
	sf->filename = strdup(fn);

	return sf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x2043c
testl %eax, %eax
js 0x4dc97
movl %eax, %ebp
movl %eax, %edi
callq 0x209a1
movl %eax, %r12d
leal 0x2(%r12), %edi
callq 0x69a0
testq %rax, %rax
je 0x4dc7c
movq %rax, %r15
movl $0x40, %edi
callq 0x69a0
testq %rax, %rax
je 0x4dc85
movq %rax, %r14
movl %ebp, %edi
movq %r15, %rsi
movl %r12d, %edx
callq 0x20684
leal 0x1(%r12), %eax
xorl %ecx, %ecx
movb %cl, (%r15,%rax)
movl %r12d, %r12d
movb %cl, (%r15,%r12)
movl %ebp, %edi
callq 0x20b40
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4da05
movq %rbx, %rdi
callq 0x6060
movq %rax, 0x28(%r14)
jmp 0x4dc97
movl %ebp, %edi
callq 0x20b40
jmp 0x4dc94
movl %ebp, %edi
callq 0x20b40
movq %r15, %rdi
callq 0x61c0
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_fromstring
scriptfile *scriptfile_fromstring(const char *string)
{
	scriptfile *sf;
	char *tx;
	size_t flen;

	if (!string) return NULL;

	flen = strlen(string);

	tx = (char *) malloc(flen + 2);
	if (!tx) return NULL;

	sf = (scriptfile*) malloc(sizeof(scriptfile));
	if (!sf) {
		free(tx);
		return NULL;
	}

	memcpy(tx, string, flen);
	tx[flen] = tx[flen+1] = 0;

	scriptfile_preparse(sf,tx,flen);
	sf->filename = NULL;

	return sf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4dd13
movq %rdi, %r14
callq 0x6420
movq %rax, %r15
leaq 0x2(%rax), %rdi
callq 0x69a0
testq %rax, %rax
je 0x4dd13
movq %rax, %r12
movl $0x40, %edi
callq 0x69a0
testq %rax, %rax
je 0x4dd0b
movq %rax, %rbx
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x60c0
movw $0x0, (%r12,%r15)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4da05
movq $0x0, 0x28(%rbx)
jmp 0x4dd15
movq %r12, %rdi
callq 0x61c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_close
void scriptfile_close(scriptfile *sf)
{
	if (!sf) return;
	if (sf->lineoffs) free(sf->lineoffs);
	if (sf->textbuf) free(sf->textbuf);
	if (sf->filename) free(sf->filename);
	sf->textbuf = NULL;
	sf->filename = NULL;
	free(sf);
}

// Assembly:
testq %rdi, %rdi
je 0x4dd5f
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x4dd3b
callq 0x61c0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4dd48
callq 0x61c0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x4dd56
callq 0x61c0
movq %rbx, %rdi
popq %rbx
jmp 0x61c0
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/scriptfile.c
// Function: scriptfile_addsymbolvalue
int scriptfile_addsymbolvalue(const char *name, int val)
{
	//int x;
	char *sp;
	//if (scriptfile_getsymbolvalue(name, &x)) return -1;   // already exists

	if (symbtab) {
		char *scanner = symbtab;
		while (scanner - symbtab < (ptrdiff_t)symbtablength) {
			if (!strcasecmp(name, scanner)) {
				*(int*)(scanner + strlen(scanner) + 1) = val;
				return 1;
			}

			scanner += strlen(scanner) + 1 + sizeof(int);
		}
	}
	
	sp = getsymbtabspace(strlen(name) + 1 + sizeof(int));
	if (!sp) return 0;
	strcpy(sp, name);
	sp += strlen(name)+1;
	*(int*)sp = val;
	return 1;   // added
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x5ac98f(%rip), %r15    # 0x5fa728
movq 0x5ac990(%rip), %r13    # 0x5fa730
testq %r15, %r15
je 0x4ddda
testq %r13, %r13
jle 0x4ddda
movq %r15, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x6880
testl %eax, %eax
je 0x4de5e
movq %r12, %rdi
callq 0x6420
addq %rax, %r12
addq $0x5, %r12
movq %r12, %rax
subq %r15, %rax
cmpq %r13, %rax
jl 0x4ddad
movq %r14, %rdi
callq 0x6420
leaq (%rax,%r13), %rbp
addq $0x5, %rbp
movq 0x5ac947(%rip), %rcx    # 0x5fa738
cmpq %rcx, %rbp
jbe 0x4de3b
cmpq $0x101, %rcx            # imm = 0x101
movl $0x100, %eax            # imm = 0x100
cmovaeq %rcx, %rax
movq %rax, %r12
addq %rax, %rax
cmpq %r12, %rbp
ja 0x4de06
movq %r15, %rdi
movq %r12, %rsi
callq 0x6120
testq %rax, %rax
je 0x4de5a
movq %rax, %r15
movq %rax, 0x5ac8fd(%rip)    # 0x5fa728
movq %r12, 0x5ac906(%rip)    # 0x5fa738
movq %rbp, 0x5ac8f7(%rip)    # 0x5fa730
jmp 0x4de47
movq %rbp, 0x5ac8ee(%rip)    # 0x5fa730
testq %r15, %r15
je 0x4de5a
addq %r13, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6430
movq %r15, %r12
jmp 0x4de61
xorl %eax, %eax
jmp 0x4de73
movq %r12, %r14
movq %r14, %rdi
callq 0x6420
movl %ebx, 0x1(%r12,%rax)
movl $0x1, %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/scriptfile.c
// Function: scriptfile_clearsymbols
void scriptfile_clearsymbols(void)
{
	if (symbtab) free(symbtab);
	symbtab = NULL;
	symbtablength = 0;
	symbtaballoclength = 0;
}

// Assembly:
movq 0x5ac89f(%rip), %rdi    # 0x5fa728
testq %rdi, %rdi
je 0x4de98
pushq %rax
callq 0x61c0
addq $0x8, %rsp
xorl %eax, %eax
movq %rax, 0x5ac887(%rip)    # 0x5fa728
movq %rax, 0x5ac888(%rip)    # 0x5fa730
movq %rax, 0x5ac889(%rip)    # 0x5fa738
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/glbuild.c
// Function: glbuild_enumerate_exts
static void glbuild_enumerate_exts(void (*callback)(const char *)) {
	char *workstr = NULL, *workptr = NULL, *nextptr = NULL;
	const char *ext = NULL;

#if (USE_OPENGL == USE_GL3)
	GLint extn = 0, numexts = 0;
	if (glinfo.majver >= 3) {
		glfunc.glGetIntegerv(GL_NUM_EXTENSIONS, &numexts);
	} else
#endif
	{
		const char *extstr = (const char *) glfunc.glGetString(GL_EXTENSIONS);
		workstr = workptr = strdup(extstr);
	}

	while (1) {
#if (USE_OPENGL == USE_GL3)
		if (glinfo.majver >= 3) {
			if (extn == numexts) break;
			ext = (const char *) glfunc.glGetStringi(GL_EXTENSIONS, extn);
		} else
#endif
		{
			ext = Bstrtoken(workptr, " ", &nextptr, 1);
			if (!ext) break;
		}

		callback(ext);

#if (USE_OPENGL == USE_GL3)
		if (glinfo.majver >= 3) {
			extn++;
		} else
#endif
		{
			workptr = NULL;
		}
	}

	if (workstr) free(workstr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %r15
movq $0x0, (%r15)
movl $0x1f03, %edi           # imm = 0x1F03
callq *0x5ab92a(%rip)         # 0x5fa7a0
movq %rax, %rdi
callq 0x6060
movq %rax, %r14
leaq 0x247c4(%rip), %rsi     # 0x7364c
movq %rax, %rdi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x2215f
testq %rax, %rax
je 0x4eec3
leaq 0x247a8(%rip), %r15     # 0x7364c
movq %rsp, %r12
movq %rax, %rdi
callq *%rbx
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x2215f
testq %rax, %rax
jne 0x4eea7
testq %r14, %r14
je 0x4eed0
movq %r14, %rdi
callq 0x61c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/glbuild.c
// Function: osdcmd_glinfo
static int osdcmd_glinfo(const osdfuncparm_t *parm)
{
	if (parm->numparms == 0) {
		dumpglinfo();
		buildputs("Use \"glinfo exts\" to list extensions.\n");
	} else if (strcmp(parm->parms[0], "exts") == 0) {
		dumpglexts();
	}
	return OSDCMD_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x0, (%rdi)
je 0x4f1ee
movq 0x10(%rdi), %rax
movq (%rax), %rdi
leaq 0x24386(%rip), %rsi     # 0x73537
callq 0x68d0
testl %eax, %eax
jne 0x4f352
leaq 0x12f08b(%rip), %rax    # 0x17e250
cmpl $0x0, (%rax)
je 0x4f233
leaq 0x2af3f(%rip), %rdi     # 0x7a110
callq 0x32d18
leaq 0xbca(%rip), %rdi       # 0x4fda7
callq 0x4ee56
leaq 0x28023(%rip), %rdi     # 0x7720c
jmp 0x4f34d
leaq 0x12f05b(%rip), %rbx    # 0x17e250
cmpl $0x0, (%rbx)
je 0x4f211
movl 0xc(%rbx), %eax
cmpl $0x1, %eax
jne 0x4f222
cmpl $0x0, 0x10(%rbx)
jne 0x4f222
leaq 0x2ad8a(%rip), %rax     # 0x79f99
jmp 0x4f246
leaq 0x2ad5e(%rip), %rdi     # 0x79f76
callq 0x32d18
jmp 0x4f346
testl %eax, %eax
jle 0x4f23f
movl $0x8b8c, %edi           # imm = 0x8B8C
callq *0x5ab56f(%rip)         # 0x5fa7a0
jmp 0x4f246
leaq 0x2ad3c(%rip), %rdi     # 0x79f76
jmp 0x4f34d
leaq 0x2ad22(%rip), %rax     # 0x79f68
movq %rax, 0x8(%rsp)
movl $0x1f02, %edi           # imm = 0x1F02
callq *0x5ab54a(%rip)         # 0x5fa7a0
movq %rax, 0x20(%rsp)
movl $0x1f00, %edi           # imm = 0x1F00
callq *0x5ab53a(%rip)         # 0x5fa7a0
movq %rax, 0x18(%rsp)
movl $0x1f01, %edi           # imm = 0x1F01
callq *0x5ab52a(%rip)         # 0x5fa7a0
movss 0x14(%rbx), %xmm0
ucomiss 0x27e92(%rip), %xmm0    # 0x77114
cvtss2sd %xmm0, %xmm0
leaq 0x2acdf(%rip), %r13     # 0x79f6c
leaq 0x2acd4(%rip), %rcx     # 0x79f68
movq %rcx, %r9
cmovaq %r13, %r9
movq 0x18(%rbx), %xmm1
pxor %xmm2, %xmm2
pcmpeqb %xmm1, %xmm2
pmovmskb %xmm2, %edx
testb $0x1, %dl
movq %r13, %rsi
cmovneq %rcx, %rsi
movq %rsi, 0x10(%rsp)
testb $0x20, %dl
movq %r13, %r11
cmovneq %rcx, %r11
testb $0x4, %dl
movq %r13, %rbp
cmovneq %rcx, %rbp
testb $0x8, %dl
movq %rbx, %rsi
movq %r13, %rbx
cmovneq %rcx, %rbx
testb $0x10, %dl
movq %r13, %r14
cmovneq %rcx, %r14
testb $0x2, %dl
movq %r13, %r15
cmovneq %rcx, %r15
testb $0x40, %dl
movq %r13, %r12
cmovneq %rcx, %r12
testb $-0x80, %dl
movq %r13, %r10
cmovneq %rcx, %r10
cmpb $0x0, 0x20(%rsi)
cmoveq %rcx, %r13
subq $0x8, %rsp
leaq 0x2ac87(%rip), %rdi     # 0x79f9e
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rax, %rcx
movq 0x10(%rsp), %r8
movb $0x1, %al
pushq %r13
pushq %r10
pushq %r12
pushq %r15
pushq %r14
pushq %rbx
pushq %rbp
pushq %r11
pushq 0x58(%rsp)
callq 0x25221
addq $0x50, %rsp
leaq 0x2abf4(%rip), %rdi     # 0x79f41
callq 0x32d18
xorl %eax, %eax
addq $0x28, %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/glbuild.c
// Function: glbuild_check_errors
void glbuild_check_errors(const char *file, int line)
{
	GLenum err;
	const char *str;

	while ((err = glfunc.glGetError()) != GL_NO_ERROR) {
		switch (err) {
			case GL_INVALID_ENUM: str = "GL_INVALID_ENUM"; break;
			case GL_INVALID_VALUE: str = "GL_INVALID_VALUE"; break;
			case GL_INVALID_OPERATION: str = "GL_INVALID_OPERATION"; break;
			case GL_INVALID_FRAMEBUFFER_OPERATION: str = "GL_INVALID_FRAMEBUFFER_OPERATION"; break;
			case GL_OUT_OF_MEMORY: str = "GL_OUT_OF_MEMORY"; break;
#ifdef GL_STACK_UNDERFLOW
			case GL_STACK_UNDERFLOW: str = "GL_STACK_UNDERFLOW"; break;
#endif
#ifdef GL_STACK_OVERFLOW
			case GL_STACK_OVERFLOW: str = "GL_STACK_OVERFLOW"; break;
#endif
			default: str = "(unknown)"; break;
		}
		debugprintf("GL error [%s:%d]: (%d) %s\n", file, line, err, str);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x2a88f(%rip), %r12     # 0x79c1c
leaq 0x2a91f(%rip), %r15     # 0x79cb3
leaq 0x2a385(%rip), %rbp     # 0x79720
leaq 0x2a8b0(%rip), %r13     # 0x79c52
callq *0x5ab400(%rip)         # 0x5fa7a8
leal -0x500(%rax), %ecx
cmpl $0x6, %ecx
ja 0x4f3c9
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
movq %r12, %r8
jmpq *%rcx
leaq 0x2a865(%rip), %r8      # 0x79c2c
jmp 0x4f3fd
testl %eax, %eax
je 0x4f410
leaq 0x2a8d5(%rip), %r8      # 0x79ca9
jmp 0x4f3fd
leaq 0x2a8a7(%rip), %r8      # 0x79c84
jmp 0x4f3fd
leaq 0x2a857(%rip), %r8      # 0x79c3d
jmp 0x4f3fd
leaq 0x2a8a8(%rip), %r8      # 0x79c97
jmp 0x4f3fd
leaq 0x2a87b(%rip), %r8      # 0x79c73
jmp 0x4f3fd
movq %r13, %r8
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x6e05b
jmp 0x4f3a2
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/glbuild.c
// Function: glbuild_link_program
GLuint glbuild_link_program(int shadercount, GLuint *shaders)
{
	GLuint program;
	GLint status;
	int i;

	program = glfunc.glCreateProgram();
	if (!program) {
		return 0;
	}

	for (i = 0; i < shadercount; i++) {
		glfunc.glAttachShader(program, shaders[i]);
	}

	glfunc.glLinkProgram(program);

	glfunc.glGetProgramiv(program, GL_LINK_STATUS, &status);
	if (status == GL_FALSE) {
		GLint loglen = 0;
		GLchar *logtext = NULL;

		glfunc.glGetProgramiv(program, GL_INFO_LOG_LENGTH, &loglen);

		logtext = (GLchar *)malloc(loglen);
		glfunc.glGetProgramInfoLog(program, loglen, &loglen, logtext);
		buildprintf("glbuild_link_program: link error: %s\n", logtext);
		free(logtext);

		glfunc.glDeleteProgram(program);
		return 0;
	}

	for (i = 0; i < shadercount; i++) {
		glfunc.glDetachShader(program, shaders[i]);
	}

	return program;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl %edi, %ebp
callq *0x5ab2ba(%rip)         # 0x5fa898
testl %eax, %eax
je 0x4f6a5
movl %eax, %ebx
movl %ebp, %r12d
testl %ebp, %ebp
jle 0x4f606
xorl %r15d, %r15d
movl (%r14,%r15,4), %esi
movl %ebx, %edi
callq *0x5ab28a(%rip)         # 0x5fa888
incq %r15
cmpq %r15, %r12
jne 0x4f5f2
movl %ebx, %edi
callq *0x5ab2e2(%rip)         # 0x5fa8f0
leaq 0xc(%rsp), %r15
movl %ebx, %edi
movl $0x8b82, %esi           # imm = 0x8B82
movq %r15, %rdx
callq *0x5ab2a5(%rip)         # 0x5fa8c8
cmpl $0x0, (%r15)
je 0x4f646
testl %ebp, %ebp
jle 0x4f6a7
xorl %r15d, %r15d
movl (%r14,%r15,4), %esi
movl %ebx, %edi
callq *0x5ab27c(%rip)         # 0x5fa8b8
incq %r15
cmpq %r15, %r12
jne 0x4f630
jmp 0x4f6a7
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
movl %ebx, %edi
movl $0x8b84, %esi           # imm = 0x8B84
movq %r14, %rdx
callq *0x5ab266(%rip)         # 0x5fa8c8
movl (%r14), %eax
movslq %eax, %r15
movq %r15, %rdi
callq 0x69a0
movq %rax, %r12
movl %ebx, %edi
movl %r15d, %esi
movq %r14, %rdx
movq %rax, %rcx
callq *0x5ab24c(%rip)         # 0x5fa8d0
leaq 0x2a660(%rip), %rdi     # 0x79ceb
movq %r12, %rsi
xorl %eax, %eax
callq 0x25221
movq %r12, %rdi
callq 0x61c0
movl %ebx, %edi
callq *0x5ab203(%rip)         # 0x5fa8a8
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/glbuild.c
// Function: glbuild_delete_8bit_shader
void glbuild_delete_8bit_shader(glbuild8bit *state)
{
	if (state->program) {
#if (USE_OPENGL != USE_GL3)
		glfunc.glDisableVertexAttribArray(state->attrib_vertex);
		glfunc.glDisableVertexAttribArray(state->attrib_texcoord);
#endif
		glfunc.glUseProgram(0);	// Disable shaders, go back to fixed-function.
		glfunc.glDeleteProgram(state->program);
		state->program = 0;
	}
	if (state->paltex) {
		glfunc.glDeleteTextures(1, &state->paltex);
		state->paltex = 0;
	}
	if (state->frametex) {
		glfunc.glDeleteTextures(1, &state->frametex);
		state->frametex = 0;
	}
#if (USE_OPENGL == USE_GL3)
	if (state->vao) {
		glfunc.glBindVertexArray(0);
		glfunc.glDeleteVertexArrays(1, &state->vao);
		state->vao = 0;
	}
#endif
	if (state->buffer_indexes) {
		glfunc.glDeleteBuffers(1, &state->buffer_indexes);
		state->buffer_indexes = 0;
	}
	if (state->buffer_elements) {
		glfunc.glDeleteBuffers(1, &state->buffer_elements);
		state->buffer_elements = 0;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x4fc46
movl 0x10(%rbx), %edi
callq *0x5aac49(%rip)         # 0x5fa870
movl 0x14(%rbx), %edi
callq *0x5aac40(%rip)         # 0x5fa870
xorl %edi, %edi
callq *0x5aacf8(%rip)         # 0x5fa930
movl (%rbx), %edi
callq *0x5aac68(%rip)         # 0x5fa8a8
movl $0x0, (%rbx)
cmpl $0x0, 0x4(%rbx)
je 0x4fc65
leaq 0x4(%rbx), %r14
movl $0x1, %edi
movq %r14, %rsi
callq *0x5aaba2(%rip)         # 0x5fa800
movl $0x0, (%r14)
cmpl $0x0, 0x8(%rbx)
je 0x4fc84
leaq 0x8(%rbx), %r14
movl $0x1, %edi
movq %r14, %rsi
callq *0x5aab83(%rip)         # 0x5fa800
movl $0x0, (%r14)
cmpl $0x0, 0x18(%rbx)
je 0x4fca3
leaq 0x18(%rbx), %r14
movl $0x1, %edi
movq %r14, %rsi
callq *0x5aabb4(%rip)         # 0x5fa850
movl $0x0, (%r14)
cmpl $0x0, 0x1c(%rbx)
je 0x4fcc1
addq $0x1c, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq *0x5aab95(%rip)         # 0x5fa850
movl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_texinvalidate
void polymost_texinvalidate (int dapicnum, int dapalnum, int dameth)
{
	PTIter iter;
	PTHead * pth;

	iter = PTIterNewMatch(
		PTITER_PICNUM | PTITER_PALNUM | PTITER_FLAGS,
		dapicnum, dapalnum, PTH_CLAMPED, (dameth & METH_CLAMPED) ? PTH_CLAMPED : 0
		);
	while ((pth = PTIterNext(iter)) != 0) {
		if (pth->pic[PTHPIC_BASE]) {
			pth->pic[PTHPIC_BASE]->flags |= PTH_DIRTY;
		}
		/*buildprintf("invalidating picnum:%d palnum:%d effects:%d skyface:%d flags:%04X repldef:%p\n",
			   pth->picnum, pth->palnum, pth->effects, pth->skyface,
			   pth->flags, pth->repldef);*/
	}
	//buildprintf("done\n");
	PTIterFree(iter);
}

// Assembly:
pushq %rbx
movl %edx, %r8d
movl %esi, %edx
movl %edi, %esi
shrl $0x2, %r8d
andl $0x1, %r8d
movl $0x7, %edi
movl $0x1, %ecx
callq 0x6750e
movq %rax, %rbx
movq %rax, %rdi
callq 0x6762e
testq %rax, %rax
je 0x4fe2c
movq (%rax), %rax
testq %rax, %rax
je 0x4fe27
orb $-0x80, 0x4(%rax)
movq %rbx, %rdi
jmp 0x4fe11
movq %rbx, %rdi
popq %rbx
jmp 0x67656
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_texinvalidateall
void polymost_texinvalidateall (void)
{
	PTIter iter;
	PTHead * pth;

	iter = PTIterNew();
	while ((pth = PTIterNext(iter)) != 0) {
		if (pth->pic[PTHPIC_BASE]) {
			pth->pic[PTHPIC_BASE]->flags |= PTH_DIRTY;
		}
	}
	PTIterFree(iter);
	clearskins();
	//buildprintf("gltexinvalidateall()\n");
}

// Assembly:
pushq %rbx
callq 0x6761e
movq %rax, %rbx
movq %rax, %rdi
callq 0x6762e
testq %rax, %rax
je 0x4fe5c
movq (%rax), %rax
testq %rax, %rax
je 0x4fe57
orb $-0x80, 0x4(%rax)
movq %rbx, %rdi
jmp 0x4fe41
movq %rbx, %rdi
callq 0x67656
popq %rbx
jmp 0x5ff22
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_glinit
void polymost_glinit(void)
{
	glfunc.glClearColor(0,0,0,0.5); //Black Background
	glfunc.glDisable(GL_DITHER);

	glfunc.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	glfunc.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

	if (glmultisample > 0 && glinfo.multisample) {
#if (USE_OPENGL != USE_GLES2)
#ifdef GL_NV_multisample_filter_hint
		if (glinfo.nvmultisamplehint)
			glfunc.glHint(GL_MULTISAMPLE_FILTER_HINT_NV, glnvmultisamplehint ? GL_NICEST:GL_FASTEST);
#endif

		glfunc.glEnable(GL_MULTISAMPLE);

		if (glsampleshading > 0 && glinfo.sampleshading) {
			glfunc.glMinSampleShadingARB(1.f);
			glfunc.glEnable(GL_SAMPLE_SHADING_ARB);
		}
#endif
	}

	polymost_loadshaders();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x5aa429(%rip), %rbx    # 0x5fa740
movss 0x2a269(%rip), %xmm3    # 0x7a588
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq *(%rbx)
movl $0xbd0, %edi            # imm = 0xBD0
callq *0x48(%rbx)
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq *0x18(%rbx)
movl $0xcf5, %edi            # imm = 0xCF5
movl $0x1, %esi
callq *0x78(%rbx)
cmpl $0x0, 0x5aa639(%rip)    # 0x5fa98c
jle 0x503af
leaq 0x12def4(%rip), %r14    # 0x17e250
cmpb $0x0, 0x1e(%r14)
je 0x503af
cmpb $0x0, 0x1f(%r14)
je 0x50381
cmpl $0x1, 0x5aa61f(%rip)    # 0x5fa990
movl $0x1102, %esi           # imm = 0x1102
sbbl $0x0, %esi
movl $0x8534, %edi           # imm = 0x8534
callq *0x70(%rbx)
movl $0x809d, %edi           # imm = 0x809D
callq *0x40(%rbx)
cmpl $0x0, 0x5aa604(%rip)    # 0x5fa994
jle 0x503af
cmpb $0x0, 0x20(%r14)
je 0x503af
movss 0x26d73(%rip), %xmm0    # 0x77114
callq *0x90(%rbx)
movl $0x8c36, %edi           # imm = 0x8C36
callq *0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x503b8
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: resizeglcheck
void resizeglcheck (void)
{
	if (glredbluemode < lastglredbluemode) {
		glox1 = -1;
		glfunc.glColorMask(1,1,1,1);
	} else if (glredbluemode != lastglredbluemode) {
		redblueclearcnt = 0;
	}
	lastglredbluemode = glredbluemode;

#if (USE_OPENGL != USE_GLES2)
	if (lastglpolygonmode != glpolygonmode)
	{
		lastglpolygonmode = glpolygonmode;
		switch(glpolygonmode)
		{
			default:
			case 0: glfunc.glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); break;
			case 1: glfunc.glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); break;
			case 2: glfunc.glPolygonMode(GL_FRONT_AND_BACK,GL_POINT); break;
		}
	}
#endif

	if ((glox1 != windowx1) || (gloy1 != windowy1) || (glox2 != windowx2) || (gloy2 != windowy2))
	{
		glox1 = windowx1; gloy1 = windowy1;
		glox2 = windowx2; gloy2 = windowy2;

		glfunc.glViewport(windowx1,yres-(windowy2+1),windowx2-windowx1+1,windowy2-windowy1+1);
	}
}

// Assembly:
pushq %rax
movl 0x5a9f04(%rip), %eax    # 0x5fa980
cmpl 0x5a9f4e(%rip), %eax    # 0x5fa9d0
jge 0x50ab4
movl $0xbf800000, 0x5a9f3a(%rip) # imm = 0xBF800000
leaq 0x5a9cab(%rip), %rax    # 0x5fa740
movl $0x1, %edi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq *0x10(%rax)
movl 0x5a9ece(%rip), %eax    # 0x5fa980
jmp 0x50ac0
je 0x50ac0
movl $0x0, 0x5a9f8c(%rip)    # 0x5faa4c
movl %eax, 0x5a9f0a(%rip)    # 0x5fa9d0
movl 0x5a9ed4(%rip), %eax    # 0x5fa9a0
cmpl %eax, 0x5a9efa(%rip)    # 0x5fa9cc
je 0x50b02
movl %eax, 0x5a9ef2(%rip)    # 0x5fa9cc
leaq 0x5a9c5f(%rip), %rcx    # 0x5fa740
xorl %edx, %edx
cmpl $0x1, %eax
setne %dl
addl $0x1b01, %edx           # imm = 0x1B01
cmpl $0x2, %eax
movl $0x1b00, %esi           # imm = 0x1B00
cmovnel %edx, %esi
movl $0x408, %edi            # imm = 0x408
callq *0x38(%rcx)
leaq 0x381267(%rip), %rax    # 0x3d1d70
movl (%rax), %edi
cvtsi2ss %edi, %xmm0
movss 0x5a9eb1(%rip), %xmm1   # 0x5fa9c8
ucomiss %xmm0, %xmm1
leaq 0x38305f(%rip), %rax    # 0x3d3b80
movl (%rax), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
jne 0x50b2e
jnp 0x50b39
leaq 0x3b74ab(%rip), %rcx    # 0x407fe0
movl (%rcx), %edx
jmp 0x50b84
movss 0x5a9f0f(%rip), %xmm2   # 0x5faa50
ucomiss %xmm1, %xmm2
leaq 0x3b7495(%rip), %rcx    # 0x407fe0
movl (%rcx), %edx
jne 0x50b84
jp 0x50b84
xorps %xmm2, %xmm2
cvtsi2ss %edx, %xmm2
movss 0x5a9ef4(%rip), %xmm3   # 0x5faa54
ucomiss %xmm2, %xmm3
jne 0x50b84
jp 0x50b84
leaq 0x3b7476(%rip), %rcx    # 0x407fe4
xorps %xmm2, %xmm2
cvtsi2ssl (%rcx), %xmm2
movss 0x5a9edb(%rip), %xmm3   # 0x5faa58
ucomiss %xmm2, %xmm3
jne 0x50b84
jnp 0x50be3
xorps %xmm2, %xmm2
cvtsi2ss %edx, %xmm2
movss %xmm0, 0x5a9e35(%rip)   # 0x5fa9c8
movss %xmm1, 0x5a9eb5(%rip)   # 0x5faa50
movss %xmm2, 0x5a9eb1(%rip)   # 0x5faa54
leaq 0x3b743a(%rip), %rcx    # 0x407fe4
movl (%rcx), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0x5a9e9d(%rip)   # 0x5faa58
leaq 0x5a9b7e(%rip), %rsi    # 0x5fa740
movq 0x80(%rsi), %r8
leaq 0x53464(%rip), %r9      # 0xa4034
movl %ecx, %esi
notl %esi
addl (%r9), %esi
subl %edi, %edx
incl %edx
subl %eax, %ecx
incl %ecx
popq %rax
jmpq *%r8
popq %rax
retq