#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 */
typedef float ftwo;
typedef float fone;

/* Variables and functions */
float cos(float);
float sin(float);
float sqrt(float);
void latlon2km(float *arg, float *latkm, float *lonkm, float *rc, float *g2) {
  float cosA, sinA, g2s2, den;
  float fone = 1.0;
  float ftwo = 2.0;
  cosA = cos((*arg));
  sinA = sin((*arg));
  g2s2 = (*g2) * sinA * sinA;
  den = sqrt((fone) / ((fone) + g2s2));
  *lonkm = (*rc) * cosA * den;
  *latkm = (*rc) * (sqrt((fone) + g2s2 * ((ftwo) + (*g2)))) * den * den * den;
}


x86 assembly (clang, -O0):
<latlon2km>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movss  0xeb0(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xe9f(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0x30(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm1
addss  -0x34(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0x2c(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x3c(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x40(%rbp),%xmm2
mov    -0x28(%rbp),%rax
addss  (%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
mulss  %xmm1,%xmm0
mulss  -0x38(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<latlon2km>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0xc(%rsp)
movss  (%rbx),%xmm0
call   1030 <sin@plt>
movss  (%r15),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
movss  0xe87(%rip),%xmm0
movaps %xmm2,%xmm1
addss  %xmm0,%xmm1
divss  %xmm1,%xmm0
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm0
jb     1195 <latlon2km+0x65>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    11ac <latlon2km+0x7c>
movss  %xmm2,0x8(%rsp)
call   1050 <sqrt@plt>
xorps  %xmm4,%xmm4
movss  0x8(%rsp),%xmm2
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
mulss  0x0(%r13),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,(%r12)
movss  0x0(%r13),%xmm3
movss  (%r15),%xmm0
addss  0xe2f(%rip),%xmm0
mulss  %xmm0,%xmm2
addss  0xe1f(%rip),%xmm2
ucomiss %xmm4,%xmm2
jb     11ef <latlon2km+0xbf>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
jmp    120f <latlon2km+0xdf>
movaps %xmm2,%xmm0
movss  %xmm1,0xc(%rsp)
movss  %xmm3,0x8(%rsp)
call   1050 <sqrt@plt>
movss  0x8(%rsp),%xmm3
movss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm1,%xmm3
movss  %xmm3,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @latlon2km(float* %0, float* %1, float* %2, float* %3, float* %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
store float* %4, float** %10
store float 1.000000e+00, float* %15
store float 2.000000e+00, float* %16
%17 = load float*, float** %6
%18 = load float, float* %17
%19 = call float @cos(float %18)
store float %19, float* %11
%20 = load float*, float** %6
%21 = load float, float* %20
%22 = call float @sin(float %21)
store float %22, float* %12
%23 = load float*, float** %10
%24 = load float, float* %23
%25 = load float, float* %12
%26 = fmul float %24, %25
%27 = load float, float* %12
%28 = fmul float %26, %27
store float %28, float* %13
%29 = load float, float* %15
%30 = load float, float* %15
%31 = load float, float* %13
%32 = fadd float %30, %31
%33 = fdiv float %29, %32
%34 = call float @sqrt(float %33)
store float %34, float* %14
%35 = load float*, float** %9
%36 = load float, float* %35
%37 = load float, float* %11
%38 = fmul float %36, %37
%39 = load float, float* %14
%40 = fmul float %38, %39
%41 = load float*, float** %8
store float %40, float* %41
%42 = load float*, float** %9
%43 = load float, float* %42
%44 = load float, float* %15
%45 = load float, float* %13
%46 = load float, float* %16
%47 = load float*, float** %10
%48 = load float, float* %47
%49 = fadd float %46, %48
%50 = call float @llvm.fmuladd.f32(float %45, float %49, float %44)
%51 = call float @sqrt(float %50)
%52 = fmul float %43, %51
%53 = load float, float* %14
%54 = fmul float %52, %53
%55 = load float, float* %14
%56 = fmul float %54, %55
%57 = load float, float* %14
%58 = fmul float %56, %57
%59 = load float*, float** %7
store float %58, float* %59
ret void
}

LLVM IR (-O2):
define void @latlon2km(float* nocapture %0, float* nocapture writeonly %1, float* nocapture writeonly %2, float* nocapture %3, float* nocapture %4) {
%6 = load float, float* %0
%7 = tail call float @cos(float %6)
%8 = load float, float* %0
%9 = tail call float @sin(float %8)
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = fmul float %9, %11
%13 = fadd float %12, 1.000000e+00
%14 = fdiv float 1.000000e+00, %13
%15 = tail call float @sqrt(float %14)
%16 = load float, float* %3
%17 = fmul float %7, %16
%18 = fmul float %15, %17
store float %18, float* %2
%19 = load float, float* %3
%20 = load float, float* %4
%21 = fadd float %20, 2.000000e+00
%22 = tail call float @llvm.fmuladd.f32(float %12, float %21, float 1.000000e+00)
%23 = tail call float @sqrt(float %22)
%24 = fmul float %19, %23
%25 = fmul float %15, %24
%26 = fmul float %15, %25
%27 = fmul float %15, %26
store float %27, float* %1
ret void
}