#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 M_PI;
double cos(double);
double sin(double);
int matFitHelix(double p1[3], double p2[3], double p3[3], double ret[3]) {
  double A, B, C, D;
  double P, Q;
  double U, V, W;
  A = 2.3 * cos(2.0 * M_PI / 3.6);
  B = 2.3 * sin(2.0 * M_PI / 3.6);
  C = 2.3 * cos(4.0 * M_PI / 3.6);
  D = 2.3 * sin(4.0 * M_PI / 3.6);
  P = 2.0 * A - 2.3 - C;
  Q = 2.0 * B - D;
  U = 2 * p2[0] - p1[0] - p3[0];
  V = 2 * p2[1] - p1[1] - p3[1];
  W = 2 * p2[2] - p1[2] - p3[2];
  return 0;
}


x86 assembly (clang, -O0):
<matFitHelix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  0xee0(%rip),%xmm0
mov    0x2ea1(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xebd(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xea1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea8(%rip),%xmm0
mov    0x2e69(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe85(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe69(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe68(%rip),%xmm0
mov    0x2e31(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe4d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe30(%rip),%xmm0
mov    0x2df9(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe15(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xdd7(%rip),%xmm1
addsd  %xmm1,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matFitHelix>:
push   %rbx
mov    0x2ec0(%rip),%rbx
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xec4(%rip),%xmm1
ucomisd 0xec4(%rip),%xmm1
jae    11b0 <matFitHelix+0x90>
movsd  0xec2(%rip),%xmm2
ucomisd %xmm1,%xmm2
jae    11b0 <matFitHelix+0x90>
ucomisd 0xeac(%rip),%xmm1
jae    11d7 <matFitHelix+0xb7>
movsd  0xeaa(%rip),%xmm2
ucomisd %xmm1,%xmm2
jae    11d7 <matFitHelix+0xb7>
mulsd  0xea4(%rip),%xmm0
divsd  0xe84(%rip),%xmm0
ucomisd 0xe84(%rip),%xmm0
jae    11e6 <matFitHelix+0xc6>
movsd  0xe82(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11e6 <matFitHelix+0xc6>
ucomisd 0xe6c(%rip),%xmm0
jae    1209 <matFitHelix+0xe9>
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1209 <matFitHelix+0xe9>
xor    %eax,%eax
pop    %rbx
ret
movapd %xmm1,%xmm0
call   1040 <cos@plt>
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xe33(%rip),%xmm1
ucomisd 0xe33(%rip),%xmm1
jb     115e <matFitHelix+0x3e>
movapd %xmm1,%xmm0
call   1030 <sin@plt>
movsd  (%rbx),%xmm0
jmp    116c <matFitHelix+0x4c>
call   1040 <cos@plt>
movsd  (%rbx),%xmm0
mulsd  0xe21(%rip),%xmm0
divsd  0xe01(%rip),%xmm0
ucomisd 0xe01(%rip),%xmm0
jb     119e <matFitHelix+0x7e>
call   1030 <sin@plt>
jmp    11ac <matFitHelix+0x8c>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @matFitHelix(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%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 double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%18 = load double, double* @M_PI
%19 = fmul double 2.000000e+00, %18
%20 = fdiv double %19, 3.600000e+00
%21 = call double @cos(double %20)
%22 = fmul double 2.300000e+00, %21
store double %22, double* %9
%23 = load double, double* @M_PI
%24 = fmul double 2.000000e+00, %23
%25 = fdiv double %24, 3.600000e+00
%26 = call double @sin(double %25)
%27 = fmul double 2.300000e+00, %26
store double %27, double* %10
%28 = load double, double* @M_PI
%29 = fmul double 4.000000e+00, %28
%30 = fdiv double %29, 3.600000e+00
%31 = call double @cos(double %30)
%32 = fmul double 2.300000e+00, %31
store double %32, double* %11
%33 = load double, double* @M_PI
%34 = fmul double 4.000000e+00, %33
%35 = fdiv double %34, 3.600000e+00
%36 = call double @sin(double %35)
%37 = fmul double 2.300000e+00, %36
store double %37, double* %12
%38 = load double, double* %9
%39 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %38, double -2.300000e+00)
%40 = load double, double* %11
%41 = fsub double %39, %40
store double %41, double* %13
%42 = load double, double* %10
%43 = load double, double* %12
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %42, double %44)
store double %45, double* %14
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = load double*, double** %5
%50 = getelementptr inbounds double, double* %49, i64 0
%51 = load double, double* %50
%52 = fneg double %51
%53 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %48, double %52)
%54 = load double*, double** %7
%55 = getelementptr inbounds double, double* %54, i64 0
%56 = load double, double* %55
%57 = fsub double %53, %56
store double %57, double* %15
%58 = load double*, double** %6
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 1
%63 = load double, double* %62
%64 = fneg double %63
%65 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %60, double %64)
%66 = load double*, double** %7
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = fsub double %65, %68
store double %69, double* %16
%70 = load double*, double** %6
%71 = getelementptr inbounds double, double* %70, i64 2
%72 = load double, double* %71
%73 = load double*, double** %5
%74 = getelementptr inbounds double, double* %73, i64 2
%75 = load double, double* %74
%76 = fneg double %75
%77 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %72, double %76)
%78 = load double*, double** %7
%79 = getelementptr inbounds double, double* %78, i64 2
%80 = load double, double* %79
%81 = fsub double %77, %80
store double %81, double* %17
ret i32 0
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @matFitHelix(double* nocapture readnone %0, double* nocapture readnone %1, double* nocapture readnone %2, double* nocapture readnone %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, 2.000000e+00
%7 = fdiv double %6, 3.600000e+00
%8 = fcmp oeq double %7, 0xFFF0000000000000
%9 = fcmp oeq double %7, 0x7FF0000000000000
%10 = or i1 %9, %8
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = tail call double @cos(double %7)
%13 = load double, double* @M_PI
%14 = fmul double %13, 2.000000e+00
%15 = fdiv double %14, 3.600000e+00
br label %16
16: ; preds = %4, %11
%17 = phi double [ %7, %4 ], [ %15, %11 ]
%18 = phi double [ %5, %4 ], [ %13, %11 ]
%19 = fcmp oeq double %17, 0xFFF0000000000000
%20 = fcmp oeq double %17, 0x7FF0000000000000
%21 = or i1 %20, %19
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = tail call double @sin(double %17)
%24 = load double, double* @M_PI
br label %25
25: ; preds = %16, %22
%26 = phi double [ %18, %16 ], [ %24, %22 ]
%27 = fmul double %26, 4.000000e+00
%28 = fdiv double %27, 3.600000e+00
%29 = fcmp oeq double %28, 0xFFF0000000000000
%30 = fcmp oeq double %28, 0x7FF0000000000000
%31 = or i1 %30, %29
br i1 %31, label %32, label %37
32: ; preds = %25
%33 = tail call double @cos(double %28)
%34 = load double, double* @M_PI
%35 = fmul double %34, 4.000000e+00
%36 = fdiv double %35, 3.600000e+00
br label %37
37: ; preds = %25, %32
%38 = phi double [ %28, %25 ], [ %36, %32 ]
%39 = fcmp oeq double %38, 0xFFF0000000000000
%40 = fcmp oeq double %38, 0x7FF0000000000000
%41 = or i1 %40, %39
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = tail call double @sin(double %38)
br label %44
44: ; preds = %37, %42
ret i32 0
}