#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 */
float cosf(float);
float safe_acosf(float);
float sinf(float);
float sky_angle_between(float thetav, float phiv, float theta, float phi) {
  float cospsi = sinf(thetav) * sinf(theta) * cosf(phi - phiv) +
                 cosf(thetav) * cosf(theta);
  return safe_acosf(cospsi);
}


x86 assembly (clang, -O0):
<sky_angle_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x18(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <safe_acosf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sky_angle_between>:
sub    $0x18,%rsp
movss  %xmm3,0x4(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x8(%rsp)
call   1030 <sinf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x4(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cosf@plt>
mulss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
addss  %xmm1,%xmm0
add    $0x18,%rsp
jmp    1050 <safe_acosf@plt>

LLVM IR (-O0):
define float @sky_angle_between(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = load float, float* %5
%11 = call float @sinf(float %10)
%12 = load float, float* %7
%13 = call float @sinf(float %12)
%14 = fmul float %11, %13
%15 = load float, float* %8
%16 = load float, float* %6
%17 = fsub float %15, %16
%18 = call float @cosf(float %17)
%19 = load float, float* %5
%20 = call float @cosf(float %19)
%21 = load float, float* %7
%22 = call float @cosf(float %21)
%23 = fmul float %20, %22
%24 = call float @llvm.fmuladd.f32(float %14, float %18, float %23)
store float %24, float* %9
%25 = load float, float* %9
%26 = call float @safe_acosf(float %25)
ret float %26
}

LLVM IR (-O2):
define float @sky_angle_between(float %0, float %1, float %2, float %3) {
%5 = tail call float @sinf(float %0)
%6 = tail call float @sinf(float %2)
%7 = fmul float %5, %6
%8 = fsub float %3, %1
%9 = tail call float @cosf(float %8)
%10 = tail call float @cosf(float %0)
%11 = tail call float @cosf(float %2)
%12 = fmul float %10, %11
%13 = tail call float @llvm.fmuladd.f32(float %7, float %9, float %12)
%14 = tail call float @safe_acosf(float %13)
ret float %14
}