// File: FreeSlave[P]vhlt/hlbsp/brink.cpp
// Function: CalculateCircle(bbrink_t*, bcircle_t*)
bool CalculateCircle (bbrink_t *b, bcircle_t *c)
{
	VectorCopy (b->direction, c->axis);
	if (!VectorNormalize (c->axis))
	{
		return false;
	}
	VectorCopy ((*b->nodes)[0].plane->normal, c->basenormal);

	int side, i;
	for (side = 0; side < 2; side++)
	{
		vec3_t facing;
		CrossProduct (c->basenormal, c->axis, facing);
		VectorScale (facing, side? -1: 1, facing);
		if (VectorNormalize (facing) < 1 - 0.01)
		{
			return false;
		}

		// sort the wedges
		c->numwedges[side] = 1;
		c->wedges[side][0].nodenum = (*b->nodes)[0].children[side];
		c->surfaces[side][0].nodenum = 0;
		c->surfaces[side][0].nodeside = !side;
		while (1)
		{
			for (i = 0; i < c->numwedges[side]; i++)
			{
				int nodenum = c->wedges[side][i].nodenum;
				bbrinknode_t *node = &(*b->nodes)[nodenum];
				if (!node->isleaf)
				{
					memmove (&c->wedges[side][i + 1], &c->wedges[side][i], (c->numwedges[side] - i) * sizeof (bwedge_t));
					memmove (&c->surfaces[side][i + 2], &c->surfaces[side][i + 1], (c->numwedges[side] - 1 - i) * sizeof (bsurface_t));
					c->numwedges[side]++;
					bool flipnode = (DotProduct (node->plane->normal, facing) < 0);
					c->wedges[side][i].nodenum = node->children[flipnode];
					c->wedges[side][i + 1].nodenum = node->children[!flipnode];
					c->surfaces[side][i + 1].nodenum = nodenum;
					c->surfaces[side][i + 1].nodeside = flipnode;
					break;
				}
			}
			if (i == c->numwedges[side])
			{
				break;
			}
		}
	}
	if ((c->numwedges[0] + c->numwedges[1]) * 2 - 1 != b->numnodes)
	{
		PrintOnce ("CalculateCircle: internal error 1");
		hlassume (false, assume_first);
	}

	// fill in other information
	for (side = 0; side < 2; side++)
	{
		for (i = 0; i < c->numwedges[side]; i++)
		{
			bwedge_t *w = &c->wedges[side][i];
			bbrinknode_t *node = &(*b->nodes)[w->nodenum];
			if (!node->clipnode->isleaf)
			{
				PrintOnce ("CalculateCircle: internal error: not leaf");
				hlassume (false, assume_first);
			}
			w->content = node->content;
			w->prev = &c->surfaces[side][i];
			w->next = (i == c->numwedges[side] - 1)? &c->surfaces[!side][0]: &c->surfaces[side][i + 1];
			w->prev->next = w;
			w->next->prev = w;
		}
		for (i = 0; i < c->numwedges[side]; i++)
		{
			bsurface_t *s = &c->surfaces[side][i];
			bbrinknode_t *node = &(*b->nodes)[s->nodenum];
			VectorScale (node->plane->normal, s->nodeside? -1: 1, s->normal);
		}
	}

	// check the normals
	for (side = 0; side < 2; side++)
	{
		for (i = 0; i < c->numwedges[side]; i++)
		{
			bwedge_t *w = &c->wedges[side][i];
			if (i == 0 && i == c->numwedges[side] - 1) // 180 degrees
			{
				continue;
			}
			vec3_t v;
			CrossProduct (w->prev->normal, w->next->normal, v);
			if (!VectorNormalize (v) ||
				DotProduct (v, c->axis) < 1 - 0.01)
			{
				return false;
			}
		}
	}
	return true;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x98(%rsp), %rax
movsd 0x30(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x98(%rsp), %rax
movsd 0x38(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x98(%rsp), %rax
movsd 0x40(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movq 0x90(%rsp), %rdi
callq 0x11bc0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x16b19
jp 0x16b19
movb $0x0, 0xa7(%rsp)
jmp 0x1776b
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19c00
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19c00
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x20(%rax)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19c00
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x28(%rax)
movl $0x0, 0x8c(%rsp)
cmpl $0x2, 0x8c(%rsp)
jge 0x17196
movq 0x90(%rsp), %rax
movsd 0x20(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd 0x10(%rax), %xmm2
movq 0x90(%rsp), %rax
movsd 0x28(%rax), %xmm1
movq 0x90(%rsp), %rax
mulsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x90(%rsp), %rax
movsd 0x28(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd (%rax), %xmm2
movq 0x90(%rsp), %rax
movsd 0x18(%rax), %xmm1
movq 0x90(%rsp), %rax
mulsd 0x10(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x90(%rsp), %rax
movsd 0x18(%rax), %xmm0
movq 0x90(%rsp), %rax
movsd 0x8(%rax), %xmm2
movq 0x90(%rsp), %rax
movsd 0x20(%rax), %xmm1
movq 0x90(%rsp), %rax
mulsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x70(%rsp), %xmm0
movl 0x8c(%rsp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x78(%rsp), %xmm0
movl 0x8c(%rsp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x80(%rsp), %xmm0
movl 0x8c(%rsp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x11bc0
movaps %xmm0, %xmm1
movsd 0x228b6(%rip), %xmm0    # 0x39610
ucomisd %xmm1, %xmm0
jbe 0x16d6d
movb $0x0, 0xa7(%rsp)
jmp 0x1776b
movq 0x90(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movl $0x1, 0x30(%rax,%rcx,4)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19c00
movslq 0x8c(%rsp), %rcx
movl 0x10(%rax,%rcx,4), %ecx
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rdx
imulq $0x600, %rdx, %rdx      # imm = 0x600
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rcx
imulq $0xc00, %rcx, %rcx      # imm = 0xC00
addq %rcx, %rax
movl $0x0, 0x18(%rax)
cmpl $0x0, 0x8c(%rsp)
setne %cl
xorb $-0x1, %cl
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rdx
imulq $0xc00, %rdx, %rdx      # imm = 0xC00
addq %rdx, %rax
andb $0x1, %cl
movb %cl, 0x1c(%rax)
movl $0x0, 0x88(%rsp)
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
cmpl 0x30(%rcx,%rdx,4), %eax
jge 0x1715a
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rcx
imulq $0x600, %rcx, %rcx      # imm = 0x600
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, 0x6c(%rsp)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
movslq 0x6c(%rsp), %rsi
callq 0x19c00
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
testb $0x1, (%rax)
jne 0x17142
movq 0x90(%rsp), %rdi
addq $0x38, %rdi
movslq 0x8c(%rsp), %rax
imulq $0x600, %rax, %rax      # imm = 0x600
addq %rax, %rdi
movl 0x88(%rsp), %eax
addl $0x1, %eax
cltq
imulq $0x18, %rax, %rax
addq %rax, %rdi
movq 0x90(%rsp), %rsi
addq $0x38, %rsi
movslq 0x8c(%rsp), %rax
imulq $0x600, %rax, %rax      # imm = 0x600
addq %rax, %rsi
movslq 0x88(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
movq 0x90(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movl 0x30(%rax,%rcx,4), %eax
subl 0x88(%rsp), %eax
cltq
imulq $0x18, %rax, %rdx
callq 0x44d0
movq 0x90(%rsp), %rdi
addq $0xc38, %rdi            # imm = 0xC38
movslq 0x8c(%rsp), %rax
imulq $0xc00, %rax, %rax      # imm = 0xC00
addq %rax, %rdi
movl 0x88(%rsp), %eax
addl $0x2, %eax
cltq
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq 0x90(%rsp), %rsi
addq $0xc38, %rsi            # imm = 0xC38
movslq 0x8c(%rsp), %rax
imulq $0xc00, %rax, %rax      # imm = 0xC00
addq %rax, %rsi
movl 0x88(%rsp), %eax
addl $0x1, %eax
cltq
imulq $0x30, %rax, %rax
addq %rax, %rsi
movq 0x90(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movl 0x30(%rax,%rcx,4), %eax
subl $0x1, %eax
subl 0x88(%rsp), %eax
cltq
imulq $0x30, %rax, %rdx
callq 0x44d0
movq 0x90(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movl 0x30(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x30(%rax,%rcx,4)
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movsd 0x70(%rsp), %xmm2
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm1
mulsd 0x78(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm1
movsd 0x80(%rsp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movb %al, 0x5f(%rsp)
movq 0x60(%rsp), %rax
movb 0x5f(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl 0x10(%rax,%rcx,4), %ecx
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rdx
imulq $0x600, %rdx, %rdx      # imm = 0x600
addq %rdx, %rax
movslq 0x88(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq 0x60(%rsp), %rax
movb 0x5f(%rsp), %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl 0x10(%rax,%rcx,4), %ecx
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rdx
imulq $0x600, %rdx, %rdx      # imm = 0x600
addq %rdx, %rax
movl 0x88(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl 0x6c(%rsp), %ecx
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rdx
imulq $0xc00, %rdx, %rdx      # imm = 0xC00
addq %rdx, %rax
movl 0x88(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movb 0x5f(%rsp), %cl
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rdx
imulq $0xc00, %rdx, %rdx      # imm = 0xC00
addq %rdx, %rax
movl 0x88(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
andb $0x1, %cl
movb %cl, 0x1c(%rax)
jmp 0x1715a
jmp 0x17144
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x16e2d
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
cmpl 0x30(%rcx,%rdx,4), %eax
jne 0x17179
jmp 0x1717e
jmp 0x16e22
jmp 0x17180
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x16ba4
movq 0x90(%rsp), %rax
movl 0x30(%rax), %eax
movq 0x90(%rsp), %rcx
addl 0x34(%rcx), %eax
shll %eax
subl $0x1, %eax
movq 0x98(%rsp), %rcx
cmpl 0x48(%rcx), %eax
je 0x171d5
leaq 0x22ad9(%rip), %rdi     # 0x39c9e
movb $0x0, %al
callq 0xb840
xorl %esi, %esi
movl %esi, %edi
callq 0xbe90
movl $0x0, 0x8c(%rsp)
cmpl $0x2, 0x8c(%rsp)
jge 0x17501
movl $0x0, 0x88(%rsp)
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
cmpl 0x30(%rcx,%rdx,4), %eax
jge 0x173ae
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rcx
imulq $0x600, %rcx, %rcx      # imm = 0x600
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x50(%rsp)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x50(%rsp), %rax
movslq 0x4(%rax), %rsi
callq 0x19c00
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
testb $0x1, (%rax)
jne 0x17290
leaq 0x22a40(%rip), %rdi     # 0x39cc0
movb $0x0, %al
callq 0xb840
xorl %esi, %esi
movl %esi, %edi
callq 0xbe90
movq 0x48(%rsp), %rax
movl 0x18(%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x90(%rsp), %rcx
addq $0xc38, %rcx            # imm = 0xC38
movslq 0x8c(%rsp), %rax
imulq $0xc00, %rax, %rax      # imm = 0xC00
addq %rax, %rcx
movslq 0x88(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
movl 0x30(%rcx,%rdx,4), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1732d
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
cmpl $0x0, 0x8c(%rsp)
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
imulq $0xc00, %rcx, %rcx      # imm = 0xC00
addq %rcx, %rax
movq %rax, 0x8(%rsp)
jmp 0x17366
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rcx
imulq $0xc00, %rcx, %rcx      # imm = 0xC00
addq %rcx, %rax
movl 0x88(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rcx
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x50(%rsp), %rcx
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x20(%rax)
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x171f9
movl $0x0, 0x88(%rsp)
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
cmpl 0x30(%rcx,%rdx,4), %eax
jge 0x174e9
movq 0x90(%rsp), %rax
addq $0xc38, %rax            # imm = 0xC38
movslq 0x8c(%rsp), %rcx
imulq $0xc00, %rcx, %rcx      # imm = 0xC00
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x98(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x40(%rsp), %rax
movslq 0x18(%rax), %rsi
callq 0x19c00
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x40(%rsp), %rax
movb 0x1c(%rax), %dl
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm0
movq 0x40(%rsp), %rax
movb 0x1c(%rax), %dl
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm0
movq 0x40(%rsp), %rax
movb 0x1c(%rax), %dl
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x173b9
jmp 0x174eb
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x171e0
movl $0x0, 0x8c(%rsp)
cmpl $0x2, 0x8c(%rsp)
jge 0x17763
movl $0x0, 0x88(%rsp)
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
cmpl 0x30(%rcx,%rdx,4), %eax
jge 0x1774b
movq 0x90(%rsp), %rax
addq $0x38, %rax
movslq 0x8c(%rsp), %rcx
imulq $0x600, %rcx, %rcx      # imm = 0x600
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x88(%rsp)
jne 0x175a9
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movslq 0x8c(%rsp), %rdx
movl 0x30(%rcx,%rdx,4), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x175a9
jmp 0x17735
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm0
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movsd 0x10(%rax), %xmm2
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm1
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
mulsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x10(%rax), %xmm0
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movsd (%rax), %xmm2
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm1
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
mulsd 0x10(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movsd 0x8(%rax), %xmm2
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm1
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
mulsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x11bc0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x176d3
jp 0x176d3
jmp 0x17729
movsd 0x10(%rsp), %xmm0
movq 0x90(%rsp), %rax
movsd (%rax), %xmm2
movsd 0x18(%rsp), %xmm1
movq 0x90(%rsp), %rax
mulsd 0x8(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x20(%rsp), %xmm1
movq 0x90(%rsp), %rax
movsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x21eed(%rip), %xmm0    # 0x39610
ucomisd %xmm1, %xmm0
jbe 0x17733
movb $0x0, 0xa7(%rsp)
jmp 0x1776b
jmp 0x17735
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x17525
jmp 0x1774d
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x1750c
movb $0x1, 0xa7(%rsp)
movb 0xa7(%rsp), %al
andb $0x1, %al
addq $0xa8, %rsp
retq
nopl (%rax)