// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_printext256
int polymost_printext256(int xpos, int ypos, short col, short backcol, const  char *name, char fontsize)
{
	GLfloat tx, ty, txc, tyc, txg, tyg, tyoff, cx, cy;
	int c, indexcnt, vbocnt;
	palette_t colour;
	struct polymostdrawauxcall draw;
	struct polymostvboitem vboitem[80*4];
	GLushort vboindexes[80*6];

	if ((rendmode != 3) || (qsetmode != 200)) return(-1);

	polymost_preparetext();
	setpolymost2dview();	// disables blending, texturing, and depth testing
	glfunc.glDepthMask(GL_FALSE);	// disable writing to the z-buffer
	glfunc.glEnable(GL_BLEND);

	draw.mode = 0;	// Text.

	draw.texture0 = texttexture;

	colour = curpalette[col];
	if (!usegammabrightness) {
		colour.r = britable[curbrightness][ colour.r ];
		colour.g = britable[curbrightness][ colour.g ];
		colour.b = britable[curbrightness][ colour.b ];
	}
	draw.colour.r = colour.r / 255.f;
	draw.colour.g = colour.g / 255.f;
	draw.colour.b = colour.b / 255.f;
	draw.colour.a = 1.f;

	colour = curpalette[min(0, backcol)];
	if (!usegammabrightness) {
		colour.r = britable[curbrightness][ colour.r ];
		colour.g = britable[curbrightness][ colour.g ];
		colour.b = britable[curbrightness][ colour.b ];
	}
	draw.bgcolour.r = colour.r / 255.f;
	draw.bgcolour.g = colour.g / 255.f;
	draw.bgcolour.b = colour.b / 255.f;
	if (backcol >= 0) {
		draw.bgcolour.a = 1.f;
	} else {
		draw.bgcolour.a = 0.f;
	}

	fontsize = min((unsigned)fontsize, 2);
	tyoff = 64.f * (float)fontsize / 256.f;
	cx = (float)textfonts[(unsigned)fontsize].charxsiz;
	cy = (float)textfonts[(unsigned)fontsize].charysiz;
	txc = cx/256.f;		// texture-space width/height of character
	tyc = cy/256.f;
	txg = 8.f/256.f;	// texture-space width/height of cell
	tyg = (fontsize < 2 ? 8.f : 16.f) / 256.f;

	draw.indexes = vboindexes;
	draw.elementvbo = vboitem;

	c = 0;
	indexcnt = vbocnt = 0;
	while (name[c]) {
		for (; name[c] && indexcnt < 80*6; c++) {
			tx = (GLfloat)((unsigned char)name[c]%32)*txg;
			ty = (GLfloat)((unsigned char)name[c]/32)*tyg + tyoff;

			vboindexes[indexcnt + 0] = vbocnt+0;
			vboindexes[indexcnt + 1] = vbocnt+1;
			vboindexes[indexcnt + 2] = vbocnt+2;
			vboindexes[indexcnt + 3] = vbocnt+0;
			vboindexes[indexcnt + 4] = vbocnt+2;
			vboindexes[indexcnt + 5] = vbocnt+3;

			vboitem[vbocnt + 0].v.x = (GLfloat)xpos;
			vboitem[vbocnt + 0].v.y = (GLfloat)ypos;
			vboitem[vbocnt + 0].v.z = 0.f;
			vboitem[vbocnt + 0].t.s = tx;
			vboitem[vbocnt + 0].t.t = ty;

			vboitem[vbocnt + 1].v.x = (GLfloat)xpos+cx;
			vboitem[vbocnt + 1].v.y = (GLfloat)ypos;
			vboitem[vbocnt + 1].v.z = 0.f;
			vboitem[vbocnt + 1].t.s = tx+txc;
			vboitem[vbocnt + 1].t.t = ty;

			vboitem[vbocnt + 2].v.x = (GLfloat)xpos+cx;
			vboitem[vbocnt + 2].v.y = (GLfloat)ypos+cy;
			vboitem[vbocnt + 2].v.z = 0.f;
			vboitem[vbocnt + 2].t.s = tx+txc;
			vboitem[vbocnt + 2].t.t = ty+tyc;

			vboitem[vbocnt + 3].v.x = (GLfloat)xpos;
			vboitem[vbocnt + 3].v.y = (GLfloat)ypos+cy;
			vboitem[vbocnt + 3].v.z = 0.f;
			vboitem[vbocnt + 3].t.s = tx;
			vboitem[vbocnt + 3].t.t = ty+tyc;

			indexcnt += 6;
			vbocnt += 4;
			xpos += textfonts[(unsigned)fontsize].charxsiz;
		}

		draw.indexcount = indexcnt;
		draw.elementcount = vbocnt;

		polymost_drawaux_glcall(GL_TRIANGLES, &draw);

		indexcnt = vbocnt = 0;
	}

	glfunc.glDepthMask(GL_TRUE);	// re-enable writing to the z-buffer

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d80, %rsp           # imm = 0x1D80
movb %r9b, %al
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movw %dx, -0xe(%rbp)
movw %cx, -0x10(%rbp)
movq %r8, -0x18(%rbp)
movb %al, -0x19(%rbp)
cmpl $0x3, 0x563196(%rip)    # 0x5ed920
jne 0x8a79b
leaq 0x16adf5(%rip), %rax    # 0x1f5588
cmpl $0xc8, (%rax)
je 0x8a7a7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8af8f
callq 0x8afa0
callq 0x5a810
xorl %edi, %edi
leaq 0x562f56(%rip), %rax    # 0x5ed710
callq *0xa0(%rax)
movl $0xbe2, %edi            # imm = 0xBE2
leaq 0x562f44(%rip), %rax    # 0x5ed710
callq *0x40(%rax)
movl $0x0, -0x74(%rbp)
movl 0x563238(%rip), %eax    # 0x5eda14
movl %eax, -0x98(%rbp)
movswq -0xe(%rbp), %rcx
leaq 0x3e6a12(%rip), %rax    # 0x471200
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
leaq 0x56481(%rip), %rax     # 0xe0c7c
cmpl $0x0, (%rax)
jne 0x8a866
leaq 0x16ad5d(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e71ef(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x50(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x50(%rbp)
leaq 0x16ad3b(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e71cd(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x4f(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x4f(%rbp)
leaq 0x16ad19(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e71ab(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x4e(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x4e(%rbp)
movzbl -0x50(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bd62(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x94(%rbp)
movzbl -0x4f(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bd46(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x90(%rbp)
movzbl -0x4e(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bd2a(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x8c(%rbp)
movss 0x2853e(%rip), %xmm0    # 0xb2e00
movss %xmm0, -0x88(%rbp)
movswl -0x10(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x8a8de
xorl %eax, %eax
movl %eax, -0x1d64(%rbp)
jmp 0x8a8e8
movswl -0x10(%rbp), %eax
movl %eax, -0x1d64(%rbp)
movl -0x1d64(%rbp), %eax
movslq %eax, %rcx
leaq 0x3e6908(%rip), %rax    # 0x471200
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
leaq 0x56377(%rip), %rax     # 0xe0c7c
cmpl $0x0, (%rax)
jne 0x8a970
leaq 0x16ac53(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e70e5(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x50(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x50(%rbp)
leaq 0x16ac31(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e70c3(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x4f(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x4f(%rbp)
leaq 0x16ac0f(%rip), %rax    # 0x1f5564
movslq (%rax), %rcx
leaq 0x3e70a1(%rip), %rax    # 0x471a00
shlq $0x8, %rcx
addq %rcx, %rax
movzbl -0x4e(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x4e(%rbp)
movzbl -0x50(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bc58(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x84(%rbp)
movzbl -0x4f(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bc3c(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x80(%rbp)
movzbl -0x4e(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss 0x2bc23(%rip), %xmm1    # 0xb65d8
divss %xmm1, %xmm0
movss %xmm0, -0x7c(%rbp)
movswl -0x10(%rbp), %eax
cmpl $0x0, %eax
jl 0x8a9d6
movss 0x28431(%rip), %xmm0    # 0xb2e00
movss %xmm0, -0x78(%rbp)
jmp 0x8a9de
xorps %xmm0, %xmm0
movss %xmm0, -0x78(%rbp)
movsbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jae 0x8a9f3
movsbl -0x19(%rbp), %eax
movl %eax, -0x1d68(%rbp)
jmp 0x8aa00
movl $0x2, %eax
movl %eax, -0x1d68(%rbp)
jmp 0x8aa00
movl -0x1d68(%rbp), %eax
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %eax
cvtsi2ss %eax, %xmm1
movss 0x2bbf3(%rip), %xmm0    # 0xb660c
mulss %xmm1, %xmm0
movss 0x2bbd7(%rip), %xmm1    # 0xb65fc
divss %xmm1, %xmm0
movss %xmm0, -0x38(%rbp)
movsbl -0x19(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x440f3(%rip), %rax     # 0xceb30
shlq $0x5, %rcx
addq %rcx, %rax
cvtsi2ssl 0x8(%rax), %xmm0
movss %xmm0, -0x3c(%rbp)
movsbl -0x19(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x440d3(%rip), %rax     # 0xceb30
shlq $0x5, %rcx
addq %rcx, %rax
cvtsi2ssl 0xc(%rax), %xmm0
movss %xmm0, -0x40(%rbp)
movss -0x3c(%rbp), %xmm0
movss 0x2bb81(%rip), %xmm1    # 0xb65fc
divss %xmm1, %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x40(%rbp), %xmm0
movss 0x2bb6b(%rip), %xmm1    # 0xb65fc
divss %xmm1, %xmm0
movss %xmm0, -0x2c(%rbp)
movss 0x2bb66(%rip), %xmm0    # 0xb6608
movss %xmm0, -0x30(%rbp)
movsbl -0x19(%rbp), %eax
movss 0x2bb4d(%rip), %xmm0    # 0xb6600
movss 0x2bb49(%rip), %xmm1    # 0xb6604
movss %xmm1, -0x1d70(%rbp)
cmpl $0x2, %eax
movss %xmm0, -0x1d6c(%rbp)
jl 0x8aae0
movss -0x1d70(%rbp), %xmm0
movss %xmm0, -0x1d6c(%rbp)
movss -0x1d6c(%rbp), %xmm0
movss 0x2bb0c(%rip), %xmm1    # 0xb65fc
divss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
leaq -0x1d60(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x19a0(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x8af76
jmp 0x8ab38
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x1d71(%rbp)
je 0x8ab61
cmpl $0x1e0, -0x48(%rbp)     # imm = 0x1E0
setl %al
movb %al, -0x1d71(%rbp)
movb -0x1d71(%rbp), %al
testb $0x1, %al
jne 0x8ab70
jmp 0x8af46
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cvtsi2ss %edx, %xmm0
mulss -0x30(%rbp), %xmm0
movss %xmm0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cvtsi2ss %eax, %xmm0
movss -0x34(%rbp), %xmm2
movss -0x38(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x0, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x1, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x2, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x3, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x4, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movw %ax, %cx
movl -0x48(%rbp), %eax
addl $0x5, %eax
cltq
movw %cx, -0x1d60(%rbp,%rax,2)
cvtsi2ssl -0x8(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
cvtsi2ssl -0xc(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movss -0x20(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movss -0x24(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x0, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
cvtsi2ssl -0x8(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
cvtsi2ssl -0xc(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movss -0x20(%rbp), %xmm0
addss -0x28(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movss -0x24(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
cvtsi2ssl -0x8(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
cvtsi2ssl -0xc(%rbp), %xmm0
addss -0x40(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movss -0x20(%rbp), %xmm0
addss -0x28(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movss -0x24(%rbp), %xmm0
addss -0x2c(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
cvtsi2ssl -0x8(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
cvtsi2ssl -0xc(%rbp), %xmm0
addss -0x40(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movss -0x20(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movss -0x24(%rbp), %xmm0
addss -0x2c(%rbp), %xmm0
movl -0x4c(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq -0x19a0(%rbp), %rax
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
movl -0x48(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x4c(%rbp)
movsbl -0x19(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x43c08(%rip), %rax     # 0xceb30
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x8ab38
movl -0x48(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x60(%rbp)
movl $0x4, %edi
leaq -0x98(%rbp), %rsi
callq 0x8a450
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
jmp 0x8ab24
movl $0x1, %edi
leaq 0x56278e(%rip), %rax    # 0x5ed710
callq *0xa0(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1d80, %rsp           # imm = 0x1D80
popq %rbp
retq
nopl (%rax,%rax)