// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/build.c
// Function: draw2dgrid
void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
{
	int i, xp1, yp1, xp2=0, yp2, tempy;

	(void)ange;

	if (gride > 0)
	{
		yp1 = midydim16-mulscale14(posye+editorgridextent,zoome);
		if (yp1 < 0) yp1 = 0;
		yp2 = midydim16-mulscale14(posye-editorgridextent,zoome);
		if (yp2 >= ydim16) yp2 = ydim16-1;

		if ((yp1 < ydim16) && (yp2 >= 0) && (yp2 >= yp1))
		{
			xp1 = halfxdim16-mulscale14(posxe+editorgridextent,zoome);

			for(i=-editorgridextent;i<=editorgridextent;i+=(2048>>gride))
			{
				xp2 = xp1;
				xp1 = halfxdim16-mulscale14(posxe-i,zoome);

				if (xp1 >= xdim) break;
				if (xp1 >= 0)
				{
					if (xp1 != xp2)
					{
						drawline16(xp1,yp1,xp1,yp2,8);
					}
				}
			}
			if ((i >= editorgridextent) && (xp1 < xdim))
				xp2 = xp1;
			if ((xp2 >= 0) && (xp2 < xdim))
			{
				drawline16(xp2,yp1,xp2,yp2,8);
			}
		}

		xp1 = mulscale14(posxe+editorgridextent,zoome);
		xp2 = mulscale14(posxe-editorgridextent,zoome);
		tempy = 0x80000000l;
		for(i=-editorgridextent;i<=editorgridextent;i+=(2048>>gride))
		{
			yp1 = (((posye-i)*zoome)>>14);
			if (yp1 != tempy)
			{
				if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16))
				{
					drawline16(halfxdim16-xp1,midydim16-yp1,halfxdim16-xp2,midydim16-yp1,8);
					tempy = yp1;
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %r8w, %ax
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movl %ecx, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movl $0x0, -0x24(%rbp)
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
jle 0x25ffc
movl 0x190ba1(%rip), %eax    # 0x1b6928
movl %eax, -0x30(%rbp)
movl -0x8(%rbp), %edi
leaq 0xbaef8(%rip), %rax     # 0xe0c8c
addl (%rax), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x25db5
movl $0x0, -0x20(%rbp)
movl 0x190b6d(%rip), %eax    # 0x1b6928
movl %eax, -0x34(%rbp)
movl -0x8(%rbp), %edi
leaq 0xbaec4(%rip), %rax     # 0xe0c8c
subl (%rax), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl 0x1446e3(%rip), %eax    # 0x16a4c8
jl 0x25df3
movl 0x1446db(%rip), %eax    # 0x16a4c8
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
cmpl 0x1446cc(%rip), %eax    # 0x16a4c8
jge 0x25f20
cmpl $0x0, -0x28(%rbp)
jl 0x25f20
movl -0x28(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x25f20
movl 0x190b06(%rip), %eax    # 0x1b6924
movl %eax, -0x38(%rbp)
movl -0x4(%rbp), %edi
leaq 0xbae61(%rip), %rax     # 0xe0c8c
addl (%rax), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
leaq 0xbae44(%rip), %rcx     # 0xe0c8c
subl (%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
leaq 0xbae35(%rip), %rcx     # 0xe0c8c
cmpl (%rcx), %eax
jg 0x25ed1
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl 0x190abd(%rip), %eax    # 0x1b6924
movl %eax, -0x3c(%rbp)
movl -0x4(%rbp), %edi
subl -0x18(%rbp), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, %ecx
movl -0x3c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0x41cec0(%rip), %rcx    # 0x442d4c
cmpl (%rcx), %eax
jl 0x25e92
jmp 0x25ed1
cmpl $0x0, -0x1c(%rbp)
jl 0x25eb9
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x25eb7
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x28(%rbp), %ecx
movl $0x8, %r8d
callq 0x250b0
jmp 0x25eb9
jmp 0x25ebb
movswl -0x12(%rbp), %ecx
movl $0x800, %eax            # imm = 0x800
sarl %cl, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x25e4d
movl -0x18(%rbp), %eax
leaq 0xbadb1(%rip), %rcx     # 0xe0c8c
cmpl (%rcx), %eax
jl 0x25ef3
movl -0x1c(%rbp), %eax
leaq 0x41ce63(%rip), %rcx    # 0x442d4c
cmpl (%rcx), %eax
jge 0x25ef3
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x25f1e
movl -0x24(%rbp), %eax
leaq 0x41ce49(%rip), %rcx    # 0x442d4c
cmpl (%rcx), %eax
jge 0x25f1e
movl -0x24(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl $0x8, %r8d
callq 0x250b0
jmp 0x25f20
movl -0x4(%rbp), %edi
leaq 0xbad62(%rip), %rax     # 0xe0c8c
addl (%rax), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, -0x1c(%rbp)
movl -0x4(%rbp), %edi
leaq 0xbad4b(%rip), %rax     # 0xe0c8c
subl (%rax), %edi
movl -0x10(%rbp), %esi
callq 0x26010
movl %eax, -0x24(%rbp)
movl $0x80000000, -0x2c(%rbp) # imm = 0x80000000
xorl %eax, %eax
leaq 0xbad2e(%rip), %rcx     # 0xe0c8c
subl (%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
leaq 0xbad1f(%rip), %rcx     # 0xe0c8c
cmpl (%rcx), %eax
jg 0x25ffa
movl -0x8(%rbp), %eax
subl -0x18(%rbp), %eax
imull -0x10(%rbp), %eax
sarl $0xe, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0x25fe2
movl -0x20(%rbp), %eax
movl 0x190992(%rip), %ecx    # 0x1b6928
subl 0x14452c(%rip), %ecx    # 0x16a4c8
cmpl %ecx, %eax
jle 0x25fe0
movl -0x20(%rbp), %eax
cmpl 0x19097f(%rip), %eax    # 0x1b6928
jg 0x25fe0
movl 0x190973(%rip), %edi    # 0x1b6924
subl -0x1c(%rbp), %edi
movl 0x19096e(%rip), %esi    # 0x1b6928
subl -0x20(%rbp), %esi
movl 0x190961(%rip), %edx    # 0x1b6924
subl -0x24(%rbp), %edx
movl 0x19095c(%rip), %ecx    # 0x1b6928
subl -0x20(%rbp), %ecx
movl $0x8, %r8d
callq 0x250b0
movl -0x20(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x25fe2
jmp 0x25fe4
movswl -0x12(%rbp), %ecx
movl $0x800, %eax            # imm = 0x800
sarl %cl, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x25f63
jmp 0x25ffc
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)