#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 sin(double);
double sqrt(double);
void GPS_ComputeSatelliteClockCorrectionAndDrift(
    const unsigned short transmission_gpsweek, const double transmission_gpstow,
    const unsigned short ephem_week, const unsigned toe, const unsigned toc,
    const double af0, const double af1, const double af2, const double ecc,
    const double sqrta, const double delta_n, const double m0, const double tgd,
    const unsigned char mode, double *clock_correction, double *clock_drift) {
  unsigned char i;
  double tot;
  double tk;
  double tc;
  double d_tr;
  double d_tsv;
  double a;
  double n;
  double M;
  double E;
  tot = transmission_gpsweek * (604800.0) + transmission_gpstow;
  tk = tot - (ephem_week * (604800.0) + toe);
  tc = tot - (ephem_week * (604800.0) + toc);
  a = sqrta * sqrta;
  n = sqrt((3.986005e14) / (a * a * a));
  n += delta_n;
  M = m0 + n * tk;
  E = M;
  for (i = 0; i < 7; i++) {
    E = M + ecc * sin(E);
  }
  d_tr = (-4.442807633e-10) * ecc * sqrta * sin(E);
  d_tr *= (299792458.0);
  d_tsv = af0 + af1 * tc + af2 * tc * tc;
  if (mode == 0) {
    d_tsv -= tgd;
  } else if (mode == 1) {
    d_tsv -= tgd * (1.6469444444444444444444444444444);
  }
  *clock_correction = d_tsv * (299792458.0) + d_tr;
  *clock_drift = (af1 + 2.0 * af2 * tc) * (299792458.0);
}


x86 assembly (clang, -O0):
<GPS_ComputeSatelliteClockCorrectionAndDrift>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %r8b,%al
mov    0x18(%rbp),%r8
movsd  0x10(%rbp),%xmm8
mov    %di,-0x2(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %si,-0x12(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
movsd  %xmm6,-0x50(%rbp)
movsd  %xmm7,-0x58(%rbp)
mov    %al,-0x59(%rbp)
mov    %r9,-0x68(%rbp)
movzwl -0x2(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe7e(%rip),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movzwl -0x12(%rbp),%eax
cvtsi2sd %eax,%xmm1
mov    -0x18(%rbp),%eax
cvtsi2sd %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
movzwl -0x12(%rbp),%eax
cvtsi2sd %eax,%xmm1
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm2
movsd  0xe2e(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
movsd  0xde0(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x58(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movb   $0x0,-0x69(%rbp)
movzbl -0x69(%rbp),%eax
cmp    $0x7,%eax
jge    12e3 <GPS_ComputeSatelliteClockCorrectionAndDrift+0x1c3>
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
call   1030 <sin@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x69(%rbp),%al
add    $0x1,%al
mov    %al,-0x69(%rbp)
jmp    127c <GPS_ComputeSatelliteClockCorrectionAndDrift+0x15c>
movsd  0xd2d(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xce7(%rip),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movzbl -0x59(%rbp),%eax
cmp    $0x0,%eax
jne    13a3 <GPS_ComputeSatelliteClockCorrectionAndDrift+0x283>
movsd  0x10(%rbp),%xmm1
movsd  -0x98(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    13f1 <GPS_ComputeSatelliteClockCorrectionAndDrift+0x2d1>
movzbl -0x59(%rbp),%eax
cmp    $0x1,%eax
jne    13ec <GPS_ComputeSatelliteClockCorrectionAndDrift+0x2cc>
movsd  0x10(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xc44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    13f1 <GPS_ComputeSatelliteClockCorrectionAndDrift+0x2d1>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
movsd  0xc07(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x68(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm1
movsd  0xc02(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xbcd(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPS_ComputeSatelliteClockCorrectionAndDrift>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
movd   %edi,%xmm8
pinsrw $0x2,%esi,%xmm8
cvtdq2pd %xmm8,%xmm8
mov    %r9,%rbx
mov    %r8d,%ebp
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,0x48(%rsp)
movsd  %xmm2,0x40(%rsp)
movsd  %xmm1,0x30(%rsp)
mov    %edx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movapd %xmm8,%xmm2
unpckhpd %xmm8,%xmm2
mulsd  0xe8e(%rip),%xmm2
addsd  %xmm1,%xmm2
mov    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
unpcklpd %xmm1,%xmm0
mulpd  0xea3(%rip),%xmm8
addpd  %xmm0,%xmm8
movapd %xmm8,0x10(%rsp)
subsd  %xmm2,%xmm8
movsd  %xmm5,0x38(%rsp)
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe48(%rip),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d4 <GPS_ComputeSatelliteClockCorrectionAndDrift+0xb4>
sqrtsd %xmm0,%xmm0
jmp    11fd <GPS_ComputeSatelliteClockCorrectionAndDrift+0xdd>
movsd  %xmm7,(%rsp)
movsd  %xmm6,0x28(%rsp)
movapd %xmm8,0x50(%rsp)
call   1040 <sqrt@plt>
movapd 0x50(%rsp),%xmm8
movsd  0x28(%rsp),%xmm6
movsd  (%rsp),%xmm7
mov    0x88(%rsp),%r14
addsd  %xmm6,%xmm0
mulsd  %xmm8,%xmm0
addsd  %xmm7,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
subsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
call   1030 <sin@plt>
movapd 0x10(%rsp),%xmm4
movsd  0x40(%rsp),%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm4,%xmm2
addsd  0x30(%rsp),%xmm2
movapd %xmm4,%xmm1
movsd  0x48(%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm2,%xmm1
cmp    $0x1,%bpl
je     12ea <GPS_ComputeSatelliteClockCorrectionAndDrift+0x1ca>
test   %bpl,%bpl
jne    12ff <GPS_ComputeSatelliteClockCorrectionAndDrift+0x1df>
subsd  0x80(%rsp),%xmm1
jmp    12ff <GPS_ComputeSatelliteClockCorrectionAndDrift+0x1df>
movsd  0x80(%rsp),%xmm2
mulsd  0xd15(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  0xd0b(%rip),%xmm2
mulsd  0x38(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xd01(%rip),%xmm0
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
addsd  %xmm3,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm5,%xmm3
mulsd  %xmm0,%xmm3
movsd  %xmm3,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @GPS_ComputeSatelliteClockCorrectionAndDrift(i16 zeroext %0, double %1, i16 zeroext %2, i32 %3, i32 %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, i8 zeroext %13, double* %14, double* %15) {
%17 = alloca i16
%18 = alloca double
%19 = alloca i16
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca i8
%31 = alloca double*
%32 = alloca double*
%33 = alloca i8
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
%40 = alloca double
%41 = alloca double
%42 = alloca double
store i16 %0, i16* %17
store double %1, double* %18
store i16 %2, i16* %19
store i32 %3, i32* %20
store i32 %4, i32* %21
store double %5, double* %22
store double %6, double* %23
store double %7, double* %24
store double %8, double* %25
store double %9, double* %26
store double %10, double* %27
store double %11, double* %28
store double %12, double* %29
store i8 %13, i8* %30
store double* %14, double** %31
store double* %15, double** %32
%43 = load i16, i16* %17
%44 = zext i16 %43 to i32
%45 = sitofp i32 %44 to double
%46 = load double, double* %18
%47 = call double @llvm.fmuladd.f64(double %45, double 6.048000e+05, double %46)
store double %47, double* %34
%48 = load double, double* %34
%49 = load i16, i16* %19
%50 = zext i16 %49 to i32
%51 = sitofp i32 %50 to double
%52 = load i32, i32* %20
%53 = uitofp i32 %52 to double
%54 = call double @llvm.fmuladd.f64(double %51, double 6.048000e+05, double %53)
%55 = fsub double %48, %54
store double %55, double* %35
%56 = load double, double* %34
%57 = load i16, i16* %19
%58 = zext i16 %57 to i32
%59 = sitofp i32 %58 to double
%60 = load i32, i32* %21
%61 = uitofp i32 %60 to double
%62 = call double @llvm.fmuladd.f64(double %59, double 6.048000e+05, double %61)
%63 = fsub double %56, %62
store double %63, double* %36
%64 = load double, double* %26
%65 = load double, double* %26
%66 = fmul double %64, %65
store double %66, double* %39
%67 = load double, double* %39
%68 = load double, double* %39
%69 = fmul double %67, %68
%70 = load double, double* %39
%71 = fmul double %69, %70
%72 = fdiv double 0x42F6A866935B5000, %71
%73 = call double @sqrt(double %72)
store double %73, double* %40
%74 = load double, double* %27
%75 = load double, double* %40
%76 = fadd double %75, %74
store double %76, double* %40
%77 = load double, double* %28
%78 = load double, double* %40
%79 = load double, double* %35
%80 = call double @llvm.fmuladd.f64(double %78, double %79, double %77)
store double %80, double* %41
%81 = load double, double* %41
store double %81, double* %42
store i8 0, i8* %33
br label %82
82: ; preds = %92, %16
%83 = load i8, i8* %33
%84 = zext i8 %83 to i32
%85 = icmp slt i32 %84, 7
br i1 %85, label %86, label %95
86: ; preds = %82
%87 = load double, double* %41
%88 = load double, double* %25
%89 = load double, double* %42
%90 = call double @sin(double %89)
%91 = call double @llvm.fmuladd.f64(double %88, double %90, double %87)
store double %91, double* %42
br label %92
92: ; preds = %86
%93 = load i8, i8* %33
%94 = add i8 %93, 1
store i8 %94, i8* %33
br label %82
95: ; preds = %82
%96 = load double, double* %25
%97 = fmul double 0xBDFE87DEAE177A99, %96
%98 = load double, double* %26
%99 = fmul double %97, %98
%100 = load double, double* %42
%101 = call double @sin(double %100)
%102 = fmul double %99, %101
store double %102, double* %37
%103 = load double, double* %37
%104 = fmul double %103, 0x41B1DE784A000000
store double %104, double* %37
%105 = load double, double* %22
%106 = load double, double* %23
%107 = load double, double* %36
%108 = call double @llvm.fmuladd.f64(double %106, double %107, double %105)
%109 = load double, double* %24
%110 = load double, double* %36
%111 = fmul double %109, %110
%112 = load double, double* %36
%113 = call double @llvm.fmuladd.f64(double %111, double %112, double %108)
store double %113, double* %38
%114 = load i8, i8* %30
%115 = zext i8 %114 to i32
%116 = icmp eq i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %95
%118 = load double, double* %29
%119 = load double, double* %38
%120 = fsub double %119, %118
store double %120, double* %38
br label %131
121: ; preds = %95
%122 = load i8, i8* %30
%123 = zext i8 %122 to i32
%124 = icmp eq i32 %123, 1
br i1 %124, label %125, label %130
125: ; preds = %121
%126 = load double, double* %29
%127 = load double, double* %38
%128 = fneg double %126
%129 = call double @llvm.fmuladd.f64(double %128, double 0x3FFA59E26AF37C05, double %127)
store double %129, double* %38
br label %130
130: ; preds = %125, %121
br label %131
131: ; preds = %130, %117
%132 = load double, double* %38
%133 = load double, double* %37
%134 = call double @llvm.fmuladd.f64(double %132, double 0x41B1DE784A000000, double %133)
%135 = load double*, double** %31
store double %134, double* %135
%136 = load double, double* %23
%137 = load double, double* %24
%138 = fmul double 2.000000e+00, %137
%139 = load double, double* %36
%140 = call double @llvm.fmuladd.f64(double %138, double %139, double %136)
%141 = fmul double %140, 0x41B1DE784A000000
%142 = load double*, double** %32
store double %141, double* %142
ret void
}

LLVM IR (-O2):
define void @GPS_ComputeSatelliteClockCorrectionAndDrift(i16 zeroext %0, double %1, i16 zeroext %2, i32 %3, i32 %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, i8 zeroext %13, double* nocapture writeonly %14, double* nocapture writeonly %15) {
%17 = insertelement <2 x i16> poison, i16 %0, i64 0
%18 = insertelement <2 x i16> %17, i16 %2, i64 1
%19 = uitofp <2 x i16> %18 to <2 x double>
%20 = uitofp i32 %3 to double
%21 = extractelement <2 x double> %19, i64 1
%22 = tail call double @llvm.fmuladd.f64(double %21, double 6.048000e+05, double %20)
%23 = uitofp i32 %4 to double
%24 = insertelement <2 x double> poison, double %1, i64 0
%25 = insertelement <2 x double> %24, double %23, i64 1
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> <double 6.048000e+05, double 6.048000e+05>, <2 x double> %25)
%27 = extractelement <2 x double> %26, i64 0
%28 = fsub double %27, %22
%29 = fmul double %9, %9
%30 = fmul double %29, %29
%31 = fmul double %29, %30
%32 = fdiv double 0x42F6A866935B5000, %31
%33 = tail call double @sqrt(double %32)
%34 = fadd double %33, %10
%35 = tail call double @llvm.fmuladd.f64(double %34, double %28, double %11)
%36 = tail call double @sin(double %35)
%37 = tail call double @llvm.fmuladd.f64(double %8, double %36, double %35)
%38 = tail call double @sin(double %37)
%39 = tail call double @llvm.fmuladd.f64(double %8, double %38, double %35)
%40 = tail call double @sin(double %39)
%41 = tail call double @llvm.fmuladd.f64(double %8, double %40, double %35)
%42 = tail call double @sin(double %41)
%43 = tail call double @llvm.fmuladd.f64(double %8, double %42, double %35)
%44 = tail call double @sin(double %43)
%45 = tail call double @llvm.fmuladd.f64(double %8, double %44, double %35)
%46 = tail call double @sin(double %45)
%47 = tail call double @llvm.fmuladd.f64(double %8, double %46, double %35)
%48 = tail call double @sin(double %47)
%49 = tail call double @llvm.fmuladd.f64(double %8, double %48, double %35)
%50 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%51 = fsub <2 x double> %26, %50
%52 = extractelement <2 x double> %51, i64 0
%53 = tail call double @sin(double %49)
%54 = tail call double @llvm.fmuladd.f64(double %6, double %52, double %5)
%55 = fmul double %52, %7
%56 = tail call double @llvm.fmuladd.f64(double %55, double %52, double %54)
switch i8 %13, label %62 [
i8 0, label %57
i8 1, label %59
]
57: ; preds = %16
%58 = fsub double %56, %12
br label %62
59: ; preds = %16
%60 = fneg double %12
%61 = tail call double @llvm.fmuladd.f64(double %60, double 0x3FFA59E26AF37C05, double %56)
br label %62
62: ; preds = %16, %59, %57
%63 = phi double [ %58, %57 ], [ %61, %59 ], [ %56, %16 ]
%64 = fmul double %8, 0xBDFE87DEAE177A99
%65 = fmul double %64, %9
%66 = fmul double %65, %53
%67 = fmul double %66, 0x41B1DE784A000000
%68 = tail call double @llvm.fmuladd.f64(double %63, double 0x41B1DE784A000000, double %67)
store double %68, double* %14
%69 = fmul double %7, 2.000000e+00
%70 = tail call double @llvm.fmuladd.f64(double %69, double %52, double %6)
%71 = fmul double %70, 0x41B1DE784A000000
store double %71, double* %15
ret void
}