#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 delaunay_reduce_basis_2D(double **, double const);
int /*<<< orphan*/ get_delaunay_shortest_vectors_2D(double **, double *,
                                                    double const);
int /*<<< orphan*/ get_exteneded_basis_2D(double **, double **);
double const mat_Dabs(double);
double mat_get_determinant_d3(double **);
int delaunay_reduce_2D(double red_lattice[3][3], double lattice[3][3],
                       const int unique_axis, const double symprec) {
  int i, j, k, attempt, succeeded;
  double volume;
  double basis[3][3], lattice_2D[3][2], unique_vec[3];
  k = 0;
  for (i = 0; i < 3; i++) {
    unique_vec[i] = lattice[i][unique_axis];
  }
  for (i = 0; i < 3; i++) {
    if (i != unique_axis) {
      for (j = 0; j < 3; j++) {
        lattice_2D[j][k] = lattice[j][i];
      }
      k++;
    }
  }
  get_exteneded_basis_2D(basis, lattice_2D);
  for (attempt = 0; attempt < 100; attempt++) {
    succeeded = delaunay_reduce_basis_2D(basis, symprec);
    if (succeeded) {
      break;
    }
  }
  if (!succeeded) {
    goto err;
  }
  get_delaunay_shortest_vectors_2D(basis, unique_vec, symprec);
  k = 0;
  for (i = 0; i < 3; i++) {
    if (i == unique_axis) {
      for (j = 0; j < 3; j++) {
        red_lattice[j][i] = lattice[j][i];
      }
    } else {
      for (j = 0; j < 3; j++) {
        red_lattice[j][i] = basis[k][j];
      }
      k++;
    }
  }
  volume = mat_get_determinant_d3(red_lattice);
  if (mat_Dabs(volume) < symprec) {
    ;
    goto err;
  }
  if (volume < 0) {
    for (i = 0; i < 3; i++) {
      red_lattice[i][unique_axis] = -red_lattice[i][unique_axis];
    }
  }
  return 1;
err:
  return 0;
}


x86 assembly (clang, -O0):
<delaunay_reduce_2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11b6 <delaunay_reduce_2D+0x66>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0xe0(%rbp,%rax,8)
ff ff
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1179 <delaunay_reduce_2D+0x29>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1241 <delaunay_reduce_2D+0xf1>
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     122e <delaunay_reduce_2D+0xde>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1225 <delaunay_reduce_2D+0xd5>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x30(%rbp),%rcx
lea    -0xc0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11da <delaunay_reduce_2D+0x8a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1233 <delaunay_reduce_2D+0xe3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bd <delaunay_reduce_2D+0x6d>
lea    -0x90(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1050 <get_exteneded_basis_2D@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x64,-0x38(%rbp)
jge    129b <delaunay_reduce_2D+0x14b>
lea    -0x90(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
call   1030 <delaunay_reduce_basis_2D@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1288 <delaunay_reduce_2D+0x138>
jmp    129b <delaunay_reduce_2D+0x14b>
jmp    128d <delaunay_reduce_2D+0x13d>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    125b <delaunay_reduce_2D+0x10b>
cmpl   $0x0,-0x3c(%rbp)
jne    12aa <delaunay_reduce_2D+0x15a>
jmp    145c <delaunay_reduce_2D+0x30c>
lea    -0x90(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
call   1060 <get_delaunay_shortest_vectors_2D@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    13a8 <delaunay_reduce_2D+0x258>
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    133a <delaunay_reduce_2D+0x1ea>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1335 <delaunay_reduce_2D+0x1e5>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12ed <delaunay_reduce_2D+0x19d>
jmp    1395 <delaunay_reduce_2D+0x245>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    138c <delaunay_reduce_2D+0x23c>
movslq -0x34(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1341 <delaunay_reduce_2D+0x1f1>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    139a <delaunay_reduce_2D+0x24a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12d0 <delaunay_reduce_2D+0x180>
mov    -0x10(%rbp),%rdi
call   1040 <mat_get_determinant_d3@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1070 <mat_Dabs@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13d7 <delaunay_reduce_2D+0x287>
jmp    145c <delaunay_reduce_2D+0x30c>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1450 <delaunay_reduce_2D+0x300>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    144b <delaunay_reduce_2D+0x2fb>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13ec <delaunay_reduce_2D+0x29c>
jmp    1450 <delaunay_reduce_2D+0x300>
movl   $0x1,-0x4(%rbp)
jmp    1463 <delaunay_reduce_2D+0x313>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delaunay_reduce_2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r14
movslq %edx,%r12
movsd  (%rsi,%r12,8),%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  0x18(%rsi,%r12,8),%xmm0
movsd  %xmm0,0x58(%rsp)
movsd  0x30(%rsi,%r12,8),%xmm0
movsd  %xmm0,0x60(%rsp)
test   %r12d,%r12d
je     11cd <delaunay_reduce_2D+0x7d>
movsd  (%rbx),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x30(%rbx),%xmm0
movsd  %xmm0,0x40(%rsp)
mov    $0x1,%cl
mov    $0x1,%eax
cmp    $0x1,%r15d
jne    11cf <delaunay_reduce_2D+0x7f>
jmp    120d <delaunay_reduce_2D+0xbd>
xor    %eax,%eax
mov    %eax,%ecx
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x20(%rsp,%rcx,8)
movsd  0x20(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp,%rcx,8)
movsd  0x38(%rbx),%xmm0
movsd  %xmm0,0x40(%rsp,%rcx,8)
xor    %ecx,%ecx
cmp    $0x2,%r15d
jne    120a <delaunay_reduce_2D+0xba>
movl   $0x0,0xc(%rsp)
mov    $0x1,%al
mov    %eax,0x10(%rsp)
jmp    123c <delaunay_reduce_2D+0xec>
add    $0x1,%eax
mov    %ecx,0xc(%rsp)
mov    %eax,%eax
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x20(%rsp,%rax,8)
movsd  0x28(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp,%rax,8)
movsd  0x40(%rbx),%xmm0
movsd  %xmm0,0x40(%rsp,%rax,8)
movl   $0x0,0x10(%rsp)
lea    0x70(%rsp),%rbp
lea    0x20(%rsp),%rsi
mov    %rbp,%rdi
call   1050 <get_exteneded_basis_2D@plt>
mov    $0x64,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <delaunay_reduce_basis_2D@plt>
test   %eax,%eax
jne    127f <delaunay_reduce_2D+0x12f>
add    $0xffffffff,%r13d
jne    1260 <delaunay_reduce_2D+0x110>
xor    %eax,%eax
jmp    13fa <delaunay_reduce_2D+0x2aa>
lea    0x70(%rsp),%rdi
lea    0x50(%rsp),%rsi
movsd  0x18(%rsp),%xmm0
call   1060 <get_delaunay_shortest_vectors_2D@plt>
test   %r15d,%r15d
je     12c0 <delaunay_reduce_2D+0x170>
movsd  0x70(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  0x78(%rsp),%xmm0
movsd  %xmm0,0x18(%r14)
mov    $0x1,%eax
movsd  0x80(%rsp),%xmm0
jmp    12db <delaunay_reduce_2D+0x18b>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%r14)
movsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x18(%r14)
movsd  0x30(%rbx),%xmm0
xor    %eax,%eax
mov    0xc(%rsp),%ecx
movsd  %xmm0,0x30(%r14)
test   %cl,%cl
je     130c <delaunay_reduce_2D+0x1bc>
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x20(%rbx),%xmm0
movsd  %xmm0,0x20(%r14)
movsd  0x38(%rbx),%xmm0
movsd  %xmm0,0x38(%r14)
jmp    133c <delaunay_reduce_2D+0x1ec>
mov    %eax,%ecx
lea    (%rcx,%rcx,2),%rcx
movsd  0x70(%rsp,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x78(%rsp,%rcx,8),%xmm0
movsd  %xmm0,0x20(%r14)
movsd  0x80(%rsp,%rcx,8),%xmm0
movsd  %xmm0,0x38(%r14)
add    $0x1,%eax
mov    0x10(%rsp),%ecx
test   %cl,%cl
je     1360 <delaunay_reduce_2D+0x210>
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x28(%rbx),%xmm0
movsd  %xmm0,0x28(%r14)
add    $0x40,%rbx
jmp    1389 <delaunay_reduce_2D+0x239>
mov    %eax,%eax
lea    (%rax,%rax,2),%rax
movsd  0x70(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x78(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x28(%r14)
lea    (%rsp,%rax,8),%rbx
add    $0x80,%rbx
movsd  (%rbx),%xmm0
movsd  %xmm0,0x40(%r14)
mov    %r14,%rdi
call   1040 <mat_get_determinant_d3@plt>
movsd  %xmm0,0x10(%rsp)
call   1070 <mat_Dabs@plt>
xor    %eax,%eax
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     13fa <delaunay_reduce_2D+0x2aa>
mov    $0x1,%eax
xorpd  %xmm0,%xmm0
ucomisd 0x10(%rsp),%xmm0
jbe    13fa <delaunay_reduce_2D+0x2aa>
movsd  (%r14,%r12,8),%xmm0
movsd  0x18(%r14,%r12,8),%xmm1
movsd  0x30(%r14,%r12,8),%xmm2
movaps 0xc20(%rip),%xmm3
xorps  %xmm3,%xmm0
movlps %xmm0,(%r14,%r12,8)
xorps  %xmm3,%xmm1
movlps %xmm1,0x18(%r14,%r12,8)
xorps  %xmm3,%xmm2
movlps %xmm2,0x30(%r14,%r12,8)
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @delaunay_reduce_2D([3 x double]* %0, [3 x double]* %1, i32 %2, double %3) {
%5 = alloca i32
%6 = alloca [3 x double]*
%7 = alloca [3 x double]*
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca [3 x [3 x double]]
%17 = alloca [3 x [2 x double]]
%18 = alloca [3 x double]
store [3 x double]* %0, [3 x double]** %6
store [3 x double]* %1, [3 x double]** %7
store i32 %2, i32* %8
store double %3, double* %9
store i32 0, i32* %12
store i32 0, i32* %10
br label %19
19: ; preds = %34, %4
%20 = load i32, i32* %10
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %37
22: ; preds = %19
%23 = load [3 x double]*, [3 x double]** %7
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 %28
%30 = load double, double* %29
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 %32
store double %30, double* %33
br label %34
34: ; preds = %22
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %19
37: ; preds = %19
store i32 0, i32* %10
br label %38
38: ; preds = %71, %37
%39 = load i32, i32* %10
%40 = icmp slt i32 %39, 3
br i1 %40, label %41, label %74
41: ; preds = %38
%42 = load i32, i32* %10
%43 = load i32, i32* %8
%44 = icmp ne i32 %42, %43
br i1 %44, label %45, label %70
45: ; preds = %41
store i32 0, i32* %11
br label %46
46: ; preds = %64, %45
%47 = load i32, i32* %11
%48 = icmp slt i32 %47, 3
br i1 %48, label %49, label %67
49: ; preds = %46
%50 = load [3 x double]*, [3 x double]** %7
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x double], [3 x double]* %50, i64 %52
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 0, i64 %55
%57 = load double, double* %56
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %17, i64 0, i64 %59
%61 = load i32, i32* %12
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [2 x double], [2 x double]* %60, i64 0, i64 %62
store double %57, double* %63
br label %64
64: ; preds = %49
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %46
67: ; preds = %46
%68 = load i32, i32* %12
%69 = add nsw i32 %68, 1
store i32 %69, i32* %12
br label %70
70: ; preds = %67, %41
br label %71
71: ; preds = %70
%72 = load i32, i32* %10
%73 = add nsw i32 %72, 1
store i32 %73, i32* %10
br label %38
74: ; preds = %38
%75 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %16, i64 0, i64 0
%76 = bitcast [3 x double]* %75 to double**
%77 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %17, i64 0, i64 0
%78 = bitcast [2 x double]* %77 to double**
%79 = call i32 @get_exteneded_basis_2D(double** %76, double** %78)
store i32 0, i32* %13
br label %80
80: ; preds = %92, %74
%81 = load i32, i32* %13
%82 = icmp slt i32 %81, 100
br i1 %82, label %83, label %95
83: ; preds = %80
%84 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %16, i64 0, i64 0
%85 = bitcast [3 x double]* %84 to double**
%86 = load double, double* %9
%87 = call i32 @delaunay_reduce_basis_2D(double** %85, double %86)
store i32 %87, i32* %14
%88 = load i32, i32* %14
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %83
br label %95
91: ; preds = %83
br label %92
92: ; preds = %91
%93 = load i32, i32* %13
%94 = add nsw i32 %93, 1
store i32 %94, i32* %13
br label %80
95: ; preds = %90, %80
%96 = load i32, i32* %14
%97 = icmp ne i32 %96, 0
br i1 %97, label %99, label %98
98: ; preds = %95
br label %203
99: ; preds = %95
%100 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %16, i64 0, i64 0
%101 = bitcast [3 x double]* %100 to double**
%102 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 0
%103 = load double, double* %9
%104 = call i32 @get_delaunay_shortest_vectors_2D(double** %101, double* %102, double %103)
store i32 0, i32* %12
store i32 0, i32* %10
br label %105
105: ; preds = %162, %99
%106 = load i32, i32* %10
%107 = icmp slt i32 %106, 3
br i1 %107, label %108, label %165
108: ; preds = %105
%109 = load i32, i32* %10
%110 = load i32, i32* %8
%111 = icmp eq i32 %109, %110
br i1 %111, label %112, label %136
112: ; preds = %108
store i32 0, i32* %11
br label %113
113: ; preds = %132, %112
%114 = load i32, i32* %11
%115 = icmp slt i32 %114, 3
br i1 %115, label %116, label %135
116: ; preds = %113
%117 = load [3 x double]*, [3 x double]** %7
%118 = load i32, i32* %11
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [3 x double], [3 x double]* %117, i64 %119
%121 = load i32, i32* %10
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [3 x double], [3 x double]* %120, i64 0, i64 %122
%124 = load double, double* %123
%125 = load [3 x double]*, [3 x double]** %6
%126 = load i32, i32* %11
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [3 x double], [3 x double]* %125, i64 %127
%129 = load i32, i32* %10
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [3 x double], [3 x double]* %128, i64 0, i64 %130
store double %124, double* %131
br label %132
132: ; preds = %116
%133 = load i32, i32* %11
%134 = add nsw i32 %133, 1
store i32 %134, i32* %11
br label %113
135: ; preds = %113
br label %161
136: ; preds = %108
store i32 0, i32* %11
br label %137
137: ; preds = %155, %136
%138 = load i32, i32* %11
%139 = icmp slt i32 %138, 3
br i1 %139, label %140, label %158
140: ; preds = %137
%141 = load i32, i32* %12
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %16, i64 0, i64 %142
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [3 x double], [3 x double]* %143, i64 0, i64 %145
%147 = load double, double* %146
%148 = load [3 x double]*, [3 x double]** %6
%149 = load i32, i32* %11
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [3 x double], [3 x double]* %148, i64 %150
%152 = load i32, i32* %10
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [3 x double], [3 x double]* %151, i64 0, i64 %153
store double %147, double* %154
br label %155
155: ; preds = %140
%156 = load i32, i32* %11
%157 = add nsw i32 %156, 1
store i32 %157, i32* %11
br label %137
158: ; preds = %137
%159 = load i32, i32* %12
%160 = add nsw i32 %159, 1
store i32 %160, i32* %12
br label %161
161: ; preds = %158, %135
br label %162
162: ; preds = %161
%163 = load i32, i32* %10
%164 = add nsw i32 %163, 1
store i32 %164, i32* %10
br label %105
165: ; preds = %105
%166 = load [3 x double]*, [3 x double]** %6
%167 = bitcast [3 x double]* %166 to double**
%168 = call double @mat_get_determinant_d3(double** %167)
store double %168, double* %15
%169 = load double, double* %15
%170 = call double @mat_Dabs(double %169)
%171 = load double, double* %9
%172 = fcmp olt double %170, %171
br i1 %172, label %173, label %174
173: ; preds = %165
br label %203
174: ; preds = %165
%175 = load double, double* %15
%176 = fcmp olt double %175, 0.000000e+00
br i1 %176, label %177, label %202
177: ; preds = %174
store i32 0, i32* %10
br label %178
178: ; preds = %198, %177
%179 = load i32, i32* %10
%180 = icmp slt i32 %179, 3
br i1 %180, label %181, label %201
181: ; preds = %178
%182 = load [3 x double]*, [3 x double]** %6
%183 = load i32, i32* %10
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [3 x double], [3 x double]* %182, i64 %184
%186 = load i32, i32* %8
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [3 x double], [3 x double]* %185, i64 0, i64 %187
%189 = load double, double* %188
%190 = fneg double %189
%191 = load [3 x double]*, [3 x double]** %6
%192 = load i32, i32* %10
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds [3 x double], [3 x double]* %191, i64 %193
%195 = load i32, i32* %8
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [3 x double], [3 x double]* %194, i64 0, i64 %196
store double %190, double* %197
br label %198
198: ; preds = %181
%199 = load i32, i32* %10
%200 = add nsw i32 %199, 1
store i32 %200, i32* %10
br label %178
201: ; preds = %178
br label %202
202: ; preds = %201, %174
store i32 1, i32* %5
br label %204
203: ; preds = %173, %98
store i32 0, i32* %5
br label %204
204: ; preds = %203, %202
%205 = load i32, i32* %5
ret i32 %205
}

LLVM IR (-O2):
define i32 @delaunay_reduce_2D([3 x double]* %0, [3 x double]* nocapture %1, i32 %2, double %3) {
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x [2 x double]]
%7 = alloca [3 x double]
%8 = bitcast [3 x [3 x double]]* %5 to i8*
%9 = bitcast [3 x [2 x double]]* %6 to i8*
%10 = bitcast [3 x double]* %7 to i8*
%11 = sext i32 %2 to i64
%12 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 %11
%13 = load double, double* %12
%14 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
store double %13, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 %11
%16 = load double, double* %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
store double %16, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 %11
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %19, double* %20
%21 = icmp eq i32 %2, 0
br i1 %21, label %33, label %22
22: ; preds = %4
%23 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%24 = load double, double* %23
%25 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 0, i64 0
store double %24, double* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
%27 = load double, double* %26
%28 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 1, i64 0
store double %27, double* %28
%29 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%30 = load double, double* %29
%31 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 2, i64 0
store double %30, double* %31
%32 = icmp eq i32 %2, 1
br i1 %32, label %47, label %33
33: ; preds = %4, %22
%34 = phi i32 [ 1, %22 ], [ 0, %4 ]
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%37 = load double, double* %36
%38 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 0, i64 %35
store double %37, double* %38
%39 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%40 = load double, double* %39
%41 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 1, i64 %35
store double %40, double* %41
%42 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
%43 = load double, double* %42
%44 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 2, i64 %35
store double %43, double* %44
%45 = add nuw nsw i32 %34, 1
%46 = icmp eq i32 %2, 2
br i1 %46, label %60, label %47
47: ; preds = %22, %33
%48 = phi i32 [ %45, %33 ], [ 1, %22 ]
%49 = phi i1 [ false, %33 ], [ true, %22 ]
%50 = zext i32 %48 to i64
%51 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%52 = load double, double* %51
%53 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 0, i64 %50
store double %52, double* %53
%54 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%55 = load double, double* %54
%56 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 1, i64 %50
store double %55, double* %56
%57 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
%58 = load double, double* %57
%59 = getelementptr inbounds [3 x [2 x double]], [3 x [2 x double]]* %6, i64 0, i64 2, i64 %50
store double %58, double* %59
br label %60
60: ; preds = %47, %33
%61 = phi i1 [ false, %47 ], [ true, %33 ]
%62 = phi i1 [ %49, %47 ], [ false, %33 ]
%63 = bitcast [3 x [3 x double]]* %5 to double**
%64 = bitcast [3 x [2 x double]]* %6 to double**
%65 = call i32 @get_exteneded_basis_2D(double** %63, double** %64)
br label %69
66: ; preds = %69
%67 = add nuw nsw i32 %70, 1
%68 = icmp eq i32 %67, 100
br i1 %68, label %158, label %69
69: ; preds = %60, %66
%70 = phi i32 [ 0, %60 ], [ %67, %66 ]
%71 = call i32 @delaunay_reduce_basis_2D(double** %63, double %3)
%72 = icmp eq i32 %71, 0
br i1 %72, label %66, label %73
73: ; preds = %69
%74 = call i32 @get_delaunay_shortest_vectors_2D(double** %63, double* %14, double %3)
br i1 %21, label %84, label %75
75: ; preds = %73
%76 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 0
%77 = load double, double* %76
%78 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
store double %77, double* %78
%79 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 1
%80 = load double, double* %79
%81 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
store double %80, double* %81
%82 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 2
%83 = load double, double* %82
br label %93
84: ; preds = %73
%85 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%86 = load double, double* %85
%87 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
store double %86, double* %87
%88 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
%89 = load double, double* %88
%90 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
store double %89, double* %90
%91 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%92 = load double, double* %91
br label %93
93: ; preds = %84, %75
%94 = phi double [ %92, %84 ], [ %83, %75 ]
%95 = phi i32 [ 0, %84 ], [ 1, %75 ]
%96 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
store double %94, double* %96
br i1 %62, label %109, label %97
97: ; preds = %93
%98 = zext i32 %95 to i64
%99 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %98, i64 0
%100 = load double, double* %99
%101 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
store double %100, double* %101
%102 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %98, i64 1
%103 = load double, double* %102
%104 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
store double %103, double* %104
%105 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %98, i64 2
%106 = load double, double* %105
%107 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
store double %106, double* %107
%108 = add nuw nsw i32 %95, 1
br label %119
109: ; preds = %93
%110 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%111 = load double, double* %110
%112 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
store double %111, double* %112
%113 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%114 = load double, double* %113
%115 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
store double %114, double* %115
%116 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
%117 = load double, double* %116
%118 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
store double %117, double* %118
br label %119
119: ; preds = %109, %97
%120 = phi i32 [ %108, %97 ], [ %95, %109 ]
br i1 %61, label %130, label %121
121: ; preds = %119
%122 = zext i32 %120 to i64
%123 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %122, i64 0
%124 = load double, double* %123
%125 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
store double %124, double* %125
%126 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %122, i64 1
%127 = load double, double* %126
%128 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
store double %127, double* %128
%129 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 %122, i64 2
br label %138
130: ; preds = %119
%131 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%132 = load double, double* %131
%133 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
store double %132, double* %133
%134 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%135 = load double, double* %134
%136 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
store double %135, double* %136
%137 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
br label %138
138: ; preds = %130, %121
%139 = phi double* [ %137, %130 ], [ %129, %121 ]
%140 = load double, double* %139
%141 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
store double %140, double* %141
%142 = bitcast [3 x double]* %0 to double**
%143 = call double @mat_get_determinant_d3(double** %142)
%144 = call double @mat_Dabs(double %143)
%145 = fcmp olt double %144, %3
br i1 %145, label %158, label %146
146: ; preds = %138
%147 = fcmp olt double %143, 0.000000e+00
br i1 %147, label %148, label %158
148: ; preds = %146
%149 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 %11
%150 = load double, double* %149
%151 = fneg double %150
store double %151, double* %149
%152 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 %11
%153 = load double, double* %152
%154 = fneg double %153
store double %154, double* %152
%155 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 %11
%156 = load double, double* %155
%157 = fneg double %156
store double %157, double* %155
br label %158
158: ; preds = %66, %148, %138, %146
%159 = phi i32 [ 1, %146 ], [ 0, %138 ], [ 1, %148 ], [ 0, %66 ]
ret i32 %159
}