#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 ang_dist(float, float, double, double);
void calc_d(float zl, float zs, float dzl, float dzs, float theta, float dtheta,
            double omega0, double lambda, float *d) {
  float dl;
  float ds;
  float dls;
  float me;
  float r_phys;
  float v_circ;
  float sigbn;
  dl = ang_dist(0.0, zl, omega0, lambda) / 3.1e24;
  ds = ang_dist(0.0, zs, omega0, lambda) / 3.1e24;
  dls = ang_dist(zl, zs, omega0, lambda) / 3.1e24;
  *d = dl * ds / (dls * 1000.0);
}


x86 assembly (clang, -O0):
<calc_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movsd  %xmm6,-0x20(%rbp)
movsd  %xmm7,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
movss  -0x4(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
xorps  %xmm0,%xmm0
call   1030 <ang_dist@plt>
movsd  0xea5(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
xorps  %xmm0,%xmm0
call   1030 <ang_dist@plt>
movsd  0xe79(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1030 <ang_dist@plt>
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x34(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe17(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_d>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movaps %xmm7,%xmm3
movsd  %xmm7,0x18(%rsp)
movaps %xmm6,%xmm2
movsd  %xmm6,0x10(%rsp)
movss  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
xorpd  %xmm0,%xmm0
call   1030 <ang_dist@plt>
divsd  0xeb5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1030 <ang_dist@plt>
divsd  0xe89(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1030 <ang_dist@plt>
divsd  0xe54(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  0xe42(%rip),%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @calc_d(float %0, float %1, float %2, float %3, float %4, float %5, double %6, double %7, float* %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca double
%17 = alloca double
%18 = alloca float*
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store float %3, float* %13
store float %4, float* %14
store float %5, float* %15
store double %6, double* %16
store double %7, double* %17
store float* %8, float** %18
%26 = load float, float* %10
%27 = load double, double* %16
%28 = load double, double* %17
%29 = call double @ang_dist(float 0.000000e+00, float %26, double %27, double %28)
%30 = fdiv double %29, 3.100000e+24
%31 = fptrunc double %30 to float
store float %31, float* %19
%32 = load float, float* %11
%33 = load double, double* %16
%34 = load double, double* %17
%35 = call double @ang_dist(float 0.000000e+00, float %32, double %33, double %34)
%36 = fdiv double %35, 3.100000e+24
%37 = fptrunc double %36 to float
store float %37, float* %20
%38 = load float, float* %10
%39 = load float, float* %11
%40 = load double, double* %16
%41 = load double, double* %17
%42 = call double @ang_dist(float %38, float %39, double %40, double %41)
%43 = fdiv double %42, 3.100000e+24
%44 = fptrunc double %43 to float
store float %44, float* %21
%45 = load float, float* %19
%46 = load float, float* %20
%47 = fmul float %45, %46
%48 = fpext float %47 to double
%49 = load float, float* %21
%50 = fpext float %49 to double
%51 = fmul double %50, 1.000000e+03
%52 = fdiv double %48, %51
%53 = fptrunc double %52 to float
%54 = load float*, float** %18
store float %53, float* %54
ret void
}

LLVM IR (-O2):
define void @calc_d(float %0, float %1, float %2, float %3, float %4, float %5, double %6, double %7, float* nocapture writeonly %8) {
%10 = tail call double @ang_dist(float 0.000000e+00, float %0, double %6, double %7)
%11 = fdiv double %10, 3.100000e+24
%12 = fptrunc double %11 to float
%13 = tail call double @ang_dist(float 0.000000e+00, float %1, double %6, double %7)
%14 = fdiv double %13, 3.100000e+24
%15 = fptrunc double %14 to float
%16 = tail call double @ang_dist(float %0, float %1, double %6, double %7)
%17 = fdiv double %16, 3.100000e+24
%18 = fptrunc double %17 to float
%19 = fmul float %12, %15
%20 = fpext float %19 to double
%21 = fpext float %18 to double
%22 = fmul double %21, 1.000000e+03
%23 = fdiv double %20, %22
%24 = fptrunc double %23 to float
store float %24, float* %8
ret void
}