#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 sqrt(double);
void AxisAng3(double expc3[3], double omghat[3], double *theta) {
  int i;
  int ret = 0;
  *theta =
      sqrt(expc3[0] * expc3[0] + expc3[1] * expc3[1] + expc3[2] * expc3[2]);
  if (*theta < 1.0E-6) {
    omghat[0] = 0.0;
    omghat[1] = 0.0;
    omghat[2] = 0.0;
    *theta = 0.0;
    return;
  }
  for (i = 0; i < 3; i++) {
    omghat[i] = expc3[i] / (*theta);
  }
  return;
}


x86 assembly (clang, -O0):
<AxisAng3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%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   1030 <sqrt@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0xe78(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    11c5 <AxisAng3+0xb5>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    120b <AxisAng3+0xfb>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1206 <AxisAng3+0xf6>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cc <AxisAng3+0xbc>
jmp    120b <AxisAng3+0xfb>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AxisAng3>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1150 <AxisAng3+0x40>
sqrtsd %xmm0,%xmm0
jmp    1155 <AxisAng3+0x45>
call   1030 <sqrt@plt>
movsd  %xmm0,(%r14)
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1182 <AxisAng3+0x72>
xorpd  %xmm0,%xmm0
movupd %xmm0,(%r15)
movq   $0x0,0x10(%r15)
movq   $0x0,(%r14)
jmp    11af <AxisAng3+0x9f>
movsd  (%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
movsd  0x8(%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x8(%r15)
movsd  0x10(%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x10(%r15)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @AxisAng3(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %8
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = call double @llvm.fmuladd.f64(double %25, double %28, double %22)
%30 = call double @sqrt(double %29)
%31 = load double*, double** %6
store double %30, double* %31
%32 = load double*, double** %6
%33 = load double, double* %32
%34 = fcmp olt double %33, 0x3EB0C6F7A0B5ED8D
br i1 %34, label %35, label %43
35: ; preds = %3
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i64 0
store double 0.000000e+00, double* %37
%38 = load double*, double** %5
%39 = getelementptr inbounds double, double* %38, i64 1
store double 0.000000e+00, double* %39
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 2
store double 0.000000e+00, double* %41
%42 = load double*, double** %6
store double 0.000000e+00, double* %42
br label %64
43: ; preds = %3
store i32 0, i32* %7
br label %44
44: ; preds = %60, %43
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 3
br i1 %46, label %47, label %63
47: ; preds = %44
%48 = load double*, double** %4
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %6
%54 = load double, double* %53
%55 = fdiv double %52, %54
%56 = load double*, double** %5
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
br label %60
60: ; preds = %47
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %44
63: ; preds = %44
br label %64
64: ; preds = %63, %35
ret void
}

LLVM IR (-O2):
define void @AxisAng3(double* nocapture %0, double* nocapture writeonly %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %7)
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %8)
%12 = tail call double @sqrt(double %11)
store double %12, double* %2
%13 = fcmp olt double %12, 0x3EB0C6F7A0B5ED8D
br i1 %13, label %25, label %14
14: ; preds = %3
%15 = load double, double* %0
%16 = fdiv double %15, %12
store double %16, double* %1
%17 = load double, double* %5
%18 = load double, double* %2
%19 = fdiv double %17, %18
%20 = getelementptr inbounds double, double* %1, i64 1
store double %19, double* %20
%21 = load double, double* %9
%22 = load double, double* %2
%23 = fdiv double %21, %22
%24 = getelementptr inbounds double, double* %1, i64 2
store double %23, double* %24
br label %27
25: ; preds = %3
%26 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %2
br label %27
27: ; preds = %14, %25
ret void
}