// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_drawline256
int polymost_drawline256(int x1, int y1, int x2, int y2, unsigned char col)
{
	palette_t colour;
	struct polymostdrawauxcall draw;
	struct polymostvboitem vboitem[2];

	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 = 2;	// Solid colour.

	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;

	vboitem[0].v.x = (GLfloat)(x1+2048)/4096.f;
	vboitem[0].v.y = (GLfloat)(y1+2048)/4096.f;
	vboitem[0].v.z = 0.f;

	vboitem[1].v.x = (GLfloat)(x2+2048)/4096.f;
	vboitem[1].v.y = (GLfloat)(y2+2048)/4096.f;
	vboitem[1].v.z = 0.f;

	draw.indexcount = 2;
	draw.indexes = NULL;
	draw.elementcount = 2;
	draw.elementvbo = vboitem;

	polymost_drawaux_glcall(GL_LINES, &draw);

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

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $0x3, 0x59fc3e(%rip)    # 0x5f3950
pushq $-0x1
popq %rbx
jne 0x53e80
leaq 0x15dd06(%rip), %rax    # 0x1b1a28
cmpl $0xc8, (%rax)
jne 0x53e80
movl %r8d, %r13d
movl %edx, %ebp
movl %esi, %r12d
movl %edi, %r15d
movl %ecx, 0x4(%rsp)
callq 0x53ace
callq 0x39c49
leaq 0x59f9f2(%rip), %r14    # 0x5f3740
xorl %ebx, %ebx
xorl %edi, %edi
callq *0xa0(%r14)
movl $0xbe2, %edi            # imm = 0xBE2
callq *0x40(%r14)
movl $0x2, 0x2c(%rsp)
movzbl %r13b, %eax
leaq 0x3dbc3b(%rip), %rcx    # 0x42f9b0
movd (%rcx,%rax,4), %xmm0
movb 0x2(%rcx,%rax,4), %al
leaq 0x49a07(%rip), %rcx     # 0x9d78c
cmpl $0x0, (%rcx)
jne 0x53dc8
movzbl %al, %eax
leaq 0x15dc70(%rip), %rcx    # 0x1b1a04
movslq (%rcx), %rcx
movd %xmm0, %edx
movl $0xff, %esi
movl %edx, %edi
andl %esi, %edi
shlq $0x8, %rcx
addq 0x38221(%rip), %rcx     # 0x8bfd0
movzbl (%rdi,%rcx), %edi
shrl $0x8, %edx
andl %esi, %edx
movb (%rax,%rcx), %al
movzbl (%rdx,%rcx), %ecx
shll $0x8, %ecx
orl %edi, %ecx
movd %ecx, %xmm0
pxor %xmm1, %xmm1
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
cvtdq2ps %xmm0, %xmm0
divps 0x1b702(%rip), %xmm0    # 0x6f4e0
leaq 0x8(%rsp), %rsi
movlps %xmm0, 0x4(%rsi)
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
divss 0x1b52a(%rip), %xmm0    # 0x6f320
movss %xmm0, 0xc(%rsi)
movd %r12d, %xmm0
movd %r15d, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movdqa 0x1b6ef(%rip), %xmm0    # 0x6f500
paddd %xmm0, %xmm1
cvtdq2ps %xmm1, %xmm1
movaps 0x1b6f1(%rip), %xmm2    # 0x6f510
mulps %xmm2, %xmm1
leaq 0x50(%rsp), %rax
movlps %xmm1, (%rax)
andl $0x0, 0x8(%rax)
movl $0x3f800000, 0x10(%rsi) # imm = 0x3F800000
movd 0x4(%rsp), %xmm1
movd %ebp, %xmm3
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
paddd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm0
mulps %xmm2, %xmm0
movlps %xmm0, 0x14(%rax)
andl $0x0, 0x1c(%rax)
pushq $0x2
popq %rcx
movl %ecx, 0x28(%rsi)
andq $0x0, 0x30(%rsi)
movl %ecx, 0x38(%rsi)
movq %rax, 0x40(%rsi)
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0x534cc
movl %ebp, %edi
leaq 0x59f8c6(%rip), %rax    # 0x5f3740
callq *0xa0(%rax)
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq