#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 */
int inPlane(double, double, int);
int lineClip(int n, double *x, double *y, double *nx, double *ny, double val,
             int dir) {
  int i;
  int nout;
  int last;
  double ycross;
  nout = 0;
  last = inPlane(x[n - 1], val, dir);
  for (i = 0; i < n; ++i) {
    if (last) {
      if (inPlane(x[i], val, dir)) {
        nx[nout] = x[i];
        ny[nout] = y[i];
        ++nout;
      } else {
        if (i == 0)
          ycross = y[n - 1] +
                   (y[0] - y[n - 1]) * (val - x[n - 1]) / (x[0] - x[n - 1]);
        else
          ycross = y[i - 1] +
                   (y[i] - y[i - 1]) * (val - x[i - 1]) / (x[i] - x[i - 1]);
        nx[nout] = val;
        ny[nout] = ycross;
        ++nout;
        last = 0;
      }
    } else {
      if (inPlane(x[i], val, dir)) {
        if (i == 0)
          ycross = y[n - 1] +
                   (y[0] - y[n - 1]) * (val - x[n - 1]) / (x[i] - x[n - 1]);
        else
          ycross = y[i - 1] +
                   (y[i] - y[i - 1]) * (val - x[i - 1]) / (x[i] - x[i - 1]);
        nx[nout] = val;
        ny[nout] = ycross;
        ++nout;
        nx[nout] = x[i];
        ny[nout] = y[i];
        ++nout;
        last = 1;
      } else {
      }
    }
  }
  return nout;
}


x86 assembly (clang, -O0):
<lineClip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x34(%rbp),%edi
call   1030 <inPlane@plt>
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14bd <lineClip+0x3ad>
cmpl   $0x0,-0x40(%rbp)
je     130d <lineClip+0x1fd>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x34(%rbp),%edi
call   1030 <inPlane@plt>
cmp    $0x0,%eax
je     11df <lineClip+0xcf>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1308 <lineClip+0x1f8>
cmpl   $0x0,-0x38(%rbp)
jne    125c <lineClip+0x14c>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12d4 <lineClip+0x1c4>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
jmp    14aa <lineClip+0x39a>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x34(%rbp),%edi
call   1030 <inPlane@plt>
cmp    $0x0,%eax
je     14a0 <lineClip+0x390>
cmpl   $0x0,-0x38(%rbp)
jne    13b2 <lineClip+0x2a2>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    142a <lineClip+0x31a>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    14a5 <lineClip+0x395>
jmp    14a5 <lineClip+0x395>
jmp    14aa <lineClip+0x39a>
jmp    14af <lineClip+0x39f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1164 <lineClip+0x54>
mov    -0x3c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lineClip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movapd %xmm0,%xmm1
mov    %r8,0x28(%rsp)
mov    %rcx,(%rsp)
mov    %rdx,%r13
mov    %rsi,%r15
movslq %edi,%rbx
movsd  -0x8(%rsi,%rbx,8),%xmm0
movsd  %xmm1,0x8(%rsp)
mov    %r9d,0x14(%rsp)
mov    %r9d,%edi
call   1030 <inPlane@plt>
test   %ebx,%ebx
jle    1304 <lineClip+0x1f4>
mov    %eax,%r14d
lea    -0x1(%rbx),%rax
mov    %rax,0x20(%rsp)
lea    (%r15,%rbx,8),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,0x18(%rsp)
mov    %ebx,%eax
shl    $0x3,%rax
mov    %rax,0x30(%rsp)
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    11b8 <lineClip+0xa8>
movsd  0x0(%rbp),%xmm0
movslq %ebx,%rax
mov    (%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
movsd  0x0(%r13,%r12,1),%xmm0
mov    $0x1,%ecx
mov    0x28(%rsp),%rdx
movsd  %xmm0,(%rdx,%rax,8)
add    %ecx,%ebx
add    $0x8,%r12
cmp    %r12,0x30(%rsp)
je     1306 <lineClip+0x1f6>
lea    (%r15,%r12,1),%rbp
movsd  (%r15,%r12,1),%xmm0
movsd  0x8(%rsp),%xmm1
mov    0x14(%rsp),%edi
call   1030 <inPlane@plt>
test   %r14d,%r14d
je     1200 <lineClip+0xf0>
test   %eax,%eax
jne    1180 <lineClip+0x70>
test   %r12,%r12
je     122d <lineClip+0x11d>
movsd  -0x8(%r13,%r12,1),%xmm1
movsd  0x0(%r13,%r12,1),%xmm2
subsd  %xmm1,%xmm2
lea    (%r15,%r12,1),%rax
add    $0xfffffffffffffff8,%rax
jmp    124b <lineClip+0x13b>
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
je     1225 <lineClip+0x115>
test   %r12,%r12
je     1286 <lineClip+0x176>
movsd  -0x8(%r13,%r12,1),%xmm0
movsd  0x0(%r13,%r12,1),%xmm1
subsd  %xmm0,%xmm1
lea    (%r15,%r12,1),%rax
add    $0xfffffffffffffff8,%rax
jmp    12a1 <lineClip+0x191>
xor    %r14d,%r14d
jmp    11a9 <lineClip+0x99>
mov    0x20(%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm1
movsd  0x0(%r13),%xmm2
subsd  %xmm1,%xmm2
mov    0x18(%rsp),%rax
mov    %r15,%rbp
movsd  (%rax),%xmm3
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
movsd  0x0(%rbp),%xmm2
subsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq %ebx,%rax
mov    (%rsp),%rcx
movsd  %xmm4,(%rcx,%rax,8)
xor    %r14d,%r14d
jmp    1198 <lineClip+0x88>
mov    0x20(%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm0
movsd  0x0(%r13),%xmm1
subsd  %xmm0,%xmm1
mov    0x18(%rsp),%rax
movsd  (%rax),%xmm2
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
movsd  0x0(%rbp),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
movslq %ebx,%rax
mov    (%rsp),%rdx
movsd  %xmm4,(%rdx,%rax,8)
mov    0x28(%rsp),%rcx
movsd  %xmm3,(%rcx,%rax,8)
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x8(%rdx,%rax,8)
add    $0x1,%rax
movsd  0x0(%r13,%r12,1),%xmm0
mov    $0x1,%r14d
mov    $0x2,%ecx
jmp    119d <lineClip+0x8d>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @lineClip(i32 %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double %5, i32 %6) {
%8 = add nsw i32 %0, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = load double, double* %10
%12 = tail call i32 @inPlane(double %11, double %5, i32 %6)
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %108
14: ; preds = %7
%15 = getelementptr inbounds double, double* %2, i64 %9
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %14, %103
%18 = phi i64 [ 0, %14 ], [ %106, %103 ]
%19 = phi i32 [ %12, %14 ], [ %105, %103 ]
%20 = phi i32 [ 0, %14 ], [ %104, %103 ]
%21 = icmp eq i32 %19, 0
%22 = getelementptr inbounds double, double* %1, i64 %18
%23 = load double, double* %22
%24 = tail call i32 @inPlane(double %23, double %5, i32 %6)
%25 = icmp eq i32 %24, 0
br i1 %21, label %61, label %26
26: ; preds = %17
br i1 %25, label %33, label %27
27: ; preds = %26
%28 = load double, double* %22
%29 = sext i32 %20 to i64
%30 = getelementptr inbounds double, double* %3, i64 %29
store double %28, double* %30
%31 = getelementptr inbounds double, double* %2, i64 %18
%32 = load double, double* %31
br label %96
33: ; preds = %26
%34 = icmp eq i64 %18, 0
br i1 %34, label %35, label %39
35: ; preds = %33
%36 = load double, double* %15
%37 = load double, double* %2
%38 = fsub double %37, %36
br label %47
39: ; preds = %33
%40 = add nsw i64 %18, -1
%41 = getelementptr inbounds double, double* %2, i64 %40
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %2, i64 %18
%44 = load double, double* %43
%45 = fsub double %44, %42
%46 = getelementptr inbounds double, double* %1, i64 %40
br label %47
47: ; preds = %39, %35
%48 = phi double* [ %46, %39 ], [ %10, %35 ]
%49 = phi double [ %45, %39 ], [ %38, %35 ]
%50 = phi double* [ %22, %39 ], [ %1, %35 ]
%51 = phi double [ %42, %39 ], [ %36, %35 ]
%52 = load double, double* %48
%53 = fsub double %5, %52
%54 = fmul double %49, %53
%55 = load double, double* %50
%56 = fsub double %55, %52
%57 = fdiv double %54, %56
%58 = fadd double %51, %57
%59 = sext i32 %20 to i64
%60 = getelementptr inbounds double, double* %3, i64 %59
store double %5, double* %60
br label %96
61: ; preds = %17
br i1 %25, label %103, label %62
62: ; preds = %61
%63 = icmp eq i64 %18, 0
br i1 %63, label %64, label %68
64: ; preds = %62
%65 = load double, double* %15
%66 = load double, double* %2
%67 = fsub double %66, %65
br label %76
68: ; preds = %62
%69 = add nsw i64 %18, -1
%70 = getelementptr inbounds double, double* %2, i64 %69
%71 = load double, double* %70
%72 = getelementptr inbounds double, double* %2, i64 %18
%73 = load double, double* %72
%74 = fsub double %73, %71
%75 = getelementptr inbounds double, double* %1, i64 %69
br label %76
76: ; preds = %68, %64
%77 = phi double* [ %75, %68 ], [ %10, %64 ]
%78 = phi double [ %74, %68 ], [ %67, %64 ]
%79 = phi double [ %71, %68 ], [ %65, %64 ]
%80 = load double, double* %77
%81 = fsub double %5, %80
%82 = fmul double %78, %81
%83 = load double, double* %22
%84 = fsub double %83, %80
%85 = fdiv double %82, %84
%86 = fadd double %79, %85
%87 = sext i32 %20 to i64
%88 = getelementptr inbounds double, double* %3, i64 %87
store double %5, double* %88
%89 = getelementptr inbounds double, double* %4, i64 %87
store double %86, double* %89
%90 = add nsw i32 %20, 1
%91 = load double, double* %22
%92 = sext i32 %90 to i64
%93 = getelementptr inbounds double, double* %3, i64 %92
store double %91, double* %93
%94 = getelementptr inbounds double, double* %2, i64 %18
%95 = load double, double* %94
br label %96
96: ; preds = %76, %27, %47
%97 = phi i64 [ %59, %47 ], [ %29, %27 ], [ %92, %76 ]
%98 = phi double [ %58, %47 ], [ %32, %27 ], [ %95, %76 ]
%99 = phi i32 [ 1, %47 ], [ 1, %27 ], [ 2, %76 ]
%100 = phi i32 [ 0, %47 ], [ %19, %27 ], [ 1, %76 ]
%101 = getelementptr inbounds double, double* %4, i64 %97
store double %98, double* %101
%102 = add nsw i32 %20, %99
br label %103
103: ; preds = %96, %61
%104 = phi i32 [ %20, %61 ], [ %102, %96 ]
%105 = phi i32 [ 0, %61 ], [ %100, %96 ]
%106 = add nuw nsw i64 %18, 1
%107 = icmp eq i64 %106, %16
br i1 %107, label %108, label %17
108: ; preds = %103, %7
%109 = phi i32 [ 0, %7 ], [ %104, %103 ]
ret i32 %109
}