#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 */
int fabs(double);
double rand();
double sqrt(double);
void calculate_unit_vectors_cylindrical(double pos[3], double ezin[3],
                                        double erad[3], double ephi[3],
                                        double ez[3]) {
  int i;
  double dist, distv;
  double vec[3];
  dist = 1.0 / sqrt(ezin[0] * ezin[0] + ezin[1] * ezin[1] + ezin[2] * ezin[2]);
  for (i = 0; i < 3; i++)
    ez[i] = ezin[i] * dist;
  dist = pos[0] * ez[0] + pos[1] * ez[1] + pos[2] * ez[2];
  if (fabs(dist / sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2])) >
      1 - 1e-15) {
    vec[0] = rand();
    vec[1] = rand();
    vec[2] = rand();
    distv = vec[0] * ez[0] + vec[1] * ez[1] + vec[2] * ez[2];
    for (i = 0; i < 3; i++)
      erad[i] = vec[i] - distv * ez[i];
    if (pos[0] * erad[0] + pos[1] * erad[1] + pos[2] * erad[2] < 0) {
      for (i = 0; i < 3; i++)
        erad[i] *= -1;
    }
  } else {
    for (i = 0; i < 3; i++)
      erad[i] = pos[i] - dist * ez[i];
  }
  dist = 1.0 / sqrt(erad[0] * erad[0] + erad[1] * erad[1] + erad[2] * erad[2]);
  for (i = 0; i < 3; i++)
    erad[i] = erad[i] * dist;
  ephi[0] = ez[1] * erad[2] - ez[2] * erad[1];
  ephi[1] = ez[2] * erad[0] - ez[0] * erad[2];
  ephi[2] = ez[0] * erad[1] - ez[1] * erad[0];
}


x86 assembly (clang, -O0):
<calculate_unit_vectors_cylindrical>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe60(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11e7 <calculate_unit_vectors_cylindrical+0xb7>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b0 <calculate_unit_vectors_cylindrical+0x80>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd68(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1407 <calculate_unit_vectors_cylindrical+0x2d7>
mov    $0x0,%al
call   1050 <rand@plt>
movsd  %xmm0,-0x60(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
movsd  %xmm0,-0x58(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1373 <calculate_unit_vectors_cylindrical+0x243>
movslq -0x2c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm1
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1313 <calculate_unit_vectors_cylindrical+0x1e3>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1402 <calculate_unit_vectors_cylindrical+0x2d2>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    13fd <calculate_unit_vectors_cylindrical+0x2cd>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xc2b(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13cb <calculate_unit_vectors_cylindrical+0x29b>
jmp    1402 <calculate_unit_vectors_cylindrical+0x2d2>
jmp    1476 <calculate_unit_vectors_cylindrical+0x346>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1471 <calculate_unit_vectors_cylindrical+0x341>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    140e <calculate_unit_vectors_cylindrical+0x2de>
jmp    1476 <calculate_unit_vectors_cylindrical+0x346>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xb36(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1511 <calculate_unit_vectors_cylindrical+0x3e1>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14da <calculate_unit_vectors_cylindrical+0x3aa>
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_unit_vectors_cylindrical>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm0
jb     117e <calculate_unit_vectors_cylindrical+0x4e>
sqrtsd %xmm0,%xmm0
jmp    1187 <calculate_unit_vectors_cylindrical+0x57>
call   1040 <sqrt@plt>
xorpd  %xmm5,%xmm5
movsd  0xe71(%rip),%xmm4
divsd  %xmm0,%xmm4
movsd  (%rbx),%xmm1
mulsd  %xmm4,%xmm1
movsd  %xmm1,0x0(%r13)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x8(%r13)
mulsd  0x10(%rbx),%xmm4
movsd  %xmm4,0x10(%r13)
movsd  (%r12),%xmm2
movsd  0x8(%r12),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%r12),%xmm0
mulsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
mulsd  %xmm3,%xmm3
mulsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm5,%xmm0
movsd  %xmm4,(%rsp)
jb     1208 <calculate_unit_vectors_cylindrical+0xd8>
sqrtsd %xmm0,%xmm0
jmp    1212 <calculate_unit_vectors_cylindrical+0xe2>
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm4
movapd %xmm4,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    1310 <calculate_unit_vectors_cylindrical+0x1e0>
xor    %eax,%eax
call   1050 <rand@plt>
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
movapd %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
movapd 0x10(%rsp),%xmm4
movsd  0x0(%r13),%xmm1
movsd  0x8(%r13),%xmm2
mulsd  %xmm4,%xmm2
movapd (%rsp),%xmm5
movapd %xmm5,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0x10(%r13),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm3,%xmm2
movapd %xmm5,%xmm3
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm3
movsd  %xmm3,(%r15)
movsd  0x8(%r13),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm4
movsd  %xmm4,0x8(%r15)
mulsd  0x10(%r13),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%r15)
movsd  0x8(%r12),%xmm1
mulsd  %xmm4,%xmm1
movsd  (%r12),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%r12),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    1360 <calculate_unit_vectors_cylindrical+0x230>
movapd 0xd21(%rip),%xmm1
xorpd  %xmm1,%xmm3
xorpd  %xmm1,%xmm4
movapd %xmm3,%xmm2
unpcklpd %xmm4,%xmm2
movupd %xmm2,(%r15)
xorpd  %xmm1,%xmm0
movlpd %xmm0,0x10(%r15)
jmp    1360 <calculate_unit_vectors_cylindrical+0x230>
movsd  (%r12),%xmm3
movsd  0x0(%r13),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm3
movsd  %xmm3,(%r15)
movsd  0x8(%r12),%xmm4
movsd  0x8(%r13),%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm4
movsd  %xmm4,0x8(%r15)
movsd  0x10(%r12),%xmm0
mulsd  0x10(%r13),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r15)
mulsd  %xmm4,%xmm4
mulsd  %xmm3,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1384 <calculate_unit_vectors_cylindrical+0x254>
sqrtsd %xmm0,%xmm0
jmp    1389 <calculate_unit_vectors_cylindrical+0x259>
call   1040 <sqrt@plt>
movsd  0xc6f(%rip),%xmm2
divsd  %xmm0,%xmm2
movupd (%r15),%xmm0
movapd %xmm2,%xmm1
unpcklpd %xmm2,%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,(%r15)
mulsd  0x10(%r15),%xmm2
movsd  %xmm2,0x10(%r15)
unpckhpd %xmm1,%xmm1
mulsd  0x10(%r13),%xmm1
mulsd  0x8(%r13),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%r14)
movsd  0x10(%r13),%xmm0
movsd  0x10(%r15),%xmm1
mulsd  0x0(%r13),%xmm1
mulsd  (%r15),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x0(%r13),%xmm0
movsd  (%r15),%xmm1
mulsd  0x8(%r13),%xmm1
mulsd  0x8(%r15),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @calculate_unit_vectors_cylindrical(double* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca [3 x double]
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%15 = load double*, double** %7
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = load double*, double** %7
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %7
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fmul double %23, %26
%28 = call double @llvm.fmuladd.f64(double %17, double %20, double %27)
%29 = load double*, double** %7
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = load double*, double** %7
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = call double @llvm.fmuladd.f64(double %31, double %34, double %28)
%36 = call double @sqrt(double %35)
%37 = fdiv double 1.000000e+00, %36
store double %37, double* %12
store i32 0, i32* %11
br label %38
38: ; preds = %53, %5
%39 = load i32, i32* %11
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %56
41: ; preds = %38
%42 = load double*, double** %7
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = load double, double* %12
%48 = fmul double %46, %47
%49 = load double*, double** %10
%50 = load i32, i32* %11
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
br label %53
53: ; preds = %41
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
store i32 %55, i32* %11
br label %38
56: ; preds = %38
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = load double*, double** %10
%61 = getelementptr inbounds double, double* %60, i64 0
%62 = load double, double* %61
%63 = load double*, double** %6
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
%66 = load double*, double** %10
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = fmul double %65, %68
%70 = call double @llvm.fmuladd.f64(double %59, double %62, double %69)
%71 = load double*, double** %6
%72 = getelementptr inbounds double, double* %71, i64 2
%73 = load double, double* %72
%74 = load double*, double** %10
%75 = getelementptr inbounds double, double* %74, i64 2
%76 = load double, double* %75
%77 = call double @llvm.fmuladd.f64(double %73, double %76, double %70)
store double %77, double* %12
%78 = load double, double* %12
%79 = load double*, double** %6
%80 = getelementptr inbounds double, double* %79, i64 0
%81 = load double, double* %80
%82 = load double*, double** %6
%83 = getelementptr inbounds double, double* %82, i64 0
%84 = load double, double* %83
%85 = load double*, double** %6
%86 = getelementptr inbounds double, double* %85, i64 1
%87 = load double, double* %86
%88 = load double*, double** %6
%89 = getelementptr inbounds double, double* %88, i64 1
%90 = load double, double* %89
%91 = fmul double %87, %90
%92 = call double @llvm.fmuladd.f64(double %81, double %84, double %91)
%93 = load double*, double** %6
%94 = getelementptr inbounds double, double* %93, i64 2
%95 = load double, double* %94
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 2
%98 = load double, double* %97
%99 = call double @llvm.fmuladd.f64(double %95, double %98, double %92)
%100 = call double @sqrt(double %99)
%101 = fdiv double %78, %100
%102 = call i32 @fabs(double %101)
%103 = sitofp i32 %102 to double
%104 = fcmp ogt double %103, 0x3FEFFFFFFFFFFFF7
br i1 %104, label %105, label %192
105: ; preds = %56
%106 = call double (...) @rand()
%107 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
store double %106, double* %107
%108 = call double (...) @rand()
%109 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
store double %108, double* %109
%110 = call double (...) @rand()
%111 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
store double %110, double* %111
%112 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%113 = load double, double* %112
%114 = load double*, double** %10
%115 = getelementptr inbounds double, double* %114, i64 0
%116 = load double, double* %115
%117 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
%118 = load double, double* %117
%119 = load double*, double** %10
%120 = getelementptr inbounds double, double* %119, i64 1
%121 = load double, double* %120
%122 = fmul double %118, %121
%123 = call double @llvm.fmuladd.f64(double %113, double %116, double %122)
%124 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
%125 = load double, double* %124
%126 = load double*, double** %10
%127 = getelementptr inbounds double, double* %126, i64 2
%128 = load double, double* %127
%129 = call double @llvm.fmuladd.f64(double %125, double %128, double %123)
store double %129, double* %13
store i32 0, i32* %11
br label %130
130: ; preds = %150, %105
%131 = load i32, i32* %11
%132 = icmp slt i32 %131, 3
br i1 %132, label %133, label %153
133: ; preds = %130
%134 = load i32, i32* %11
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 %135
%137 = load double, double* %136
%138 = load double, double* %13
%139 = load double*, double** %10
%140 = load i32, i32* %11
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds double, double* %139, i64 %141
%143 = load double, double* %142
%144 = fneg double %138
%145 = call double @llvm.fmuladd.f64(double %144, double %143, double %137)
%146 = load double*, double** %8
%147 = load i32, i32* %11
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
store double %145, double* %149
br label %150
150: ; preds = %133
%151 = load i32, i32* %11
%152 = add nsw i32 %151, 1
store i32 %152, i32* %11
br label %130
153: ; preds = %130
%154 = load double*, double** %6
%155 = getelementptr inbounds double, double* %154, i64 0
%156 = load double, double* %155
%157 = load double*, double** %8
%158 = getelementptr inbounds double, double* %157, i64 0
%159 = load double, double* %158
%160 = load double*, double** %6
%161 = getelementptr inbounds double, double* %160, i64 1
%162 = load double, double* %161
%163 = load double*, double** %8
%164 = getelementptr inbounds double, double* %163, i64 1
%165 = load double, double* %164
%166 = fmul double %162, %165
%167 = call double @llvm.fmuladd.f64(double %156, double %159, double %166)
%168 = load double*, double** %6
%169 = getelementptr inbounds double, double* %168, i64 2
%170 = load double, double* %169
%171 = load double*, double** %8
%172 = getelementptr inbounds double, double* %171, i64 2
%173 = load double, double* %172
%174 = call double @llvm.fmuladd.f64(double %170, double %173, double %167)
%175 = fcmp olt double %174, 0.000000e+00
br i1 %175, label %176, label %191
176: ; preds = %153
store i32 0, i32* %11
br label %177
177: ; preds = %187, %176
%178 = load i32, i32* %11
%179 = icmp slt i32 %178, 3
br i1 %179, label %180, label %190
180: ; preds = %177
%181 = load double*, double** %8
%182 = load i32, i32* %11
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double, double* %184
%186 = fmul double %185, -1.000000e+00
store double %186, double* %184
br label %187
187: ; preds = %180
%188 = load i32, i32* %11
%189 = add nsw i32 %188, 1
store i32 %189, i32* %11
br label %177
190: ; preds = %177
br label %191
191: ; preds = %190, %153
br label %218
192: ; preds = %56
store i32 0, i32* %11
br label %193
193: ; preds = %214, %192
%194 = load i32, i32* %11
%195 = icmp slt i32 %194, 3
br i1 %195, label %196, label %217
196: ; preds = %193
%197 = load double*, double** %6
%198 = load i32, i32* %11
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
%201 = load double, double* %200
%202 = load double, double* %12
%203 = load double*, double** %10
%204 = load i32, i32* %11
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %203, i64 %205
%207 = load double, double* %206
%208 = fneg double %202
%209 = call double @llvm.fmuladd.f64(double %208, double %207, double %201)
%210 = load double*, double** %8
%211 = load i32, i32* %11
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds double, double* %210, i64 %212
store double %209, double* %213
br label %214
214: ; preds = %196
%215 = load i32, i32* %11
%216 = add nsw i32 %215, 1
store i32 %216, i32* %11
br label %193
217: ; preds = %193
br label %218
218: ; preds = %217, %191
%219 = load double*, double** %8
%220 = getelementptr inbounds double, double* %219, i64 0
%221 = load double, double* %220
%222 = load double*, double** %8
%223 = getelementptr inbounds double, double* %222, i64 0
%224 = load double, double* %223
%225 = load double*, double** %8
%226 = getelementptr inbounds double, double* %225, i64 1
%227 = load double, double* %226
%228 = load double*, double** %8
%229 = getelementptr inbounds double, double* %228, i64 1
%230 = load double, double* %229
%231 = fmul double %227, %230
%232 = call double @llvm.fmuladd.f64(double %221, double %224, double %231)
%233 = load double*, double** %8
%234 = getelementptr inbounds double, double* %233, i64 2
%235 = load double, double* %234
%236 = load double*, double** %8
%237 = getelementptr inbounds double, double* %236, i64 2
%238 = load double, double* %237
%239 = call double @llvm.fmuladd.f64(double %235, double %238, double %232)
%240 = call double @sqrt(double %239)
%241 = fdiv double 1.000000e+00, %240
store double %241, double* %12
store i32 0, i32* %11
br label %242
242: ; preds = %257, %218
%243 = load i32, i32* %11
%244 = icmp slt i32 %243, 3
br i1 %244, label %245, label %260
245: ; preds = %242
%246 = load double*, double** %8
%247 = load i32, i32* %11
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds double, double* %246, i64 %248
%250 = load double, double* %249
%251 = load double, double* %12
%252 = fmul double %250, %251
%253 = load double*, double** %8
%254 = load i32, i32* %11
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds double, double* %253, i64 %255
store double %252, double* %256
br label %257
257: ; preds = %245
%258 = load i32, i32* %11
%259 = add nsw i32 %258, 1
store i32 %259, i32* %11
br label %242
260: ; preds = %242
%261 = load double*, double** %10
%262 = getelementptr inbounds double, double* %261, i64 1
%263 = load double, double* %262
%264 = load double*, double** %8
%265 = getelementptr inbounds double, double* %264, i64 2
%266 = load double, double* %265
%267 = load double*, double** %10
%268 = getelementptr inbounds double, double* %267, i64 2
%269 = load double, double* %268
%270 = load double*, double** %8
%271 = getelementptr inbounds double, double* %270, i64 1
%272 = load double, double* %271
%273 = fmul double %269, %272
%274 = fneg double %273
%275 = call double @llvm.fmuladd.f64(double %263, double %266, double %274)
%276 = load double*, double** %9
%277 = getelementptr inbounds double, double* %276, i64 0
store double %275, double* %277
%278 = load double*, double** %10
%279 = getelementptr inbounds double, double* %278, i64 2
%280 = load double, double* %279
%281 = load double*, double** %8
%282 = getelementptr inbounds double, double* %281, i64 0
%283 = load double, double* %282
%284 = load double*, double** %10
%285 = getelementptr inbounds double, double* %284, i64 0
%286 = load double, double* %285
%287 = load double*, double** %8
%288 = getelementptr inbounds double, double* %287, i64 2
%289 = load double, double* %288
%290 = fmul double %286, %289
%291 = fneg double %290
%292 = call double @llvm.fmuladd.f64(double %280, double %283, double %291)
%293 = load double*, double** %9
%294 = getelementptr inbounds double, double* %293, i64 1
store double %292, double* %294
%295 = load double*, double** %10
%296 = getelementptr inbounds double, double* %295, i64 0
%297 = load double, double* %296
%298 = load double*, double** %8
%299 = getelementptr inbounds double, double* %298, i64 1
%300 = load double, double* %299
%301 = load double*, double** %10
%302 = getelementptr inbounds double, double* %301, i64 1
%303 = load double, double* %302
%304 = load double*, double** %8
%305 = getelementptr inbounds double, double* %304, i64 0
%306 = load double, double* %305
%307 = fmul double %303, %306
%308 = fneg double %307
%309 = call double @llvm.fmuladd.f64(double %297, double %300, double %308)
%310 = load double*, double** %9
%311 = getelementptr inbounds double, double* %310, i64 2
store double %309, double* %311
ret void
}

LLVM IR (-O2):
define void @calculate_unit_vectors_cylindrical(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3, double* nocapture %4) {
%6 = load double, double* %1
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %8, %8
%10 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %9)
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %10)
%14 = tail call double @sqrt(double %13)
%15 = fdiv double 1.000000e+00, %14
%16 = load double, double* %1
%17 = fmul double %15, %16
store double %17, double* %4
%18 = load double, double* %7
%19 = fmul double %15, %18
%20 = getelementptr inbounds double, double* %4, i64 1
store double %19, double* %20
%21 = load double, double* %11
%22 = fmul double %15, %21
%23 = getelementptr inbounds double, double* %4, i64 2
store double %22, double* %23
%24 = load double, double* %0
%25 = getelementptr inbounds double, double* %0, i64 1
%26 = load double, double* %25
%27 = fmul double %26, %19
%28 = tail call double @llvm.fmuladd.f64(double %24, double %17, double %27)
%29 = getelementptr inbounds double, double* %0, i64 2
%30 = load double, double* %29
%31 = tail call double @llvm.fmuladd.f64(double %30, double %22, double %28)
%32 = fmul double %26, %26
%33 = tail call double @llvm.fmuladd.f64(double %24, double %24, double %32)
%34 = tail call double @llvm.fmuladd.f64(double %30, double %30, double %33)
%35 = tail call double @sqrt(double %34)
%36 = fdiv double %31, %35
%37 = tail call i32 @fabs(double %36)
%38 = icmp sgt i32 %37, 0
br i1 %38, label %52, label %39
39: ; preds = %5
%40 = fneg double %31
%41 = load double, double* %0
%42 = load double, double* %4
%43 = tail call double @llvm.fmuladd.f64(double %40, double %42, double %41)
store double %43, double* %2
%44 = load double, double* %25
%45 = load double, double* %20
%46 = tail call double @llvm.fmuladd.f64(double %40, double %45, double %44)
%47 = getelementptr inbounds double, double* %2, i64 1
store double %46, double* %47
%48 = load double, double* %29
%49 = load double, double* %23
%50 = tail call double @llvm.fmuladd.f64(double %40, double %49, double %48)
%51 = getelementptr inbounds double, double* %2, i64 2
store double %50, double* %51
br label %81
52: ; preds = %5
%53 = tail call double (...) @rand()
%54 = tail call double (...) @rand()
%55 = tail call double (...) @rand()
%56 = load double, double* %4
%57 = load double, double* %20
%58 = fmul double %54, %57
%59 = tail call double @llvm.fmuladd.f64(double %53, double %56, double %58)
%60 = load double, double* %23
%61 = tail call double @llvm.fmuladd.f64(double %55, double %60, double %59)
%62 = fneg double %61
%63 = tail call double @llvm.fmuladd.f64(double %62, double %56, double %53)
store double %63, double* %2
%64 = load double, double* %20
%65 = tail call double @llvm.fmuladd.f64(double %62, double %64, double %54)
%66 = getelementptr inbounds double, double* %2, i64 1
store double %65, double* %66
%67 = load double, double* %23
%68 = tail call double @llvm.fmuladd.f64(double %62, double %67, double %55)
%69 = getelementptr inbounds double, double* %2, i64 2
store double %68, double* %69
%70 = load double, double* %0
%71 = load double, double* %25
%72 = fmul double %71, %65
%73 = tail call double @llvm.fmuladd.f64(double %70, double %63, double %72)
%74 = load double, double* %29
%75 = tail call double @llvm.fmuladd.f64(double %74, double %68, double %73)
%76 = fcmp olt double %75, 0.000000e+00
br i1 %76, label %77, label %81
77: ; preds = %52
%78 = fneg double %63
store double %78, double* %2
%79 = fneg double %65
store double %79, double* %66
%80 = fneg double %68
store double %80, double* %69
br label %81
81: ; preds = %39, %77, %52
%82 = phi double [ %50, %39 ], [ %80, %77 ], [ %68, %52 ]
%83 = phi double [ %46, %39 ], [ %79, %77 ], [ %65, %52 ]
%84 = phi double [ %43, %39 ], [ %78, %77 ], [ %63, %52 ]
%85 = getelementptr inbounds double, double* %2, i64 1
%86 = fmul double %83, %83
%87 = tail call double @llvm.fmuladd.f64(double %84, double %84, double %86)
%88 = getelementptr inbounds double, double* %2, i64 2
%89 = tail call double @llvm.fmuladd.f64(double %82, double %82, double %87)
%90 = tail call double @sqrt(double %89)
%91 = fdiv double 1.000000e+00, %90
%92 = bitcast double* %2 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = insertelement <2 x double> poison, double %91, i64 0
%95 = shufflevector <2 x double> %94, <2 x double> poison, <2 x i32> zeroinitializer
%96 = fmul <2 x double> %95, %93
%97 = bitcast double* %2 to <2 x double>*
store <2 x double> %96, <2 x double>* %97
%98 = load double, double* %88
%99 = fmul double %91, %98
store double %99, double* %88
%100 = load double, double* %20
%101 = load double, double* %23
%102 = fneg double %101
%103 = extractelement <2 x double> %96, i64 1
%104 = fmul double %103, %102
%105 = tail call double @llvm.fmuladd.f64(double %100, double %99, double %104)
store double %105, double* %3
%106 = load double, double* %23
%107 = load double, double* %2
%108 = load double, double* %4
%109 = load double, double* %88
%110 = fneg double %108
%111 = fmul double %109, %110
%112 = tail call double @llvm.fmuladd.f64(double %106, double %107, double %111)
%113 = getelementptr inbounds double, double* %3, i64 1
store double %112, double* %113
%114 = load double, double* %4
%115 = load double, double* %85
%116 = load double, double* %20
%117 = load double, double* %2
%118 = fneg double %116
%119 = fmul double %117, %118
%120 = tail call double @llvm.fmuladd.f64(double %114, double %115, double %119)
%121 = getelementptr inbounds double, double* %3, i64 2
store double %120, double* %121
ret void
}