// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: initmosts
static void initmosts (double *px, double *py, int n)
{
	int i, j, k, imin;

	vcnt = 1; //0 is dummy solid node

	if (n < 3) return;
	imin = (px[1] < px[0]);
	for(i=n-1;i>=2;i--) if (px[i] < px[imin]) imin = i;


	vsp[vcnt].x = px[imin];
	vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[imin];
	vcnt++;
	i = imin+1; if (i >= n) i = 0;
	j = imin-1; if (j < 0) j = n-1;
	do
	{
		if (px[i] < px[j])
		{
			if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--;
			vsp[vcnt].x = px[i];
			vsp[vcnt].cy[0] = py[i];
			k = j+1; if (k >= n) k = 0;
				//(px[k],py[k])
				//(px[i],?)
				//(px[j],py[j])
			vsp[vcnt].fy[0] = (px[i]-px[k])*(py[j]-py[k])/(px[j]-px[k]) + py[k];
			vcnt++;
			i++; if (i >= n) i = 0;
		}
		else if (px[j] < px[i])
		{
			if ((vcnt > 1) && (px[j] <= vsp[vcnt-1].x)) vcnt--;
			vsp[vcnt].x = px[j];
			vsp[vcnt].fy[0] = py[j];
			k = i-1; if (k < 0) k = n-1;
				//(px[k],py[k])
				//(px[j],?)
				//(px[i],py[i])
			vsp[vcnt].cy[0] = (px[j]-px[k])*(py[i]-py[k])/(px[i]-px[k]) + py[k];
			vcnt++;
			j--; if (j < 0) j = n-1;
		}
		else
		{
			if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--;
			vsp[vcnt].x = px[i];
			vsp[vcnt].cy[0] = py[i];
			vsp[vcnt].fy[0] = py[j];
			vcnt++;
			i++; if (i >= n) i = 0; if (i == j) break;
			j--; if (j < 0) j = n-1;
		}
	} while (i != j);
	if (px[i] > vsp[vcnt-1].x)
	{
		vsp[vcnt].x = px[i];
		vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[i];
		vcnt++;
	}


	for(i=0;i<vcnt;i++)
	{
		vsp[i].cy[1] = vsp[i+1].cy[0]; vsp[i].ctag = i;
		vsp[i].fy[1] = vsp[i+1].fy[0]; vsp[i].ftag = i;
		vsp[i].n = i+1; vsp[i].p = i-1;
	}
	vsp[vcnt-1].n = 0; vsp[0].p = vcnt-1;
	gtag = vcnt;

		//VSPMAX-1 is dummy empty node
	for(i=vcnt;i<VSPMAX;i++) { vsp[i].n = i+1; vsp[i].p = i-1; }
	vsp[VSPMAX-1].n = vcnt; vsp[vcnt].p = VSPMAX-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x1, 0x587f37(%rip)    # 0x601bb0
cmpl $0x3, -0x14(%rbp)
jge 0x79c84
jmp 0x7a42e
movq -0x8(%rbp), %rax
movsd 0x8(%rax), %xmm1
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jl 0x79ce6
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x79cd9
movl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x79cdb
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x79cad
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587eb2(%rip), %rcx    # 0x601bb0
leaq 0x587ebb(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587e88(%rip), %rcx    # 0x601bb0
leaq 0x587e91(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movslq 0x587e6e(%rip), %rcx    # 0x601bb0
leaq 0x587e77(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl 0x587e55(%rip), %eax    # 0x601bb0
addl $0x1, %eax
movl %eax, 0x587e4c(%rip)    # 0x601bb0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x79d7c
movl $0x0, -0x18(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x79d94
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x79d96
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x79f21
cmpl $0x1, 0x587def(%rip)    # 0x601bb0
jle 0x79e07
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movl 0x587dda(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x587ddd(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x79e07
movl 0x587db2(%rip), %eax    # 0x601bb0
addl $-0x1, %eax
movl %eax, 0x587da9(%rip)    # 0x601bb0
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587d91(%rip), %rcx    # 0x601bb0
leaq 0x587d9a(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587d67(%rip), %rcx    # 0x601bb0
leaq 0x587d70(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x79e74
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587cce(%rip), %rcx    # 0x601bb0
leaq 0x587cd7(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movl 0x587cb5(%rip), %eax    # 0x601bb0
addl $0x1, %eax
movl %eax, 0x587cac(%rip)    # 0x601bb0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x79f1c
movl $0x0, -0x18(%rbp)
jmp 0x7a1c6
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7a0ac
cmpl $0x1, 0x587c64(%rip)    # 0x601bb0
jle 0x79f92
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movl 0x587c4f(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x587c52(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x79f92
movl 0x587c27(%rip), %eax    # 0x601bb0
addl $-0x1, %eax
movl %eax, 0x587c1e(%rip)    # 0x601bb0
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587c06(%rip), %rcx    # 0x601bb0
leaq 0x587c0f(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587bdc(%rip), %rcx    # 0x601bb0
leaq 0x587be5(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x79fff
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587b43(%rip), %rcx    # 0x601bb0
leaq 0x587b4c(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl 0x587b2a(%rip), %eax    # 0x601bb0
addl $0x1, %eax
movl %eax, 0x587b21(%rip)    # 0x601bb0
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x7a0a7
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7a1c4
cmpl $0x1, 0x587afd(%rip)    # 0x601bb0
jle 0x7a0f9
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movl 0x587ae8(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x587aeb(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x7a0f9
movl 0x587ac0(%rip), %eax    # 0x601bb0
addl $-0x1, %eax
movl %eax, 0x587ab7(%rip)    # 0x601bb0
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587a9f(%rip), %rcx    # 0x601bb0
leaq 0x587aa8(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587a75(%rip), %rcx    # 0x601bb0
leaq 0x587a7e(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587a4a(%rip), %rcx    # 0x601bb0
leaq 0x587a53(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movl 0x587a31(%rip), %eax    # 0x601bb0
addl $0x1, %eax
movl %eax, 0x587a28(%rip)    # 0x601bb0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x7a1a0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x7a1aa
jmp 0x7a1d4
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x7a1c2
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7a1c4
jmp 0x7a1c6
jmp 0x7a1c8
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x79d96
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movl 0x5879c9(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x5879cc(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7a287
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x58798f(%rip), %rcx    # 0x601bb0
leaq 0x587998(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x587965(%rip), %rcx    # 0x601bb0
leaq 0x58796e(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movslq 0x58794b(%rip), %rcx    # 0x601bb0
leaq 0x587954(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movl 0x587932(%rip), %eax    # 0x601bb0
addl $0x1, %eax
movl %eax, 0x587929(%rip)    # 0x601bb0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x587919(%rip), %eax    # 0x601bb0
jge 0x7a377
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x587913(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
movslq -0x18(%rbp), %rcx
leaq 0x5878fc(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movl -0x18(%rbp), %ecx
movslq -0x18(%rbp), %rdx
leaq 0x5878e2(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x5878c8(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
movslq -0x18(%rbp), %rcx
leaq 0x5878b1(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x10(%rax)
movl -0x18(%rbp), %ecx
movslq -0x18(%rbp), %rdx
leaq 0x587897(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x24(%rax)
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq -0x18(%rbp), %rdx
leaq 0x58787c(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq -0x18(%rbp), %rdx
leaq 0x587861(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7a28e
movl 0x587833(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x587836(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
movl 0x587812(%rip), %eax    # 0x601bb0
subl $0x1, %eax
movl %eax, 0x587831(%rip)    # 0x601bd8
movl 0x587803(%rip), %eax    # 0x601bb0
movl %eax, 0x5af80d(%rip)    # 0x629bc0
movl 0x5877f7(%rip), %eax    # 0x601bb0
movl %eax, -0x18(%rbp)
cmpl $0x1000, -0x18(%rbp)    # imm = 0x1000
jge 0x7a406
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq -0x18(%rbp), %rdx
leaq 0x5877ea(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq -0x18(%rbp), %rdx
leaq 0x5877cf(%rip), %rax    # 0x601bc0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7a3bc
movl 0x5877a4(%rip), %eax    # 0x601bb0
movl %eax, 0x5af79a(%rip)    # 0x629bac
movslq 0x587797(%rip), %rcx    # 0x601bb0
leaq 0x5877a0(%rip), %rax    # 0x601bc0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xfff, 0x18(%rax)      # imm = 0xFFF
popq %rbp
retq