void PolygonD_Divide(int innumpoints, const double *inpoints,
                     double planenormalx, double planenormaly,
                     double planenormalz, double planedist, double epsilon,
                     int outfrontmaxpoints, double *outfrontpoints,
                     int *neededfrontpoints, int outbackmaxpoints,
                     double *outbackpoints, int *neededbackpoints,
                     int *oncountpointer) {
  int i = 0, frontcount = 0, backcount = 0, oncount = 0;
  const double *n, *p;
  double frac, pdist, ndist;
  if (innumpoints) {
    n = inpoints;
    ndist = n[0] * planenormalx + n[1] * planenormaly + n[2] * planenormalz -
            planedist;
    for (i = 0; i < innumpoints; i++) {
      p = n;
      pdist = ndist;
      n = inpoints + ((i + 1) < innumpoints ? (i + 1) : 0) * 3;
      ndist = n[0] * planenormalx + n[1] * planenormaly + n[2] * planenormalz -
              planedist;
      if (pdist >= -epsilon) {
        if (pdist <= epsilon)
          oncount++;
        if (frontcount < outfrontmaxpoints) {
          *outfrontpoints++ = p[0];
          *outfrontpoints++ = p[1];
          *outfrontpoints++ = p[2];
        }
        frontcount++;
      }
      if (pdist <= epsilon) {
        if (backcount < outbackmaxpoints) {
          *outbackpoints++ = p[0];
          *outbackpoints++ = p[1];
          *outbackpoints++ = p[2];
        }
        backcount++;
      }
      if ((pdist > epsilon && ndist < -epsilon) ||
          (pdist < -epsilon && ndist > epsilon)) {
        oncount++;
        frac = pdist / (pdist - ndist);
        if (frontcount < outfrontmaxpoints) {
          *outfrontpoints++ = p[0] + frac * (n[0] - p[0]);
          *outfrontpoints++ = p[1] + frac * (n[1] - p[1]);
          *outfrontpoints++ = p[2] + frac * (n[2] - p[2]);
        }
        frontcount++;
        if (backcount < outbackmaxpoints) {
          *outbackpoints++ = p[0] + frac * (n[0] - p[0]);
          *outbackpoints++ = p[1] + frac * (n[1] - p[1]);
          *outbackpoints++ = p[2] + frac * (n[2] - p[2]);
        }
        backcount++;
      }
    }
  }
  if (neededfrontpoints)
    *neededfrontpoints = frontcount;
  if (neededbackpoints)
    *neededbackpoints = backcount;
  if (oncountpointer)
    *oncountpointer = oncount;
}


x86 assembly (clang, -O0):
<PolygonD_Divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9d,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     15fd <PolygonD_Divide+0x4fd>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x70(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x70(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    15f8 <PolygonD_Divide+0x4f8>
mov    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
cmp    -0x4(%rbp),%eax
jge    120d <PolygonD_Divide+0x10d>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    121a <PolygonD_Divide+0x11a>
xor    %eax,%eax
mov    %eax,-0x9c(%rbp)
jmp    121a <PolygonD_Divide+0x11a>
mov    -0x98(%rbp),%rax
mov    -0x9c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x70(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x70(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jb     1334 <PolygonD_Divide+0x234>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12cc <PolygonD_Divide+0x1cc>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    132b <PolygonD_Divide+0x22b>
mov    -0x78(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     13b3 <PolygonD_Divide+0x2b3>
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    13aa <PolygonD_Divide+0x2aa>
mov    -0x78(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
ucomisd -0x38(%rbp),%xmm0
jbe    13f4 <PolygonD_Divide+0x2f4>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
ja     1435 <PolygonD_Divide+0x335>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    15e5 <PolygonD_Divide+0x4e5>
movsd  -0x90(%rbp),%xmm0
ff
ucomisd -0x38(%rbp),%xmm0
jbe    15e5 <PolygonD_Divide+0x4e5>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
subsd  -0x90(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1519 <PolygonD_Divide+0x419>
mov    -0x78(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    15dc <PolygonD_Divide+0x4dc>
mov    -0x78(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  -0x80(%rbp),%xmm0
mov    -0x70(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x78(%rbp),%rax
subsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    15ea <PolygonD_Divide+0x4ea>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11be <PolygonD_Divide+0xbe>
jmp    15fd <PolygonD_Divide+0x4fd>
cmpq   $0x0,-0x50(%rbp)
je     1611 <PolygonD_Divide+0x511>
mov    -0x5c(%rbp),%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x18(%rbp)
je     1625 <PolygonD_Divide+0x525>
mov    -0x60(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x20(%rbp)
je     1639 <PolygonD_Divide+0x539>
mov    -0x64(%rbp),%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PolygonD_Divide>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x8(%rsp)
test   %edi,%edi
jle    1344 <PolygonD_Divide+0x244>
mov    %rsi,%r14
mov    0x38(%rsp),%r11
movsd  0x8(%rsi),%xmm5
mulsd  %xmm1,%xmm5
movsd  (%rsi),%xmm6
mulsd  %xmm0,%xmm6
addsd  %xmm5,%xmm6
movsd  0x10(%rsi),%xmm9
mulsd  %xmm2,%xmm9
addsd  %xmm6,%xmm9
subsd  %xmm3,%xmm9
movapd 0xeae(%rip),%xmm8
xorpd  %xmm4,%xmm8
mov    %edi,%r8d
neg    %r8d
xor    %r10d,%r10d
mov    $0x1,%r13d
mov    $0x3,%ebp
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    11a8 <PolygonD_Divide+0xa8>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r10d
add    $0x1,%r12d
add    $0x1,%r15d
lea    (%r8,%r13,1),%ebx
add    $0x1,%ebx
mov    %r13d,%eax
add    $0x1,%eax
add    $0x3,%ebp
mov    %eax,%r13d
cmp    $0x1,%ebx
je     134d <PolygonD_Divide+0x24d>
mov    %rsi,%rbx
movapd %xmm9,%xmm7
cmp    %edi,%r13d
mov    $0x0,%eax
cmovl  %ebp,%eax
movsd  0x8(%r14,%rax,8),%xmm10
mulsd  %xmm1,%xmm10
movsd  (%r14,%rax,8),%xmm6
mulsd  %xmm0,%xmm6
movsd  0x10(%r14,%rax,8),%xmm9
mulsd  %xmm2,%xmm9
ucomisd %xmm8,%xmm7
jb     1215 <PolygonD_Divide+0x115>
ucomisd %xmm7,%xmm4
sbb    $0xffffffff,%r10d
cmp    %edx,%r12d
jge    1211 <PolygonD_Divide+0x111>
movsd  (%rbx),%xmm5
movsd  %xmm5,(%rcx)
movsd  0x8(%rbx),%xmm5
movsd  %xmm5,0x8(%rcx)
movsd  0x10(%rbx),%xmm5
movsd  %xmm5,0x10(%rcx)
add    $0x18,%rcx
add    $0x1,%r12d
ucomisd %xmm7,%xmm4
jb     1247 <PolygonD_Divide+0x147>
cmp    %r9d,%r15d
jge    1243 <PolygonD_Divide+0x143>
movsd  (%rbx),%xmm5
movsd  %xmm5,(%r11)
movsd  0x8(%rbx),%xmm5
movsd  %xmm5,0x8(%r11)
movsd  0x10(%rbx),%xmm5
movsd  %xmm5,0x10(%r11)
add    $0x18,%r11
add    $0x1,%r15d
lea    (%r14,%rax,8),%rsi
addsd  %xmm10,%xmm6
addsd  %xmm6,%xmm9
subsd  %xmm3,%xmm9
ucomisd %xmm4,%xmm7
jbe    1267 <PolygonD_Divide+0x167>
ucomisd %xmm9,%xmm8
ja     127d <PolygonD_Divide+0x17d>
ucomisd %xmm7,%xmm8
jbe    118c <PolygonD_Divide+0x8c>
ucomisd %xmm4,%xmm9
jbe    118c <PolygonD_Divide+0x8c>
movapd %xmm7,%xmm5
subsd  %xmm9,%xmm5
divsd  %xmm5,%xmm7
cmp    %edx,%r12d
jge    12e1 <PolygonD_Divide+0x1e1>
movsd  (%rbx),%xmm5
movsd  (%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,(%rcx)
movsd  0x8(%rbx),%xmm5
movsd  0x8(%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,0x8(%rcx)
movsd  0x10(%rbx),%xmm5
movsd  0x10(%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,0x10(%rcx)
add    $0x18,%rcx
cmp    %r9d,%r15d
jge    1180 <PolygonD_Divide+0x80>
movsd  (%rbx),%xmm5
movsd  (%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,(%r11)
movsd  0x8(%rbx),%xmm5
movsd  0x8(%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,0x8(%r11)
movsd  0x10(%rbx),%xmm5
movsd  0x10(%rsi),%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,0x10(%r11)
add    $0x18,%r11
jmp    1180 <PolygonD_Divide+0x80>
xor    %r12d,%r12d
xor    %r15d,%r15d
xor    %r10d,%r10d
mov    0x40(%rsp),%rax
mov    -0x8(%rsp),%rcx
test   %rcx,%rcx
je     135f <PolygonD_Divide+0x25f>
mov    %r12d,(%rcx)
mov    0x48(%rsp),%rcx
test   %rax,%rax
je     136c <PolygonD_Divide+0x26c>
mov    %r15d,(%rax)
test   %rcx,%rcx
je     1374 <PolygonD_Divide+0x274>
mov    %r10d,(%rcx)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @PolygonD_Divide(i32 %0, double* %1, double %2, double %3, double %4, double %5, double %6, i32 %7, double* %8, i32* %9, i32 %10, double* %11, i32* %12, i32* %13) {
%15 = alloca i32
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca double*
%24 = alloca i32*
%25 = alloca i32
%26 = alloca double*
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca double*
%34 = alloca double*
%35 = alloca double
%36 = alloca double
%37 = alloca double
store i32 %0, i32* %15
store double* %1, double** %16
store double %2, double* %17
store double %3, double* %18
store double %4, double* %19
store double %5, double* %20
store double %6, double* %21
store i32 %7, i32* %22
store double* %8, double** %23
store i32* %9, i32** %24
store i32 %10, i32* %25
store double* %11, double** %26
store i32* %12, i32** %27
store i32* %13, i32** %28
store i32 0, i32* %29
store i32 0, i32* %30
store i32 0, i32* %31
store i32 0, i32* %32
%38 = load i32, i32* %15
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %287
40: ; preds = %14
%41 = load double*, double** %16
store double* %41, double** %33
%42 = load double*, double** %33
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = load double, double* %17
%46 = load double*, double** %33
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = load double, double* %18
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %44, double %45, double %50)
%52 = load double*, double** %33
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = load double, double* %19
%56 = call double @llvm.fmuladd.f64(double %54, double %55, double %51)
%57 = load double, double* %20
%58 = fsub double %56, %57
store double %58, double* %37
store i32 0, i32* %29
br label %59
59: ; preds = %283, %40
%60 = load i32, i32* %29
%61 = load i32, i32* %15
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %286
63: ; preds = %59
%64 = load double*, double** %33
store double* %64, double** %34
%65 = load double, double* %37
store double %65, double* %36
%66 = load double*, double** %16
%67 = load i32, i32* %29
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %15
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %74
71: ; preds = %63
%72 = load i32, i32* %29
%73 = add nsw i32 %72, 1
br label %75
74: ; preds = %63
br label %75
75: ; preds = %74, %71
%76 = phi i32 [ %73, %71 ], [ 0, %74 ]
%77 = mul nsw i32 %76, 3
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %66, i64 %78
store double* %79, double** %33
%80 = load double*, double** %33
%81 = getelementptr inbounds double, double* %80, i64 0
%82 = load double, double* %81
%83 = load double, double* %17
%84 = load double*, double** %33
%85 = getelementptr inbounds double, double* %84, i64 1
%86 = load double, double* %85
%87 = load double, double* %18
%88 = fmul double %86, %87
%89 = call double @llvm.fmuladd.f64(double %82, double %83, double %88)
%90 = load double*, double** %33
%91 = getelementptr inbounds double, double* %90, i64 2
%92 = load double, double* %91
%93 = load double, double* %19
%94 = call double @llvm.fmuladd.f64(double %92, double %93, double %89)
%95 = load double, double* %20
%96 = fsub double %94, %95
store double %96, double* %37
%97 = load double, double* %36
%98 = load double, double* %21
%99 = fneg double %98
%100 = fcmp oge double %97, %99
br i1 %100, label %101, label %131
101: ; preds = %75
%102 = load double, double* %36
%103 = load double, double* %21
%104 = fcmp ole double %102, %103
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = load i32, i32* %32
%107 = add nsw i32 %106, 1
store i32 %107, i32* %32
br label %108
108: ; preds = %105, %101
%109 = load i32, i32* %30
%110 = load i32, i32* %22
%111 = icmp slt i32 %109, %110
br i1 %111, label %112, label %128
112: ; preds = %108
%113 = load double*, double** %34
%114 = getelementptr inbounds double, double* %113, i64 0
%115 = load double, double* %114
%116 = load double*, double** %23
%117 = getelementptr inbounds double, double* %116, i32 1
store double* %117, double** %23
store double %115, double* %116
%118 = load double*, double** %34
%119 = getelementptr inbounds double, double* %118, i64 1
%120 = load double, double* %119
%121 = load double*, double** %23
%122 = getelementptr inbounds double, double* %121, i32 1
store double* %122, double** %23
store double %120, double* %121
%123 = load double*, double** %34
%124 = getelementptr inbounds double, double* %123, i64 2
%125 = load double, double* %124
%126 = load double*, double** %23
%127 = getelementptr inbounds double, double* %126, i32 1
store double* %127, double** %23
store double %125, double* %126
br label %128
128: ; preds = %112, %108
%129 = load i32, i32* %30
%130 = add nsw i32 %129, 1
store i32 %130, i32* %30
br label %131
131: ; preds = %128, %75
%132 = load double, double* %36
%133 = load double, double* %21
%134 = fcmp ole double %132, %133
br i1 %134, label %135, label %158
135: ; preds = %131
%136 = load i32, i32* %31
%137 = load i32, i32* %25
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %155
139: ; preds = %135
%140 = load double*, double** %34
%141 = getelementptr inbounds double, double* %140, i64 0
%142 = load double, double* %141
%143 = load double*, double** %26
%144 = getelementptr inbounds double, double* %143, i32 1
store double* %144, double** %26
store double %142, double* %143
%145 = load double*, double** %34
%146 = getelementptr inbounds double, double* %145, i64 1
%147 = load double, double* %146
%148 = load double*, double** %26
%149 = getelementptr inbounds double, double* %148, i32 1
store double* %149, double** %26
store double %147, double* %148
%150 = load double*, double** %34
%151 = getelementptr inbounds double, double* %150, i64 2
%152 = load double, double* %151
%153 = load double*, double** %26
%154 = getelementptr inbounds double, double* %153, i32 1
store double* %154, double** %26
store double %152, double* %153
br label %155
155: ; preds = %139, %135
%156 = load i32, i32* %31
%157 = add nsw i32 %156, 1
store i32 %157, i32* %31
br label %158
158: ; preds = %155, %131
%159 = load double, double* %36
%160 = load double, double* %21
%161 = fcmp ogt double %159, %160
br i1 %161, label %162, label %167
162: ; preds = %158
%163 = load double, double* %37
%164 = load double, double* %21
%165 = fneg double %164
%166 = fcmp olt double %163, %165
br i1 %166, label %176, label %167
167: ; preds = %162, %158
%168 = load double, double* %36
%169 = load double, double* %21
%170 = fneg double %169
%171 = fcmp olt double %168, %170
br i1 %171, label %172, label %282
172: ; preds = %167
%173 = load double, double* %37
%174 = load double, double* %21
%175 = fcmp ogt double %173, %174
br i1 %175, label %176, label %282
176: ; preds = %172, %162
%177 = load i32, i32* %32
%178 = add nsw i32 %177, 1
store i32 %178, i32* %32
%179 = load double, double* %36
%180 = load double, double* %36
%181 = load double, double* %37
%182 = fsub double %180, %181
%183 = fdiv double %179, %182
store double %183, double* %35
%184 = load i32, i32* %30
%185 = load i32, i32* %22
%186 = icmp slt i32 %184, %185
br i1 %186, label %187, label %230
187: ; preds = %176
%188 = load double*, double** %34
%189 = getelementptr inbounds double, double* %188, i64 0
%190 = load double, double* %189
%191 = load double, double* %35
%192 = load double*, double** %33
%193 = getelementptr inbounds double, double* %192, i64 0
%194 = load double, double* %193
%195 = load double*, double** %34
%196 = getelementptr inbounds double, double* %195, i64 0
%197 = load double, double* %196
%198 = fsub double %194, %197
%199 = call double @llvm.fmuladd.f64(double %191, double %198, double %190)
%200 = load double*, double** %23
%201 = getelementptr inbounds double, double* %200, i32 1
store double* %201, double** %23
store double %199, double* %200
%202 = load double*, double** %34
%203 = getelementptr inbounds double, double* %202, i64 1
%204 = load double, double* %203
%205 = load double, double* %35
%206 = load double*, double** %33
%207 = getelementptr inbounds double, double* %206, i64 1
%208 = load double, double* %207
%209 = load double*, double** %34
%210 = getelementptr inbounds double, double* %209, i64 1
%211 = load double, double* %210
%212 = fsub double %208, %211
%213 = call double @llvm.fmuladd.f64(double %205, double %212, double %204)
%214 = load double*, double** %23
%215 = getelementptr inbounds double, double* %214, i32 1
store double* %215, double** %23
store double %213, double* %214
%216 = load double*, double** %34
%217 = getelementptr inbounds double, double* %216, i64 2
%218 = load double, double* %217
%219 = load double, double* %35
%220 = load double*, double** %33
%221 = getelementptr inbounds double, double* %220, i64 2
%222 = load double, double* %221
%223 = load double*, double** %34
%224 = getelementptr inbounds double, double* %223, i64 2
%225 = load double, double* %224
%226 = fsub double %222, %225
%227 = call double @llvm.fmuladd.f64(double %219, double %226, double %218)
%228 = load double*, double** %23
%229 = getelementptr inbounds double, double* %228, i32 1
store double* %229, double** %23
store double %227, double* %228
br label %230
230: ; preds = %187, %176
%231 = load i32, i32* %30
%232 = add nsw i32 %231, 1
store i32 %232, i32* %30
%233 = load i32, i32* %31
%234 = load i32, i32* %25
%235 = icmp slt i32 %233, %234
br i1 %235, label %236, label %279
236: ; preds = %230
%237 = load double*, double** %34
%238 = getelementptr inbounds double, double* %237, i64 0
%239 = load double, double* %238
%240 = load double, double* %35
%241 = load double*, double** %33
%242 = getelementptr inbounds double, double* %241, i64 0
%243 = load double, double* %242
%244 = load double*, double** %34
%245 = getelementptr inbounds double, double* %244, i64 0
%246 = load double, double* %245
%247 = fsub double %243, %246
%248 = call double @llvm.fmuladd.f64(double %240, double %247, double %239)
%249 = load double*, double** %26
%250 = getelementptr inbounds double, double* %249, i32 1
store double* %250, double** %26
store double %248, double* %249
%251 = load double*, double** %34
%252 = getelementptr inbounds double, double* %251, i64 1
%253 = load double, double* %252
%254 = load double, double* %35
%255 = load double*, double** %33
%256 = getelementptr inbounds double, double* %255, i64 1
%257 = load double, double* %256
%258 = load double*, double** %34
%259 = getelementptr inbounds double, double* %258, i64 1
%260 = load double, double* %259
%261 = fsub double %257, %260
%262 = call double @llvm.fmuladd.f64(double %254, double %261, double %253)
%263 = load double*, double** %26
%264 = getelementptr inbounds double, double* %263, i32 1
store double* %264, double** %26
store double %262, double* %263
%265 = load double*, double** %34
%266 = getelementptr inbounds double, double* %265, i64 2
%267 = load double, double* %266
%268 = load double, double* %35
%269 = load double*, double** %33
%270 = getelementptr inbounds double, double* %269, i64 2
%271 = load double, double* %270
%272 = load double*, double** %34
%273 = getelementptr inbounds double, double* %272, i64 2
%274 = load double, double* %273
%275 = fsub double %271, %274
%276 = call double @llvm.fmuladd.f64(double %268, double %275, double %267)
%277 = load double*, double** %26
%278 = getelementptr inbounds double, double* %277, i32 1
store double* %278, double** %26
store double %276, double* %277
br label %279
279: ; preds = %236, %230
%280 = load i32, i32* %31
%281 = add nsw i32 %280, 1
store i32 %281, i32* %31
br label %282
282: ; preds = %279, %172, %167
br label %283
283: ; preds = %282
%284 = load i32, i32* %29
%285 = add nsw i32 %284, 1
store i32 %285, i32* %29
br label %59
286: ; preds = %59
br label %287
287: ; preds = %286, %14
%288 = load i32*, i32** %24
%289 = icmp ne i32* %288, null
br i1 %289, label %290, label %293
290: ; preds = %287
%291 = load i32, i32* %30
%292 = load i32*, i32** %24
store i32 %291, i32* %292
br label %293
293: ; preds = %290, %287
%294 = load i32*, i32** %27
%295 = icmp ne i32* %294, null
br i1 %295, label %296, label %299
296: ; preds = %293
%297 = load i32, i32* %31
%298 = load i32*, i32** %27
store i32 %297, i32* %298
br label %299
299: ; preds = %296, %293
%300 = load i32*, i32** %28
%301 = icmp ne i32* %300, null
br i1 %301, label %302, label %305
302: ; preds = %299
%303 = load i32, i32* %32
%304 = load i32*, i32** %28
store i32 %303, i32* %304
br label %305
305: ; preds = %302, %299
ret void
}

LLVM IR (-O2):
define void @PolygonD_Divide(i32 %0, double* nocapture %1, double %2, double %3, double %4, double %5, double %6, i32 %7, double* nocapture writeonly %8, i32* writeonly %9, i32 %10, double* nocapture writeonly %11, i32* writeonly %12, i32* writeonly %13) {
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %153
16: ; preds = %14
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = load double, double* %1
%20 = getelementptr inbounds double, double* %1, i64 1
%21 = load double, double* %20
%22 = fmul double %21, %3
%23 = tail call double @llvm.fmuladd.f64(double %19, double %2, double %22)
%24 = tail call double @llvm.fmuladd.f64(double %18, double %4, double %23)
%25 = fsub double %24, %5
%26 = fneg double %6
br label %27
27: ; preds = %16, %146
%28 = phi double [ %25, %16 ], [ %50, %146 ]
%29 = phi double* [ %8, %16 ], [ %151, %146 ]
%30 = phi double* [ %11, %16 ], [ %150, %146 ]
%31 = phi i32 [ 0, %16 ], [ %36, %146 ]
%32 = phi double* [ %1, %16 ], [ %41, %146 ]
%33 = phi i32 [ 0, %16 ], [ %149, %146 ]
%34 = phi i32 [ 0, %16 ], [ %148, %146 ]
%35 = phi i32 [ 0, %16 ], [ %147, %146 ]
%36 = add nuw nsw i32 %31, 1
%37 = icmp slt i32 %36, %0
%38 = mul nsw i32 %36, 3
%39 = select i1 %37, i32 %38, i32 0
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds double, double* %1, i64 %40
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %41, i64 1
%44 = load double, double* %43
%45 = fmul double %44, %3
%46 = tail call double @llvm.fmuladd.f64(double %42, double %2, double %45)
%47 = getelementptr inbounds double, double* %41, i64 2
%48 = load double, double* %47
%49 = tail call double @llvm.fmuladd.f64(double %48, double %4, double %46)
%50 = fsub double %49, %5
%51 = fcmp ult double %28, %26
br i1 %51, label %69, label %52
52: ; preds = %27
%53 = fcmp ole double %28, %6
%54 = zext i1 %53 to i32
%55 = add nsw i32 %33, %54
%56 = icmp slt i32 %35, %7
br i1 %56, label %57, label %66
57: ; preds = %52
%58 = load double, double* %32
%59 = getelementptr inbounds double, double* %29, i64 1
store double %58, double* %29
%60 = getelementptr inbounds double, double* %32, i64 1
%61 = load double, double* %60
%62 = getelementptr inbounds double, double* %29, i64 2
store double %61, double* %59
%63 = getelementptr inbounds double, double* %32, i64 2
%64 = load double, double* %63
%65 = getelementptr inbounds double, double* %29, i64 3
store double %64, double* %62
br label %66
66: ; preds = %57, %52
%67 = phi double* [ %65, %57 ], [ %29, %52 ]
%68 = add nsw i32 %35, 1
br label %69
69: ; preds = %66, %27
%70 = phi i32 [ %68, %66 ], [ %35, %27 ]
%71 = phi i32 [ %55, %66 ], [ %33, %27 ]
%72 = phi double* [ %67, %66 ], [ %29, %27 ]
%73 = fcmp ugt double %28, %6
br i1 %73, label %88, label %74
74: ; preds = %69
%75 = icmp slt i32 %34, %10
br i1 %75, label %76, label %85
76: ; preds = %74
%77 = load double, double* %32
%78 = getelementptr inbounds double, double* %30, i64 1
store double %77, double* %30
%79 = getelementptr inbounds double, double* %32, i64 1
%80 = load double, double* %79
%81 = getelementptr inbounds double, double* %30, i64 2
store double %80, double* %78
%82 = getelementptr inbounds double, double* %32, i64 2
%83 = load double, double* %82
%84 = getelementptr inbounds double, double* %30, i64 3
store double %83, double* %81
br label %85
85: ; preds = %76, %74
%86 = phi double* [ %84, %76 ], [ %30, %74 ]
%87 = add nsw i32 %34, 1
br label %88
88: ; preds = %85, %69
%89 = phi i32 [ %87, %85 ], [ %34, %69 ]
%90 = phi double* [ %86, %85 ], [ %30, %69 ]
%91 = fcmp ogt double %28, %6
%92 = fcmp olt double %50, %26
%93 = select i1 %91, i1 %92, i1 false
br i1 %93, label %98, label %94
94: ; preds = %88
%95 = fcmp olt double %28, %26
%96 = fcmp ogt double %50, %6
%97 = select i1 %95, i1 %96, i1 false
br i1 %97, label %98, label %146
98: ; preds = %94, %88
%99 = add nsw i32 %71, 1
%100 = fsub double %28, %50
%101 = fdiv double %28, %100
%102 = icmp slt i32 %70, %7
br i1 %102, label %103, label %121
103: ; preds = %98
%104 = load double, double* %32
%105 = load double, double* %41
%106 = fsub double %105, %104
%107 = tail call double @llvm.fmuladd.f64(double %101, double %106, double %104)
%108 = getelementptr inbounds double, double* %72, i64 1
store double %107, double* %72
%109 = getelementptr inbounds double, double* %32, i64 1
%110 = load double, double* %109
%111 = load double, double* %43
%112 = fsub double %111, %110
%113 = tail call double @llvm.fmuladd.f64(double %101, double %112, double %110)
%114 = getelementptr inbounds double, double* %72, i64 2
store double %113, double* %108
%115 = getelementptr inbounds double, double* %32, i64 2
%116 = load double, double* %115
%117 = load double, double* %47
%118 = fsub double %117, %116
%119 = tail call double @llvm.fmuladd.f64(double %101, double %118, double %116)
%120 = getelementptr inbounds double, double* %72, i64 3
store double %119, double* %114
br label %121
121: ; preds = %103, %98
%122 = phi double* [ %120, %103 ], [ %72, %98 ]
%123 = add nsw i32 %70, 1
%124 = icmp slt i32 %89, %10
br i1 %124, label %125, label %143
125: ; preds = %121
%126 = load double, double* %32
%127 = load double, double* %41
%128 = fsub double %127, %126
%129 = tail call double @llvm.fmuladd.f64(double %101, double %128, double %126)
%130 = getelementptr inbounds double, double* %90, i64 1
store double %129, double* %90
%131 = getelementptr inbounds double, double* %32, i64 1
%132 = load double, double* %131
%133 = load double, double* %43
%134 = fsub double %133, %132
%135 = tail call double @llvm.fmuladd.f64(double %101, double %134, double %132)
%136 = getelementptr inbounds double, double* %90, i64 2
store double %135, double* %130
%137 = getelementptr inbounds double, double* %32, i64 2
%138 = load double, double* %137
%139 = load double, double* %47
%140 = fsub double %139, %138
%141 = tail call double @llvm.fmuladd.f64(double %101, double %140, double %138)
%142 = getelementptr inbounds double, double* %90, i64 3
store double %141, double* %136
br label %143
143: ; preds = %125, %121
%144 = phi double* [ %142, %125 ], [ %90, %121 ]
%145 = add nsw i32 %89, 1
br label %146
146: ; preds = %94, %143
%147 = phi i32 [ %123, %143 ], [ %70, %94 ]
%148 = phi i32 [ %145, %143 ], [ %89, %94 ]
%149 = phi i32 [ %99, %143 ], [ %71, %94 ]
%150 = phi double* [ %144, %143 ], [ %90, %94 ]
%151 = phi double* [ %122, %143 ], [ %72, %94 ]
%152 = icmp eq i32 %36, %0
br i1 %152, label %153, label %27
153: ; preds = %146, %14
%154 = phi i32 [ 0, %14 ], [ %147, %146 ]
%155 = phi i32 [ 0, %14 ], [ %148, %146 ]
%156 = phi i32 [ 0, %14 ], [ %149, %146 ]
%157 = icmp eq i32* %9, null
br i1 %157, label %159, label %158
158: ; preds = %153
store i32 %154, i32* %9
br label %159
159: ; preds = %158, %153
%160 = icmp eq i32* %12, null
br i1 %160, label %162, label %161
161: ; preds = %159
store i32 %155, i32* %12
br label %162
162: ; preds = %161, %159
%163 = icmp eq i32* %13, null
br i1 %163, label %165, label %164
164: ; preds = %162
store i32 %156, i32* %13
br label %165
165: ; preds = %164, %162
ret void
}