#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ LeftTurn(double const *, double const *, double const *);
scalar_t__ TriangleContainsPoint(double const *, double *, double *,
                                 double const *);
int polygon_triangulate(int n, const double *v, int *t) {
  int *V;
  int nv;
  int i;
  int count;
  int tc = 0;
  if (n < 3) {
    return -1;
  }
  if (NULL == v) {
    return -2;
  }
  if (NULL == t) {
    return -3;
  }
  V = t + 2 * n - 6;
  nv = n;
  for (i = 0; i < n; ++i) {
    V[i] = i;
  }
  count = 2 * nv;
  for (i = nv - 1; nv > 2;) {
    int u, w;
    if (0 >= (count--)) {
      return 1;
    }
    u = i;
    i = u + 1;
    if (nv <= i) {
      i = 0;
    }
    w = i + 1;
    if (nv <= w) {
      w = 0;
    }
    int can_clip = 1;
    {
      int p;
      double tri_a[2] = {v[2 * V[i] + 0] - v[2 * V[u] + 0],
                         v[2 * V[i] + 1] - v[2 * V[u] + 1]};
      double tri_b[2] = {v[2 * V[w] + 0] - v[2 * V[u] + 0],
                         v[2 * V[w] + 1] - v[2 * V[u] + 1]};
      if (LeftTurn(&v[2 * V[u]], &v[2 * V[i]], &v[2 * V[w]]) < 0) {
        can_clip = 0;
      } else {
        for (p = 0; p < nv; ++p) {
          if ((p == u) || (p == i) || (p == w)) {
            continue;
          }
          if (TriangleContainsPoint(&v[2 * V[u]], tri_a, tri_b, &v[2 * V[p]])) {
            can_clip = 0;
            break;
          }
        }
      }
    }
    if (can_clip) {
      int tri[3] = {V[u], V[i], V[w]};
      while (i > 0) {
        V[i] = V[i - 1];
        --i;
      }
      ++V;
      --nv;
      count = 2 * nv;
      t[3 * tc + 0] = tri[0];
      t[3 * tc + 1] = tri[1];
      t[3 * tc + 2] = tri[2];
      ++tc;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<polygon_triangulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1150 <polygon_triangulate+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    153f <polygon_triangulate+0x41f>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1168 <polygon_triangulate+0x48>
movl   $0xfffffffe,-0x4(%rbp)
jmp    153f <polygon_triangulate+0x41f>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1180 <polygon_triangulate+0x60>
movl   $0xfffffffd,-0x4(%rbp)
jmp    153f <polygon_triangulate+0x41f>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0xffffffffffffffe8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d1 <polygon_triangulate+0xb1>
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a9 <polygon_triangulate+0x89>
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x2,-0x24(%rbp)
jle    1538 <polygon_triangulate+0x418>
mov    -0x2c(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jl     120e <polygon_triangulate+0xee>
movl   $0x1,-0x4(%rbp)
jmp    153f <polygon_triangulate+0x41f>
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     1230 <polygon_triangulate+0x110>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     124c <polygon_triangulate+0x12c>
movl   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x38(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x38(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1040 <LeftTurn@plt>
cmp    $0x0,%rax
jge    13bb <polygon_triangulate+0x29b>
movl   $0x0,-0x3c(%rbp)
jmp    1469 <polygon_triangulate+0x349>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1464 <polygon_triangulate+0x344>
mov    -0x40(%rbp),%eax
cmp    -0x34(%rbp),%eax
je     13f2 <polygon_triangulate+0x2d2>
mov    -0x40(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     13f2 <polygon_triangulate+0x2d2>
mov    -0x40(%rbp),%eax
cmp    -0x38(%rbp),%eax
jne    13f7 <polygon_triangulate+0x2d7>
jmp    1456 <polygon_triangulate+0x336>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
lea    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%r8
mov    (%rax,%r8,4),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
call   1030 <TriangleContainsPoint@plt>
cmp    $0x0,%rax
je     1451 <polygon_triangulate+0x331>
movl   $0x0,-0x3c(%rbp)
jmp    1464 <polygon_triangulate+0x344>
jmp    1456 <polygon_triangulate+0x336>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13c2 <polygon_triangulate+0x2a2>
jmp    1469 <polygon_triangulate+0x349>
cmpl   $0x0,-0x3c(%rbp)
je     1533 <polygon_triangulate+0x413>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x28(%rbp)
jle    14d0 <polygon_triangulate+0x3b0>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    149d <polygon_triangulate+0x37d>
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x6c(%rbp),%edx
mov    -0x18(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%edx
mov    -0x18(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%edx
mov    -0x18(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11e3 <polygon_triangulate+0xc3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polygon_triangulate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    $0xffffffff,%eax
cmp    $0x3,%edi
jl     167d <polygon_triangulate+0x55d>
mov    %rsi,%r10
test   %rsi,%rsi
je     1166 <polygon_triangulate+0x46>
test   %rdx,%rdx
je     1170 <polygon_triangulate+0x50>
lea    (%rdi,%rdi,1),%r14d
movslq %r14d,%r8
lea    (%rdx,%r8,4),%r12
add    $0xffffffffffffffe8,%r12
mov    %edi,%eax
cmp    $0x8,%edi
jae    117a <polygon_triangulate+0x5a>
xor    %ecx,%ecx
jmp    12e0 <polygon_triangulate+0x1c0>
mov    $0xfffffffe,%eax
jmp    167d <polygon_triangulate+0x55d>
mov    $0xfffffffd,%eax
jmp    167d <polygon_triangulate+0x55d>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rsi
mov    %rsi,%rbx
shr    $0x3,%rbx
add    $0x1,%rbx
mov    %ebx,%r9d
and    $0x3,%r9d
cmp    $0x18,%rsi
jae    11aa <polygon_triangulate+0x8a>
movdqa 0xe5d(%rip),%xmm0
xor    %esi,%esi
jmp    1289 <polygon_triangulate+0x169>
and    $0xfffffffffffffffc,%rbx
lea    (%rdx,%r8,4),%rbp
add    $0x58,%rbp
movdqa 0xe42(%rip),%xmm0
xor    %esi,%esi
movdqa 0xe47(%rip),%xmm8
movdqa 0xe4e(%rip),%xmm9
movdqa 0xe55(%rip),%xmm10
movdqa 0xe5d(%rip),%xmm4
movdqa 0xe65(%rip),%xmm5
movdqa 0xe6d(%rip),%xmm6
movdqa 0xe75(%rip),%xmm7
movdqa 0xe7d(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,-0x70(%rbp,%rsi,4)
movdqu %xmm2,-0x60(%rbp,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,-0x50(%rbp,%rsi,4)
movdqu %xmm3,-0x40(%rbp,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,-0x30(%rbp,%rsi,4)
movdqu %xmm3,-0x20(%rbp,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,-0x10(%rbp,%rsi,4)
movdqu %xmm3,0x0(%rbp,%rsi,4)
add    $0x20,%rsi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rbx
jne    1210 <polygon_triangulate+0xf0>
test   %r9,%r9
je     12d1 <polygon_triangulate+0x1b1>
add    %r8,%rsi
lea    (%rdx,%rsi,4),%rbp
add    $0xfffffffffffffff8,%rbp
shl    $0x5,%r9
xor    %esi,%esi
movdqa 0xd69(%rip),%xmm1
movdqa 0xd71(%rip),%xmm2
nop
movdqa %xmm0,%xmm3
paddd  %xmm1,%xmm3
movdqu %xmm0,-0x10(%rbp,%rsi,1)
movdqu %xmm3,0x0(%rbp,%rsi,1)
paddd  %xmm2,%xmm0
add    $0x20,%rsi
cmp    %rsi,%r9
jne    12b0 <polygon_triangulate+0x190>
cmp    %rax,%rcx
je     12ed <polygon_triangulate+0x1cd>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,(%r12,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    12e0 <polygon_triangulate+0x1c0>
xor    %eax,%eax
cmp    $0x3,%edi
jl     167d <polygon_triangulate+0x55d>
mov    %rdx,0x28(%rsp)
lea    -0x1(%rdi),%ebx
movabs $0x3ffffffffffffffc,%rax
ff ff 3f
or     $0x2,%rax
mov    %rax,0x38(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
mov    %r10,0x10(%rsp)
jmp    1355 <polygon_triangulate+0x235>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x24(%rsp),%r14d
add    $0xffffffff,%r14d
mov    0x10(%rsp),%r10
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%r12
mov    (%rsp),%rbx
cmp    $0x2,%edi
jle    167b <polygon_triangulate+0x55b>
test   %r14d,%r14d
jle    1674 <polygon_triangulate+0x554>
mov    %r14d,0x24(%rsp)
lea    0x1(%rbx),%ecx
cmp    %ecx,%edi
mov    $0x0,%eax
cmovle %eax,%ecx
lea    0x1(%rcx),%ebp
mov    %rdi,0x8(%rsp)
cmp    %ebp,%edi
cmovle %eax,%ebp
mov    %rcx,(%rsp)
movslq %ecx,%rax
mov    %rax,0x48(%rsp)
movslq (%r12,%rax,4),%rax
shl    $0x4,%rax
lea    (%r10,%rax,1),%rsi
movslq %ebx,%r15
movslq (%r12,%r15,4),%rcx
shl    $0x4,%rcx
lea    (%r10,%rcx,1),%rdi
movupd (%r10,%rax,1),%xmm0
movupd (%r10,%rcx,1),%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,0x60(%rsp)
movslq %ebp,%rax
mov    %r12,0x18(%rsp)
mov    %rax,0x40(%rsp)
movslq (%r12,%rax,4),%rax
shl    $0x4,%rax
lea    (%r10,%rax,1),%rdx
movupd (%r10,%rax,1),%xmm0
subpd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
call   1040 <LeftTurn@plt>
test   %rax,%rax
js     1330 <polygon_triangulate+0x210>
mov    %ebp,%r12d
mov    (%rsp),%r14d
mov    %ebx,%ebp
mov    0x8(%rsp),%ebx
xor    %r13d,%r13d
jmp    1419 <polygon_triangulate+0x2f9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13
cmp    %r13,%rbx
je     1470 <polygon_triangulate+0x350>
cmp    %r13,%rbp
je     1410 <polygon_triangulate+0x2f0>
cmp    %r13,%r14
je     1410 <polygon_triangulate+0x2f0>
cmp    %r13,%r12
je     1410 <polygon_triangulate+0x2f0>
mov    0x18(%rsp),%rcx
movslq (%rcx,%r15,4),%rdi
shl    $0x4,%rdi
mov    0x10(%rsp),%rax
add    %rax,%rdi
movslq (%rcx,%r13,4),%rcx
shl    $0x4,%rcx
add    %rax,%rcx
lea    0x60(%rsp),%rsi
lea    0x50(%rsp),%rdx
call   1030 <TriangleContainsPoint@plt>
test   %rax,%rax
je     1410 <polygon_triangulate+0x2f0>
jmp    1330 <polygon_triangulate+0x210>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%r12
mov    (%r12,%r15,4),%r11d
mov    0x48(%rsp),%rax
mov    (%r12,%rax,4),%edi
mov    0x40(%rsp),%rax
mov    (%r12,%rax,4),%r8d
mov    (%rsp),%rbx
test   %ebx,%ebx
mov    0x28(%rsp),%rsi
jle    14c9 <polygon_triangulate+0x3a9>
cmp    $0x8,%ebx
jae    1512 <polygon_triangulate+0x3f2>
add    $0x1,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x2(%r14),%eax
mov    (%r12,%rax,4),%eax
mov    %eax,-0x4(%r12,%r14,4)
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     14b0 <polygon_triangulate+0x390>
xor    %ebx,%ebx
add    $0x4,%r12
mov    0x8(%rsp),%rax
lea    (%rax,%rax,1),%r14d
add    $0xfffffffe,%r14d
add    $0xffffffff,%eax
mov    0x30(%rsp),%rdx
lea    (%rdx,%rdx,2),%ecx
movslq %ecx,%rcx
mov    %r11d,(%rsi,%rcx,4)
mov    %edi,0x4(%rsi,%rcx,4)
mov    %r8d,0x8(%rsi,%rcx,4)
add    $0x1,%edx
mov    %rdx,0x30(%rsp)
mov    %eax,%edi
mov    0x10(%rsp),%r10
cmp    $0x2,%edi
jg     1355 <polygon_triangulate+0x235>
jmp    167b <polygon_triangulate+0x55b>
lea    -0x1(%r14),%rcx
add    $0xffffffff,%ebx
mov    %rcx,%rax
mov    $0x4,%edx
mul    %rdx
seto   %dl
cmp    %ecx,%ebx
jb     149d <polygon_triangulate+0x37d>
shr    $0x20,%rcx
jne    149d <polygon_triangulate+0x37d>
lea    (%r12,%r14,4),%rbp
mov    %rbp,%rcx
sub    %rax,%rcx
cmp    %rbp,%rcx
ja     149d <polygon_triangulate+0x37d>
test   %dl,%dl
jne    149d <polygon_triangulate+0x37d>
lea    (%r12,%rbx,4),%rbp
mov    %rbp,%rcx
sub    %rax,%rcx
cmp    %rbp,%rcx
ja     149d <polygon_triangulate+0x37d>
test   %dl,%dl
jne    149d <polygon_triangulate+0x37d>
lea    0x4(%r12),%rax
lea    (%r12,%rbx,4),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
jae    159d <polygon_triangulate+0x47d>
lea    (%r12,%r14,4),%rax
add    $0x4,%rax
sub    %r14,%rbx
lea    (%r12,%rbx,4),%rcx
add    $0x4,%rcx
cmp    %rax,%rcx
jb     149d <polygon_triangulate+0x37d>
mov    %r14d,%r9d
and    $0xfffffff8,%r9d
lea    -0x8(%r9),%rax
mov    %rax,%r10
shr    $0x3,%r10
add    $0x1,%r10
test   %rax,%rax
je     166a <polygon_triangulate+0x54a>
mov    %r10,%rcx
and    0x38(%rsp),%rcx
lea    (%r12,%r14,4),%rbx
add    $0xfffffffffffffff4,%rbx
mov    $0xffffffff,%edx
lea    (%r14,%rdx,1),%rax
add    $0xfffffffffffffff8,%rax
lea    (%r14,%rdx,1),%rbp
xor    %edx,%edx
nop
lea    (%rdx,%rbp,1),%esi
movups -0x1c(%r12,%rsi,4),%xmm0
movups -0xc(%r12,%rsi,4),%xmm1
movups %xmm1,(%rbx,%rdx,4)
movups %xmm0,-0x10(%rbx,%rdx,4)
lea    (%rax,%rdx,1),%esi
movupd -0x1c(%r12,%rsi,4),%xmm0
movupd -0xc(%r12,%rsi,4),%xmm1
movupd %xmm1,-0x20(%rbx,%rdx,4)
movupd %xmm0,-0x30(%rbx,%rdx,4)
add    $0xfffffffffffffff0,%rdx
add    $0xfffffffffffffffe,%rcx
jne    15e0 <polygon_triangulate+0x4c0>
neg    %rdx
mov    0x28(%rsp),%rsi
test   $0x1,%r10b
je     1656 <polygon_triangulate+0x536>
mov    %r14,%rax
sub    %rdx,%rax
mov    $0xffffffff,%ecx
add    %eax,%ecx
movupd -0x1c(%r12,%rcx,4),%xmm0
movupd -0xc(%r12,%rcx,4),%xmm1
movupd %xmm1,-0xc(%r12,%rax,4)
movupd %xmm0,-0x1c(%r12,%rax,4)
xor    %ebx,%ebx
cmp    %r14,%r9
je     14c9 <polygon_triangulate+0x3a9>
and    $0x7,%r14d
jmp    149d <polygon_triangulate+0x37d>
xor    %edx,%edx
test   $0x1,%r10b
jne    162d <polygon_triangulate+0x50d>
jmp    1656 <polygon_triangulate+0x536>
mov    $0x1,%eax
jmp    167d <polygon_triangulate+0x55d>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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