#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 */
scalar_t__ pow(float, int);
float sqrt(scalar_t__);
void calc_deltas(float *dxyz, float r, float cos_phi, float cos_theta) {
  dxyz[0] = r * cos_theta;
  dxyz[1] = r * cos_phi * sqrt(1.0 - pow(cos_theta, 2));
  dxyz[2] = r * cos_theta * sqrt(1.0 - pow(cos_phi, 2));
  return;
}


x86 assembly (clang, -O0):
<calc_deltas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe88(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe3a(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_deltas>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0x8(%rsp)
mov    %rdi,%rbx
movaps %xmm0,%xmm3
mulss  %xmm2,%xmm3
movss  %xmm3,0xc(%rsp)
movss  %xmm3,(%rdi)
mulss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
movaps %xmm2,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe9a(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1040 <sqrt@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rbx)
movss  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe61(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1040 <sqrt@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @calc_deltas(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %6
%10 = load float, float* %8
%11 = fmul float %9, %10
%12 = load float*, float** %5
%13 = getelementptr inbounds float, float* %12, i64 0
store float %11, float* %13
%14 = load float, float* %6
%15 = load float, float* %7
%16 = fmul float %14, %15
%17 = load float, float* %8
%18 = call i64 @pow(float %17, i32 2)
%19 = sitofp i64 %18 to double
%20 = fsub double 1.000000e+00, %19
%21 = fptosi double %20 to i64
%22 = call float @sqrt(i64 %21)
%23 = fmul float %16, %22
%24 = load float*, float** %5
%25 = getelementptr inbounds float, float* %24, i64 1
store float %23, float* %25
%26 = load float, float* %6
%27 = load float, float* %8
%28 = fmul float %26, %27
%29 = load float, float* %7
%30 = call i64 @pow(float %29, i32 2)
%31 = sitofp i64 %30 to double
%32 = fsub double 1.000000e+00, %31
%33 = fptosi double %32 to i64
%34 = call float @sqrt(i64 %33)
%35 = fmul float %28, %34
%36 = load float*, float** %5
%37 = getelementptr inbounds float, float* %36, i64 2
store float %35, float* %37
ret void
}

LLVM IR (-O2):
define void @calc_deltas(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = fmul float %1, %3
store float %5, float* %0
%6 = fmul float %1, %2
%7 = tail call i64 @pow(float %3, i32 2)
%8 = sitofp i64 %7 to double
%9 = fsub double 1.000000e+00, %8
%10 = fptosi double %9 to i64
%11 = tail call float @sqrt(i64 %10)
%12 = fmul float %6, %11
%13 = getelementptr inbounds float, float* %0, i64 1
store float %12, float* %13
%14 = tail call i64 @pow(float %2, i32 2)
%15 = sitofp i64 %14 to double
%16 = fsub double 1.000000e+00, %15
%17 = fptosi double %16 to i64
%18 = tail call float @sqrt(i64 %17)
%19 = fmul float %5, %18
%20 = getelementptr inbounds float, float* %0, i64 2
store float %19, float* %20
ret void
}