#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 sin(double);
double sqrt(double);
double along_obs(double theta, double phi, double d_obs) {
  double num, den;
  double in_obs;
  num = d_obs - 1.0 * 696000000.0 * sin(theta) * cos(phi);
  den = sqrt(d_obs * d_obs + 696000000.0 * 696000000.0 -
             2.0 * 696000000.0 * d_obs * sin(theta) * cos(phi));
  in_obs = num / den;
  return in_obs;
}


x86 assembly (clang, -O0):
<along_obs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe2f(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<along_obs>:
sub    $0x28,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe97(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe7b(%rip),%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0xe55(%rip),%xmm1
mulsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     11dd <along_obs+0xad>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11e6 <along_obs+0xb6>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @along_obs(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = load double, double* %6
%11 = load double, double* %4
%12 = call double @sin(double %11)
%13 = fmul double 6.960000e+08, %12
%14 = load double, double* %5
%15 = call double @cos(double %14)
%16 = fneg double %13
%17 = call double @llvm.fmuladd.f64(double %16, double %15, double %10)
store double %17, double* %7
%18 = load double, double* %6
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double %18, double %19, double 4.844160e+17)
%21 = load double, double* %6
%22 = fmul double 1.392000e+09, %21
%23 = load double, double* %4
%24 = call double @sin(double %23)
%25 = fmul double %22, %24
%26 = load double, double* %5
%27 = call double @cos(double %26)
%28 = fneg double %25
%29 = call double @llvm.fmuladd.f64(double %28, double %27, double %20)
%30 = call double @sqrt(double %29)
store double %30, double* %8
%31 = load double, double* %7
%32 = load double, double* %8
%33 = fdiv double %31, %32
store double %33, double* %9
%34 = load double, double* %9
ret double %34
}

LLVM IR (-O2):
define double @along_obs(double %0, double %1, double %2) {
%4 = tail call double @sin(double %0)
%5 = tail call double @cos(double %1)
%6 = fmul double %4, -6.960000e+08
%7 = tail call double @llvm.fmuladd.f64(double %6, double %5, double %2)
%8 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 4.844160e+17)
%9 = tail call double @sin(double %0)
%10 = tail call double @cos(double %1)
%11 = fmul double %2, -1.392000e+09
%12 = fmul double %11, %9
%13 = tail call double @llvm.fmuladd.f64(double %12, double %10, double %8)
%14 = tail call double @sqrt(double %13)
%15 = fdiv double %7, %14
ret double %15
}