#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 */
double cos(double);
double fabs(double);
double sin(double);
int ArcApprox(double radius, double a1, double a2, double curveTolerance,
              double angleTolerance, double *segLen, double *initialAngle,
              double *incrAngle) {
  int i, numSegments = 0, numTries = 0;
  double plineTolerance;
  double curveToChord, arcLen, chordLen, spanLen = 0.0;
  double startTangent, angle;
  double trialAngles[2] = {0.0, 0.0}, trialErrors[2] = {0.0, 0.0};
  double tempAngle;
  if ((angle = a2 - a1) < 0.0)
    angle += 6.2831853071795862320E0;
  curveTolerance = plineTolerance =
      (angle / 6.2831853071795862320E0) * radius * curveTolerance;
  tempAngle = angle / 2.0;
  curveToChord = radius * (1.0 - cos(tempAngle / 2.0));
  for (numSegments = 2;
       (curveToChord >= curveTolerance || tempAngle >= angleTolerance);) {
    numSegments *= 2;
    tempAngle /= 2.0;
    curveToChord = radius * (1.0 - cos(tempAngle / 2.));
  }
  arcLen = radius * angle;
  chordLen = 2.0 * radius * sin(angle / 2.0);
  startTangent = angle / 2.0;
  *segLen = arcLen / numSegments;
  do {
    switch (numTries) {
    case 0:
      *incrAngle = 0.0;
      break;
    case 1:
      trialAngles[0] = *incrAngle;
      trialErrors[0] = spanLen - chordLen;
      *incrAngle = angle / (numSegments - 1);
      break;
    default:
      trialAngles[1] = *incrAngle;
      trialErrors[1] = spanLen - chordLen;
      *incrAngle = (trialAngles[1] - trialAngles[0]) * -trialErrors[1] /
                       (trialErrors[1] - trialErrors[0]) +
                   trialAngles[1];
      trialAngles[0] = trialAngles[1];
      trialErrors[0] = trialErrors[1];
    }
    for (spanLen = 0, i = 0; i < numSegments; i++) {
      *initialAngle = (angle - (numSegments - 1) * *incrAngle) / 2;
      spanLen += cos(startTangent - *initialAngle - i * *incrAngle);
    }
    spanLen *= *segLen;
    numTries++;
  } while (fabs(spanLen - chordLen) > plineTolerance);
  return numSegments;
}


x86 assembly (clang, -O0):
<ArcApprox>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  %xmm1,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11d3 <ArcApprox+0xa3>
movsd  0xe3d(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xe1d(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xe05(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xddc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
movsd  0xdb8(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x2,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0xc1(%rbp)
jae    1292 <ArcApprox+0x162>
movsd  -0xb8(%rbp),%xmm0
ff
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%al
test   $0x1,%al
jne    12a5 <ArcApprox+0x175>
jmp    1315 <ArcApprox+0x1e5>
mov    -0x48(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x48(%rbp)
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xd52(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xd29(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
movsd  0xd05(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1264 <ArcApprox+0x134>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  0xce1(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xcc4(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xc97(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4c(%rbp),%eax
mov    %eax,-0xdc(%rbp)
test   %eax,%eax
je     13c2 <ArcApprox+0x292>
jmp    13ae <ArcApprox+0x27e>
mov    -0xdc(%rbp),%eax
sub    $0x1,%eax
je     13d2 <ArcApprox+0x2a2>
jmp    1417 <ArcApprox+0x2e7>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    14b0 <ArcApprox+0x380>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x48(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    14b0 <ArcApprox+0x380>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
subsd  -0xa0(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0xa8(%rbp),%xmm1
ff
subsd  -0xb0(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
addsd  -0x98(%rbp),%xmm0
ff
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    156e <ArcApprox+0x43e>
movsd  -0x88(%rbp),%xmm1
ff
mov    -0x48(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb04(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm1
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm1
cvtsi2sdl -0x44(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <cos@plt>
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    14bf <ArcApprox+0x38f>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movaps 0xa86(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x58(%rbp),%xmm0
ja     1398 <ArcApprox+0x268>
mov    -0x48(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ArcApprox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,0x58(%rsp)
movsd  %xmm4,0x40(%rsp)
movsd  %xmm0,(%rsp)
subsd  %xmm1,%xmm2
movsd  0xead(%rip),%xmm6
movapd %xmm2,%xmm1
addsd  %xmm6,%xmm1
xorpd  %xmm4,%xmm4
movapd %xmm2,%xmm5
cmpltsd %xmm4,%xmm5
andpd  %xmm5,%xmm1
andnpd %xmm2,%xmm5
orpd   %xmm1,%xmm5
movapd %xmm5,%xmm1
divsd  %xmm6,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm1,0x70(%rsp)
movsd  0xe76(%rip),%xmm1
movapd %xmm5,0x60(%rsp)
movapd %xmm5,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0xe59(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  (%rsp),%xmm1
ucomisd 0x70(%rsp),%xmm1
jae    11dc <ArcApprox+0xbc>
mov    $0x2,%r12d
movapd 0x10(%rsp),%xmm0
ucomisd 0x40(%rsp),%xmm0
jb     1239 <ArcApprox+0x119>
mov    $0x2,%r12d
movapd 0x10(%rsp),%xmm2
nopl   0x0(%rax,%rax,1)
add    %r12d,%r12d
movsd  0xe0d(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm2
movsd  0xdf0(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  (%rsp),%xmm1
ucomisd 0x70(%rsp),%xmm1
jae    11f0 <ArcApprox+0xd0>
ucomisd 0x40(%rsp),%xmm2
jae    11f0 <ArcApprox+0xd0>
movapd 0x60(%rsp),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x60(%rsp),%xmm3
xorps  %xmm1,%xmm1
cvtsi2sd %r12d,%xmm1
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
lea    -0x1(%r12),%r15d
xorps  %xmm5,%xmm5
cvtsi2sd %r15d,%xmm5
movsd  0x8(%rsp),%xmm2
divsd  %xmm1,%xmm2
movapd %xmm3,%xmm0
divsd  %xmm5,%xmm0
movsd  %xmm0,0x80(%rsp)
xorpd  0xd85(%rip),%xmm5
mov    0x58(%rsp),%rax
movsd  %xmm2,(%rax)
xor    %ebp,%ebp
xorpd  %xmm6,%xmm6
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0xd32(%rip),%xmm4
movapd %xmm5,0x40(%rsp)
jmp    130e <ArcApprox+0x1ee>
xchg   %ax,%ax
xorpd  %xmm6,%xmm6
mov    0x58(%rsp),%rax
mulsd  (%rax),%xmm6
add    $0x1,%ebp
movapd %xmm6,%xmm0
subsd  0x38(%rsp),%xmm0
andpd  0xd3e(%rip),%xmm0
ucomisd 0x70(%rsp),%xmm0
jbe    1461 <ArcApprox+0x341>
test   %ebp,%ebp
je     1340 <ArcApprox+0x220>
cmp    $0x1,%ebp
jne    1350 <ArcApprox+0x230>
movsd  (%rbx),%xmm0
movsd  %xmm0,0x30(%rsp)
subsd  0x38(%rsp),%xmm6
movsd  0x80(%rsp),%xmm0
jmp    1380 <ArcApprox+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
jmp    1386 <ArcApprox+0x266>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rbx),%xmm0
subsd  0x38(%rsp),%xmm6
movapd %xmm0,%xmm1
subsd  0x30(%rsp),%xmm1
mulsd  %xmm6,%xmm1
movapd %xmm6,%xmm2
subsd  0x28(%rsp),%xmm2
divsd  %xmm2,%xmm1
movsd  %xmm0,0x30(%rsp)
subsd  %xmm1,%xmm0
movsd  %xmm6,0x28(%rsp)
movapd 0x10(%rsp),%xmm1
movsd  %xmm0,(%rbx)
test   %r12d,%r12d
je     12e0 <ArcApprox+0x1c0>
mulsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm4,%xmm0
movsd  %xmm0,(%r14)
subsd  %xmm0,%xmm1
movsd  (%rbx),%xmm0
mulsd  0xc5e(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1040 <cos@plt>
movapd 0x40(%rsp),%xmm5
movsd  0xc37(%rip),%xmm4
movapd 0x60(%rsp),%xmm3
movapd %xmm0,%xmm6
addsd  0xc3d(%rip),%xmm6
mov    %r15d,%r13d
movsd  0xc22(%rip),%xmm2
xchg   %ax,%ax
movsd  %xmm2,(%rsp)
movsd  %xmm6,0x8(%rsp)
movsd  (%rbx),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm4,%xmm1
movsd  %xmm1,(%r14)
movapd 0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  (%rbx),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm6
movapd 0x40(%rsp),%xmm5
movsd  0xbc4(%rip),%xmm4
movapd 0x60(%rsp),%xmm3
addsd  %xmm0,%xmm6
addsd  0xbba(%rip),%xmm2
add    $0xffffffff,%r13d
jne    13f0 <ArcApprox+0x2d0>
jmp    12e4 <ArcApprox+0x1c4>
mov    %r12d,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ArcApprox(double %0, double %1, double %2, double %3, double %4, double* %5, double* %6, double* %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca [2 x double]
%28 = alloca [2 x double]
%29 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
store i32 0, i32* %18
store i32 0, i32* %19
store double 0.000000e+00, double* %24
%30 = bitcast [2 x double]* %27 to i8*
%31 = bitcast [2 x double]* %28 to i8*
%32 = load double, double* %11
%33 = load double, double* %10
%34 = fsub double %32, %33
store double %34, double* %26
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %39
36: ; preds = %8
%37 = load double, double* %26
%38 = fadd double %37, 0x401921FB54442D18
store double %38, double* %26
br label %39
39: ; preds = %36, %8
%40 = load double, double* %26
%41 = fdiv double %40, 0x401921FB54442D18
%42 = load double, double* %9
%43 = fmul double %41, %42
%44 = load double, double* %12
%45 = fmul double %43, %44
store double %45, double* %20
store double %45, double* %12
%46 = load double, double* %26
%47 = fdiv double %46, 2.000000e+00
store double %47, double* %29
%48 = load double, double* %9
%49 = load double, double* %29
%50 = fdiv double %49, 2.000000e+00
%51 = call double @cos(double %50)
%52 = fsub double 1.000000e+00, %51
%53 = fmul double %48, %52
store double %53, double* %21
store i32 2, i32* %18
br label %54
54: ; preds = %64, %39
%55 = load double, double* %21
%56 = load double, double* %12
%57 = fcmp oge double %55, %56
br i1 %57, label %62, label %58
58: ; preds = %54
%59 = load double, double* %29
%60 = load double, double* %13
%61 = fcmp oge double %59, %60
br label %62
62: ; preds = %58, %54
%63 = phi i1 [ true, %54 ], [ %61, %58 ]
br i1 %63, label %64, label %75
64: ; preds = %62
%65 = load i32, i32* %18
%66 = mul nsw i32 %65, 2
store i32 %66, i32* %18
%67 = load double, double* %29
%68 = fdiv double %67, 2.000000e+00
store double %68, double* %29
%69 = load double, double* %9
%70 = load double, double* %29
%71 = fdiv double %70, 2.000000e+00
%72 = call double @cos(double %71)
%73 = fsub double 1.000000e+00, %72
%74 = fmul double %69, %73
store double %74, double* %21
br label %54
75: ; preds = %62
%76 = load double, double* %9
%77 = load double, double* %26
%78 = fmul double %76, %77
store double %78, double* %22
%79 = load double, double* %9
%80 = fmul double 2.000000e+00, %79
%81 = load double, double* %26
%82 = fdiv double %81, 2.000000e+00
%83 = call double @sin(double %82)
%84 = fmul double %80, %83
store double %84, double* %23
%85 = load double, double* %26
%86 = fdiv double %85, 2.000000e+00
store double %86, double* %25
%87 = load double, double* %22
%88 = load i32, i32* %18
%89 = sitofp i32 %88 to double
%90 = fdiv double %87, %89
%91 = load double*, double** %14
store double %90, double* %91
br label %92
92: ; preds = %182, %75
%93 = load i32, i32* %19
switch i32 %93, label %110 [
i32 0, label %94
i32 1, label %96
]
94: ; preds = %92
%95 = load double*, double** %16
store double 0.000000e+00, double* %95
br label %143
96: ; preds = %92
%97 = load double*, double** %16
%98 = load double, double* %97
%99 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 0
store double %98, double* %99
%100 = load double, double* %24
%101 = load double, double* %23
%102 = fsub double %100, %101
%103 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 0
store double %102, double* %103
%104 = load double, double* %26
%105 = load i32, i32* %18
%106 = sub nsw i32 %105, 1
%107 = sitofp i32 %106 to double
%108 = fdiv double %104, %107
%109 = load double*, double** %16
store double %108, double* %109
br label %143
110: ; preds = %92
%111 = load double*, double** %16
%112 = load double, double* %111
%113 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 1
store double %112, double* %113
%114 = load double, double* %24
%115 = load double, double* %23
%116 = fsub double %114, %115
%117 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 1
store double %116, double* %117
%118 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 1
%119 = load double, double* %118
%120 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 0
%121 = load double, double* %120
%122 = fsub double %119, %121
%123 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 1
%124 = load double, double* %123
%125 = fneg double %124
%126 = fmul double %122, %125
%127 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 1
%128 = load double, double* %127
%129 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 0
%130 = load double, double* %129
%131 = fsub double %128, %130
%132 = fdiv double %126, %131
%133 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 1
%134 = load double, double* %133
%135 = fadd double %132, %134
%136 = load double*, double** %16
store double %135, double* %136
%137 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 1
%138 = load double, double* %137
%139 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 0
store double %138, double* %139
%140 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 1
%141 = load double, double* %140
%142 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 0
store double %141, double* %142
br label %143
143: ; preds = %110, %96, %94
store double 0.000000e+00, double* %24
store i32 0, i32* %17
br label %144
144: ; preds = %172, %143
%145 = load i32, i32* %17
%146 = load i32, i32* %18
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %175
148: ; preds = %144
%149 = load double, double* %26
%150 = load i32, i32* %18
%151 = sub nsw i32 %150, 1
%152 = sitofp i32 %151 to double
%153 = load double*, double** %16
%154 = load double, double* %153
%155 = fneg double %152
%156 = call double @llvm.fmuladd.f64(double %155, double %154, double %149)
%157 = fdiv double %156, 2.000000e+00
%158 = load double*, double** %15
store double %157, double* %158
%159 = load double, double* %25
%160 = load double*, double** %15
%161 = load double, double* %160
%162 = fsub double %159, %161
%163 = load i32, i32* %17
%164 = sitofp i32 %163 to double
%165 = load double*, double** %16
%166 = load double, double* %165
%167 = fneg double %164
%168 = call double @llvm.fmuladd.f64(double %167, double %166, double %162)
%169 = call double @cos(double %168)
%170 = load double, double* %24
%171 = fadd double %170, %169
store double %171, double* %24
br label %172
172: ; preds = %148
%173 = load i32, i32* %17
%174 = add nsw i32 %173, 1
store i32 %174, i32* %17
br label %144
175: ; preds = %144
%176 = load double*, double** %14
%177 = load double, double* %176
%178 = load double, double* %24
%179 = fmul double %178, %177
store double %179, double* %24
%180 = load i32, i32* %19
%181 = add nsw i32 %180, 1
store i32 %181, i32* %19
br label %182
182: ; preds = %175
%183 = load double, double* %24
%184 = load double, double* %23
%185 = fsub double %183, %184
%186 = call double @llvm.fabs.f64(double %185)
%187 = load double, double* %20
%188 = fcmp ogt double %186, %187
br i1 %188, label %92, label %189
189: ; preds = %182
%190 = load i32, i32* %18
ret i32 %190
}

LLVM IR (-O2):
define i32 @ArcApprox(double %0, double %1, double %2, double %3, double %4, double* nocapture %5, double* nocapture writeonly %6, double* nocapture %7) {
%9 = fsub double %2, %1
%10 = fcmp olt double %9, 0.000000e+00
%11 = fadd double %9, 0x401921FB54442D18
%12 = select i1 %10, double %11, double %9
%13 = fdiv double %12, 0x401921FB54442D18
%14 = fmul double %13, %0
%15 = fmul double %14, %3
%16 = fmul double %12, 5.000000e-01
%17 = fmul double %16, 5.000000e-01
%18 = tail call double @cos(double %17)
%19 = fsub double 1.000000e+00, %18
%20 = fmul double %19, %0
%21 = fcmp oge double %20, %15
%22 = fcmp oge double %16, %4
%23 = or i1 %21, %22
br i1 %23, label %24, label %36
24: ; preds = %8, %24
%25 = phi double [ %28, %24 ], [ %16, %8 ]
%26 = phi i32 [ %27, %24 ], [ 2, %8 ]
%27 = shl nsw i32 %26, 1
%28 = fmul double %25, 5.000000e-01
%29 = fmul double %28, 5.000000e-01
%30 = tail call double @cos(double %29)
%31 = fsub double 1.000000e+00, %30
%32 = fmul double %31, %0
%33 = fcmp oge double %32, %15
%34 = fcmp oge double %28, %4
%35 = select i1 %33, i1 true, i1 %34
br i1 %35, label %24, label %36
36: ; preds = %24, %8
%37 = phi i32 [ 2, %8 ], [ %27, %24 ]
%38 = fmul double %12, %0
%39 = fmul double %0, 2.000000e+00
%40 = tail call double @sin(double %16)
%41 = fmul double %39, %40
%42 = sitofp i32 %37 to double
%43 = fdiv double %38, %42
store double %43, double* %5
%44 = icmp eq i32 %37, 0
%45 = add nsw i32 %37, -1
%46 = sitofp i32 %45 to double
%47 = fdiv double %12, %46
%48 = fneg double %46
br label %49
49: ; preds = %93, %36
%50 = phi i32 [ 0, %36 ], [ %97, %93 ]
%51 = phi double [ 0.000000e+00, %36 ], [ %96, %93 ]
%52 = phi double [ 0.000000e+00, %36 ], [ %68, %93 ]
%53 = phi double [ 0.000000e+00, %36 ], [ %69, %93 ]
switch i32 %50, label %57 [
i32 0, label %66
i32 1, label %54
]
54: ; preds = %49
%55 = load double, double* %7
%56 = fsub double %51, %41
br label %66
57: ; preds = %49
%58 = load double, double* %7
%59 = fsub double %51, %41
%60 = fsub double %58, %52
%61 = fneg double %59
%62 = fmul double %60, %61
%63 = fsub double %59, %53
%64 = fdiv double %62, %63
%65 = fadd double %58, %64
br label %66
66: ; preds = %49, %57, %54
%67 = phi double [ %65, %57 ], [ %47, %54 ], [ 0.000000e+00, %49 ]
%68 = phi double [ %58, %57 ], [ %55, %54 ], [ %52, %49 ]
%69 = phi double [ %59, %57 ], [ %56, %54 ], [ %53, %49 ]
store double %67, double* %7
br i1 %44, label %93, label %70
70: ; preds = %66
%71 = tail call double @llvm.fmuladd.f64(double %48, double %67, double %12)
%72 = fmul double %71, 5.000000e-01
store double %72, double* %6
%73 = fsub double %16, %72
%74 = load double, double* %7
%75 = tail call double @llvm.fmuladd.f64(double %74, double -0.000000e+00, double %73)
%76 = tail call double @cos(double %75)
%77 = fadd double %76, 0.000000e+00
br label %78
78: ; preds = %70, %78
%79 = phi i32 [ 1, %70 ], [ %91, %78 ]
%80 = phi double [ %77, %70 ], [ %90, %78 ]
%81 = load double, double* %7
%82 = tail call double @llvm.fmuladd.f64(double %48, double %81, double %12)
%83 = fmul double %82, 5.000000e-01
store double %83, double* %6
%84 = fsub double %16, %83
%85 = sitofp i32 %79 to double
%86 = load double, double* %7
%87 = fneg double %85
%88 = tail call double @llvm.fmuladd.f64(double %87, double %86, double %84)
%89 = tail call double @cos(double %88)
%90 = fadd double %80, %89
%91 = add nuw nsw i32 %79, 1
%92 = icmp eq i32 %91, %37
br i1 %92, label %93, label %78
93: ; preds = %78, %66
%94 = phi double [ 0.000000e+00, %66 ], [ %90, %78 ]
%95 = load double, double* %5
%96 = fmul double %94, %95
%97 = add nuw nsw i32 %50, 1
%98 = fsub double %96, %41
%99 = tail call double @llvm.fabs.f64(double %98)
%100 = fcmp ogt double %99, %15
br i1 %100, label %49, label %101
101: ; preds = %93
ret i32 %37
}