#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 acos(float);
float norm(float *, int);
int /*<<< orphan*/ to_unit_vector(float *, int);
float get_rake(float nhat1, float nhat2, float nhat3, float su1, float su2,
               float su3) {
  int i;
  float s;
  float slip[3], ns[3];
  float arg;
  float scaling;
  float rake;
  slip[0] = su1;
  slip[1] = su2;
  slip[2] = su3;
  s = norm(slip, 3);
  if ((s - 1e-7f) <= 0) {
    return -99999.0;
  }
  ns[0] = nhat3;
  ns[1] = 0;
  ns[2] = -nhat1;
  to_unit_vector(ns, 3);
  to_unit_vector(slip, 3);
  arg = slip[0] * ns[0] + slip[1] * ns[1] + slip[2] * ns[2];
  rake = acos(arg) * 57.2957795131;
  return rake;
}


x86 assembly (clang, -O0):
<get_rake>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  %xmm5,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm1
movss  0xe6c(%rip),%xmm0
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jb     11b6 <get_rake+0x86>
movss  0xe58(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1257 <get_rake+0x127>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x34(%rbp)
lea    -0x3c(%rbp),%rdi
mov    $0x3,%esi
call   1030 <to_unit_vector@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1030 <to_unit_vector@plt>
movss  -0x30(%rbp),%xmm1
movss  -0x3c(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
movss  -0x34(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
call   1040 <acos@plt>
movsd  0xdc8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rake>:
sub    $0x38,%rsp
movss  %xmm2,0x1c(%rsp)
movaps %xmm0,0x20(%rsp)
movss  %xmm3,0x4(%rsp)
movss  %xmm4,0x8(%rsp)
movss  %xmm5,0xc(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
addss  0xe98(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    11fa <get_rake+0xca>
movss  0x1c(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movaps 0x20(%rsp),%xmm0
xorps  0xe7c(%rip),%xmm0
movss  %xmm0,0x18(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
call   1030 <to_unit_vector@plt>
lea    0x4(%rsp),%rdi
mov    $0x3,%esi
call   1030 <to_unit_vector@plt>
movss  0x8(%rsp),%xmm0
mulss  0x14(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0x10(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
mulss  0x18(%rsp),%xmm0
addss  %xmm1,%xmm0
call   1040 <acos@plt>
mulsd  0xe2f(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x38,%rsp
ret
movss  0xe02(%rip),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @get_rake(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca float
%16 = alloca [3 x float]
%17 = alloca [3 x float]
%18 = alloca float
%19 = alloca float
%20 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
%21 = load float, float* %11
%22 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
store float %21, float* %22
%23 = load float, float* %12
%24 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
store float %23, float* %24
%25 = load float, float* %13
%26 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
store float %25, float* %26
%27 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%28 = call float @norm(float* %27, i32 3)
store float %28, float* %15
%29 = load float, float* %15
%30 = fsub float %29, 0x3E7AD7F2A0000000
%31 = fcmp ole float %30, 0.000000e+00
br i1 %31, label %32, label %33
32: ; preds = %6
store float -9.999900e+04, float* %7
br label %64
33: ; preds = %6
%34 = load float, float* %10
%35 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
store float %34, float* %35
%36 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
store float 0.000000e+00, float* %36
%37 = load float, float* %8
%38 = fneg float %37
%39 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
store float %38, float* %39
%40 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%41 = call i32 @to_unit_vector(float* %40, i32 3)
%42 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%43 = call i32 @to_unit_vector(float* %42, i32 3)
%44 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 0
%45 = load float, float* %44
%46 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%47 = load float, float* %46
%48 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 1
%49 = load float, float* %48
%50 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%51 = load float, float* %50
%52 = fmul float %49, %51
%53 = call float @llvm.fmuladd.f32(float %45, float %47, float %52)
%54 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 2
%55 = load float, float* %54
%56 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%57 = load float, float* %56
%58 = call float @llvm.fmuladd.f32(float %55, float %57, float %53)
store float %58, float* %18
%59 = load float, float* %18
%60 = call double @acos(float %59)
%61 = fmul double %60, 0x404CA5DC1A63CBB0
%62 = fptrunc double %61 to float
store float %62, float* %20
%63 = load float, float* %20
store float %63, float* %7
br label %64
64: ; preds = %33, %32
%65 = load float, float* %7
ret float %65
}

LLVM IR (-O2):
define float @get_rake(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca [3 x float]
%8 = alloca [3 x float]
%9 = bitcast [3 x float]* %7 to i8*
%10 = bitcast [3 x float]* %8 to i8*
%11 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
store float %3, float* %11
%12 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
store float %4, float* %12
%13 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
store float %5, float* %13
%14 = call float @norm(float* %11, i32 3)
%15 = fadd float %14, 0xBE7AD7F2A0000000
%16 = fcmp ugt float %15, 0.000000e+00
br i1 %16, label %17, label %36
17: ; preds = %6
%18 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float %2, float* %18
%19 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
store float 0.000000e+00, float* %19
%20 = fneg float %0
%21 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
store float %20, float* %21
%22 = call i32 @to_unit_vector(float* %18, i32 3)
%23 = call i32 @to_unit_vector(float* %11, i32 3)
%24 = load float, float* %11
%25 = load float, float* %18
%26 = load float, float* %12
%27 = load float, float* %19
%28 = fmul float %26, %27
%29 = call float @llvm.fmuladd.f32(float %24, float %25, float %28)
%30 = load float, float* %13
%31 = load float, float* %21
%32 = call float @llvm.fmuladd.f32(float %30, float %31, float %29)
%33 = call double @acos(float %32)
%34 = fmul double %33, 0x404CA5DC1A63CBB0
%35 = fptrunc double %34 to float
br label %36
36: ; preds = %6, %17
%37 = phi float [ %35, %17 ], [ -9.999900e+04, %6 ]
ret float %37
}