#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 atan2(double, double);
int /*<<< orphan*/ sincos(double, double *, double *);
double sqrt(double);
void earth_figure_values(double geog_lat, double height_msl, double *gc_lat,
                         double *gc_radius) {
  double cg, sg, x, s, c;
  sincos(geog_lat, &sg, &cg);
  x = atan2((6378136.6 * (1.0 - (1.0 / 298.25642))) * sg, 6378136.6 * cg);
  sincos(x, &s, &c);
  c = c + (height_msl / 6378136.6) * cg;
  s = (1.0 - (1.0 / 298.25642)) * s + (height_msl / 6378136.6) * sg;
  *gc_lat = atan2(s, c);
  *gc_radius = sqrt(c * c + s * s);
}


x86 assembly (clang, -O0):
<earth_figure_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <sincos@plt>
movsd  0xeac(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xe97(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1030 <sincos@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe64(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe3c(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  0xe23(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
call   1040 <atan2@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<earth_figure_values>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm1,0x20(%rsp)
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <sincos@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xea0(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xe9a(%rip),%xmm1
call   1040 <atan2@plt>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <sincos@plt>
movsd  0x20(%rsp),%xmm2
divsd  0xe7a(%rip),%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm2
mulsd  0xe5a(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <atan2@plt>
movsd  %xmm0,(%rbx)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11f0 <earth_figure_values+0xc0>
sqrtsd %xmm0,%xmm0
jmp    11f5 <earth_figure_values+0xc5>
call   1050 <sqrt@plt>
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @earth_figure_values(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
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%14 = load double, double* %5
%15 = call i32 @sincos(double %14, double* %10, double* %9)
%16 = load double, double* %10
%17 = fmul double 0x41583FC3F6E901E9, %16
%18 = load double, double* %9
%19 = fmul double 0x415854A626666666, %18
%20 = call double @atan2(double %17, double %19)
store double %20, double* %11
%21 = load double, double* %11
%22 = call i32 @sincos(double %21, double* %12, double* %13)
%23 = load double, double* %13
%24 = load double, double* %6
%25 = fdiv double %24, 0x415854A626666666
%26 = load double, double* %9
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double %23)
store double %27, double* %13
%28 = load double, double* %12
%29 = load double, double* %6
%30 = fdiv double %29, 0x415854A626666666
%31 = load double, double* %10
%32 = fmul double %30, %31
%33 = call double @llvm.fmuladd.f64(double 0x3FEFE488A0A18A74, double %28, double %32)
store double %33, double* %12
%34 = load double, double* %12
%35 = load double, double* %13
%36 = call double @atan2(double %34, double %35)
%37 = load double*, double** %7
store double %36, double* %37
%38 = load double, double* %13
%39 = load double, double* %13
%40 = load double, double* %12
%41 = load double, double* %12
%42 = fmul double %40, %41
%43 = call double @llvm.fmuladd.f64(double %38, double %39, double %42)
%44 = call double @sqrt(double %43)
%45 = load double*, double** %8
store double %44, double* %45
ret void
}

LLVM IR (-O2):
define void @earth_figure_values(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = bitcast double* %7 to i8*
%12 = bitcast double* %8 to i8*
%13 = call i32 @sincos(double %0, double* %6, double* %5)
%14 = load double, double* %6
%15 = fmul double %14, 0x41583FC3F6E901E9
%16 = load double, double* %5
%17 = fmul double %16, 0x415854A626666666
%18 = call double @atan2(double %15, double %17)
%19 = call i32 @sincos(double %18, double* %7, double* %8)
%20 = load double, double* %8
%21 = fdiv double %1, 0x415854A626666666
%22 = load double, double* %5
%23 = call double @llvm.fmuladd.f64(double %21, double %22, double %20)
store double %23, double* %8
%24 = load double, double* %7
%25 = load double, double* %6
%26 = fmul double %21, %25
%27 = call double @llvm.fmuladd.f64(double %24, double 0x3FEFE488A0A18A74, double %26)
store double %27, double* %7
%28 = call double @atan2(double %27, double %23)
store double %28, double* %2
%29 = load double, double* %8
%30 = load double, double* %7
%31 = fmul double %30, %30
%32 = call double @llvm.fmuladd.f64(double %29, double %29, double %31)
%33 = call double @sqrt(double %32)
store double %33, double* %3
ret void
}