double get_tolerance_for_BZ_reduction(double rec_lattice[3][3]) {
  int i, j;
  double tolerance;
  double length[3];
  for (i = 0; i < 3; i++) {
    length[i] = 0;
    for (j = 0; j < 3; j++) {
      length[i] += rec_lattice[j][i] * rec_lattice[j][i];
    }
  }
  tolerance = length[0];
  for (i = 1; i < 3; i++) {
    if (tolerance > length[i]) {
      tolerance = length[i];
    }
  }
  tolerance *= 0.01;
  return tolerance;
}


x86 assembly (clang, -O0):
<get_tolerance_for_BZ_reduction>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    11a0 <get_tolerance_for_BZ_reduction+0xa0>
movslq -0xc(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp,%rax,8)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    118d <get_tolerance_for_BZ_reduction+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movslq -0xc(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp,%rax,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <get_tolerance_for_BZ_reduction+0x2d>
jmp    1192 <get_tolerance_for_BZ_reduction+0x92>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <get_tolerance_for_BZ_reduction+0xf>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    11f2 <get_tolerance_for_BZ_reduction+0xf2>
movsd  -0x18(%rbp),%xmm0
movslq -0xc(%rbp),%rax
ucomisd -0x30(%rbp,%rax,8),%xmm0
jbe    11df <get_tolerance_for_BZ_reduction+0xdf>
movslq -0xc(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e4 <get_tolerance_for_BZ_reduction+0xe4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b1 <get_tolerance_for_BZ_reduction+0xb1>
movsd  0xe06(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tolerance_for_BZ_reduction>:
movupd (%rdi),%xmm0
mulpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
addpd  %xmm0,%xmm1
movupd 0x18(%rdi),%xmm0
mulpd  %xmm0,%xmm0
addpd  %xmm1,%xmm0
movupd 0x30(%rdi),%xmm1
mulpd  %xmm1,%xmm1
addpd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
movsd  0x28(%rdi),%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm2,%xmm3
movsd  0x40(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
minsd  %xmm1,%xmm2
minsd  %xmm2,%xmm0
mulsd  0xe93(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @get_tolerance_for_BZ_reduction([3 x double]* nocapture %0) {
%2 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%3 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%4 = bitcast [3 x double]* %0 to <2 x double>*
%5 = load <2 x double>, <2 x double>* %4
%6 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> %5, <2 x double> zeroinitializer)
%7 = bitcast double* %2 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> %8, <2 x double> %6)
%10 = bitcast double* %3 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %11, <2 x double> %9)
%13 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double %14, double 0.000000e+00)
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %15)
%19 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%20 = load double, double* %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %18)
%22 = extractelement <2 x double> %12, i64 0
%23 = extractelement <2 x double> %12, i64 1
%24 = fcmp ogt double %22, %23
%25 = select i1 %24, double %23, double %22
%26 = fcmp ogt double %25, %21
%27 = select i1 %26, double %21, double %25
%28 = fmul double %27, 1.000000e-02
ret double %28
}