#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);
double orbitalDopp(double t1, double t2, double doppzero, double orbitper,
                   double doppmag) {
  double shift;
  if (doppmag <= 0.)
    return 0.;
  orbitper /= (86400.);
  if (fabs(t2 - t1) < 1.e-4) {
    double t = (t1 + t2) / 2.;
    shift = doppmag *
            sin((t - doppzero) * 2 * (3.1415926535897932384626433) / orbitper);
  } else {
    shift =
        doppmag * orbitper / (2. * (3.1415926535897932384626433)) *
        (cos((t1 - doppzero) * 2. * (3.1415926535897932384626433) / orbitper) -
         cos((t2 - doppzero) * 2. * (3.1415926535897932384626433) / orbitper)) /
        (t2 - t1);
  }
  return (shift / 2.);
}


x86 assembly (clang, -O0):
<orbitalDopp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jb     115c <orbitalDopp+0x3c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b6 <orbitalDopp+0x196>
movsd  -0x28(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movaps 0xead(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe71(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1200 <orbitalDopp+0xe0>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    12a0 <orbitalDopp+0x180>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe0e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xdeb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xdba(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda6(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xd6b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orbitalDopp>:
xorpd  %xmm5,%xmm5
ucomisd %xmm4,%xmm5
jae    1224 <orbitalDopp+0x104>
sub    $0x48,%rsp
divsd  0xec6(%rip),%xmm3
movapd %xmm1,%xmm7
subsd  %xmm0,%xmm7
movapd 0xee6(%rip),%xmm5
andpd  %xmm7,%xmm5
movsd  0xeb2(%rip),%xmm6
ucomisd %xmm5,%xmm6
jbe    1196 <orbitalDopp+0x76>
addsd  %xmm1,%xmm0
mulsd  0xeb8(%rip),%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
mulsd  0xea0(%rip),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm4,0x8(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm5
mulsd  0x8(%rsp),%xmm5
jmp    1218 <orbitalDopp+0xf8>
mulsd  %xmm3,%xmm4
divsd  0xe6e(%rip),%xmm4
movsd  %xmm4,0x8(%rsp)
subsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
mulsd  0xe60(%rip),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm3,0x20(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,0x18(%rsp)
movapd %xmm7,0x30(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
mulsd  0xe21(%rip),%xmm0
divsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x28(%rsp),%xmm5
subsd  %xmm0,%xmm5
mulsd  0x8(%rsp),%xmm5
divsd  0x30(%rsp),%xmm5
mulsd  0xe00(%rip),%xmm5
add    $0x48,%rsp
movapd %xmm5,%xmm0
ret

LLVM IR (-O0):
define double @orbitalDopp(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
%14 = load double, double* %11
%15 = fcmp ole double %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %5
store double 0.000000e+00, double* %6
br label %70
17: ; preds = %5
%18 = load double, double* %10
%19 = fdiv double %18, 8.640000e+04
store double %19, double* %10
%20 = load double, double* %8
%21 = load double, double* %7
%22 = fsub double %20, %21
%23 = call double @llvm.fabs.f64(double %22)
%24 = fcmp olt double %23, 1.000000e-04
br i1 %24, label %25, label %40
25: ; preds = %17
%26 = load double, double* %7
%27 = load double, double* %8
%28 = fadd double %26, %27
%29 = fdiv double %28, 2.000000e+00
store double %29, double* %13
%30 = load double, double* %11
%31 = load double, double* %13
%32 = load double, double* %9
%33 = fsub double %31, %32
%34 = fmul double %33, 2.000000e+00
%35 = fmul double %34, 0x400921FB54442D18
%36 = load double, double* %10
%37 = fdiv double %35, %36
%38 = call double @sin(double %37)
%39 = fmul double %30, %38
store double %39, double* %12
br label %67
40: ; preds = %17
%41 = load double, double* %11
%42 = load double, double* %10
%43 = fmul double %41, %42
%44 = fdiv double %43, 0x401921FB54442D18
%45 = load double, double* %7
%46 = load double, double* %9
%47 = fsub double %45, %46
%48 = fmul double %47, 2.000000e+00
%49 = fmul double %48, 0x400921FB54442D18
%50 = load double, double* %10
%51 = fdiv double %49, %50
%52 = call double @cos(double %51)
%53 = load double, double* %8
%54 = load double, double* %9
%55 = fsub double %53, %54
%56 = fmul double %55, 2.000000e+00
%57 = fmul double %56, 0x400921FB54442D18
%58 = load double, double* %10
%59 = fdiv double %57, %58
%60 = call double @cos(double %59)
%61 = fsub double %52, %60
%62 = fmul double %44, %61
%63 = load double, double* %8
%64 = load double, double* %7
%65 = fsub double %63, %64
%66 = fdiv double %62, %65
store double %66, double* %12
br label %67
67: ; preds = %40, %25
%68 = load double, double* %12
%69 = fdiv double %68, 2.000000e+00
store double %69, double* %6
br label %70
70: ; preds = %67, %16
%71 = load double, double* %6
ret double %71
}

LLVM IR (-O2):
define double @orbitalDopp(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp ugt double %4, 0.000000e+00
br i1 %6, label %7, label %40
7: ; preds = %5
%8 = fdiv double %3, 8.640000e+04
%9 = fsub double %1, %0
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fcmp olt double %10, 1.000000e-04
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = fadd double %0, %1
%14 = fmul double %13, 5.000000e-01
%15 = fsub double %14, %2
%16 = fmul double %15, 2.000000e+00
%17 = fmul double %16, 0x400921FB54442D18
%18 = fdiv double %17, %8
%19 = tail call double @sin(double %18)
%20 = fmul double %19, %4
br label %37
21: ; preds = %7
%22 = fmul double %8, %4
%23 = fdiv double %22, 0x401921FB54442D18
%24 = fsub double %0, %2
%25 = fmul double %24, 2.000000e+00
%26 = fmul double %25, 0x400921FB54442D18
%27 = fdiv double %26, %8
%28 = tail call double @cos(double %27)
%29 = fsub double %1, %2
%30 = fmul double %29, 2.000000e+00
%31 = fmul double %30, 0x400921FB54442D18
%32 = fdiv double %31, %8
%33 = tail call double @cos(double %32)
%34 = fsub double %28, %33
%35 = fmul double %23, %34
%36 = fdiv double %35, %9
br label %37
37: ; preds = %21, %12
%38 = phi double [ %20, %12 ], [ %36, %21 ]
%39 = fmul double %38, 5.000000e-01
br label %40
40: ; preds = %5, %37
%41 = phi double [ %39, %37 ], [ 0.000000e+00, %5 ]
ret double %41
}