#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 /*<<< orphan*/ printf(char *, ...);
int spg_standardize_cell(double **, double **, int *, int const, int const,
                         int const, double const);
int sub_spg_standardize_cell(double lattice[3][3], double position[][3],
                             int types[], const int num_atom,
                             const double symprec, const int to_primitive,
                             const int no_idealize) {
  int i, num_primitive_atom;
  double lat[3][3], pos[num_atom][3];
  int typ[num_atom];
  for (i = 0; i < 3; i++) {
    lat[i][0] = lattice[i][0];
    lat[i][1] = lattice[i][1];
    lat[i][2] = lattice[i][2];
  }
  for (i = 0; i < num_atom; i++) {
    pos[i][0] = position[i][0];
    pos[i][1] = position[i][1];
    pos[i][2] = position[i][2];
    typ[i] = types[i];
  }
  num_primitive_atom = spg_standardize_cell(lat, pos, typ, num_atom,
                                            to_primitive, no_idealize, symprec);
  printf("VASP POSCAR format: ");
  if (to_primitive == 0) {
    printf("to_primitive=0 and ");
  } else {
    printf("to_primitive=1 and ");
  }
  if (no_idealize == 0) {
    printf("no_idealize=0\n");
  } else {
    printf("no_idealize=1\n");
  }
  printf("1.0\n");
  for (i = 0; i < 3; i++) {
    printf("%f %f %f\n", lat[0][i], lat[1][i], lat[2][i]);
  }
  printf("%d\n", num_primitive_atom);
  printf("Direct\n");
  for (i = 0; i < num_primitive_atom; i++) {
    printf("%f %f %f\n", pos[i][0], pos[i][1], pos[i][2]);
  }
}


x86 assembly (clang, -O0):
<sub_spg_standardize_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9d,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x98(%rbp)
lea    (%rax,%rax,2),%rcx
lea    0xf(,%rcx,8),%rdx
movabs $0x3ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xa0(%rbp)
mov    -0x24(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    1248 <sub_spg_standardize_cell+0x128>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x3c(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
movslq -0x3c(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
movslq -0x3c(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x10(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b1 <sub_spg_standardize_cell+0x91>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12f9 <sub_spg_standardize_cell+0x1d9>
mov    -0xb0(%rbp),%rax
mov    -0xb8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movslq -0x3c(%rbp),%rsi
imul   $0x18,%rsi,%rsi
add    %rsi,%rdx
movsd  (%rdx),%xmm0
movslq -0x3c(%rbp),%rdx
imul   $0x18,%rdx,%rsi
mov    %rcx,%rdx
add    %rsi,%rdx
movsd  %xmm0,(%rdx)
mov    -0x18(%rbp),%rdx
movslq -0x3c(%rbp),%rsi
imul   $0x18,%rsi,%rsi
add    %rsi,%rdx
movsd  0x8(%rdx),%xmm0
movslq -0x3c(%rbp),%rdx
imul   $0x18,%rdx,%rsi
mov    %rcx,%rdx
add    %rsi,%rdx
movsd  %xmm0,0x8(%rdx)
mov    -0x18(%rbp),%rdx
movslq -0x3c(%rbp),%rsi
imul   $0x18,%rsi,%rsi
add    %rsi,%rdx
movsd  0x10(%rdx),%xmm0
movslq -0x3c(%rbp),%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rcx
movsd  %xmm0,0x10(%rcx)
mov    -0x20(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    124f <sub_spg_standardize_cell+0x12f>
mov    -0xb0(%rbp),%rdx
mov    -0xb8(%rbp),%rsi
lea    -0x90(%rbp),%rdi
mov    -0x24(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
movsd  -0x30(%rbp),%xmm0
call   1040 <spg_standardize_cell@plt>
mov    %eax,-0x40(%rbp)
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1351 <sub_spg_standardize_cell+0x231>
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135f <sub_spg_standardize_cell+0x23f>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
jne    137c <sub_spg_standardize_cell+0x25c>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    138a <sub_spg_standardize_cell+0x26a>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    13e6 <sub_spg_standardize_cell+0x2c6>
movslq -0x3c(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x3c(%rbp),%rax
movsd  -0x78(%rbp,%rax,8),%xmm1
movslq -0x3c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm2
lea    0xc8f(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    139f <sub_spg_standardize_cell+0x27f>
mov    -0x40(%rbp),%esi
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1470 <sub_spg_standardize_cell+0x350>
mov    -0xb8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm0
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  0x8(%rcx),%xmm1
movslq -0x3c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xc05(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    140c <sub_spg_standardize_cell+0x2ec>
mov    -0x98(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_spg_standardize_cell>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9d,-0x30(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %ecx,%ebx
mov    %rsp,-0x40(%rbp)
mov    %ecx,%r15d
lea    (%r15,%r15,2),%rax
lea    0xf(,%rax,8),%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    %rsp,%r14
lea    0xf(,%r15,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
movups (%rdi),%xmm1
movaps %xmm1,-0x90(%rbp)
movups 0x10(%rdi),%xmm1
movaps %xmm1,-0x80(%rbp)
movups 0x20(%rdi),%xmm1
movaps %xmm1,-0x70(%rbp)
movups 0x30(%rdi),%xmm1
movaps %xmm1,-0x60(%rbp)
movsd  0x40(%rdi),%xmm1
movsd  %xmm1,-0x50(%rbp)
test   %ebx,%ebx
jle    127c <sub_spg_standardize_cell+0x13c>
mov    %rsi,%r13
movsd  %xmm0,-0x38(%rbp)
lea    0x0(,%r15,4),%rax
mov    %r14,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1050 <memcpy@plt>
cmp    $0x1,%ebx
jne    11f4 <sub_spg_standardize_cell+0xb4>
xor    %eax,%eax
jmp    1250 <sub_spg_standardize_cell+0x110>
mov    %r15d,%ecx
and    $0xfffffffe,%ecx
mov    $0x28,%edx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups -0x28(%r13,%rdx,1),%xmm0
movaps %xmm0,-0x28(%r12,%rdx,1)
movsd  -0x18(%r13,%rdx,1),%xmm0
movsd  %xmm0,-0x18(%r12,%rdx,1)
movups -0x10(%r13,%rdx,1),%xmm0
movups %xmm0,-0x10(%r12,%rdx,1)
movsd  0x0(%r13,%rdx,1),%xmm0
movsd  %xmm0,(%r12,%rdx,1)
add    $0x2,%rax
add    $0x30,%rdx
cmp    %rax,%rcx
jne    1210 <sub_spg_standardize_cell+0xd0>
test   $0x1,%r15b
movsd  -0x38(%rbp),%xmm0
je     127c <sub_spg_standardize_cell+0x13c>
shl    $0x3,%rax
lea    (%rax,%rax,2),%rax
movups 0x0(%r13,%rax,1),%xmm1
movups %xmm1,(%r12,%rax,1)
movsd  0x10(%r13,%rax,1),%xmm1
movsd  %xmm1,0x10(%r12,%rax,1)
lea    -0x90(%rbp),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    -0x2c(%rbp),%ebx
mov    %ebx,%r8d
mov    -0x30(%rbp),%r14d
mov    %r14d,%r9d
call   1060 <spg_standardize_cell@plt>
mov    %eax,%r15d
lea    0xd59(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
lea    0xd5e(%rip),%rax
lea    0xd6b(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
lea    0xd91(%rip),%rax
lea    0xd71(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xd6f(%rip),%rdi
call   1030 <puts@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x78(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
lea    0xd35(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  -0x80(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xcf9(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcfe(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    13a7 <sub_spg_standardize_cell+0x267>
mov    %r15d,%eax
shl    $0x3,%rax
lea    (%rax,%rax,2),%r15
xor    %ebx,%ebx
lea    0xcc0(%rip),%r14
nopl   (%rax)
movsd  (%r12,%rbx,1),%xmm0
movsd  0x8(%r12,%rbx,1),%xmm1
movsd  0x10(%r12,%rbx,1),%xmm2
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x18,%rbx
cmp    %rbx,%r15
jne    1380 <sub_spg_standardize_cell+0x240>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"VASP POSCAR format: \00"
@.str.1 = [20 x i8] c"to_primitive=0 and \00"
@.str.2 = [20 x i8] c"to_primitive=1 and \00"
@.str.6 = [10 x i8] c"%f %f %f\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@str = [14 x i8] c"no_idealize=1\00"
@str.9 = [4 x i8] c"1.0\00"
@str.10 = [7 x i8] c"Direct\00"
@str.11 = [14 x i8] c"no_idealize=0\00"
define i32 @sub_spg_standardize_cell([3 x double]* nocapture %0, [3 x double]* nocapture %1, i32* nocapture %2, i32 %3, double %4, i32 %5, i32 %6) {
%8 = alloca [3 x [3 x double]]
%9 = bitcast [3 x [3 x double]]* %8 to i8*
%10 = zext i32 %3 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca [3 x double], i64 %10
%13 = alloca i32, i64 %10
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0, i64 0
%15 = bitcast [3 x double]* %0 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0, i64 1
%18 = bitcast [3 x [3 x double]]* %8 to <2 x double>*
store <2 x double> %16, <2 x double>* %18
%19 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0, i64 2
%21 = bitcast double* %19 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 1, i64 0
%24 = bitcast double* %20 to <2 x double>*
store <2 x double> %22, <2 x double>* %24
%25 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 1, i64 1
%27 = bitcast double* %25 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 1, i64 2
%30 = bitcast double* %26 to <2 x double>*
store <2 x double> %28, <2 x double>* %30
%31 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%32 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 2, i64 0
%33 = bitcast double* %31 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 2, i64 1
%36 = bitcast double* %32 to <2 x double>*
store <2 x double> %34, <2 x double>* %36
%37 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%38 = load double, double* %37
%39 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 2, i64 2
store double %38, double* %39
%40 = icmp sgt i32 %3, 0
br i1 %40, label %41, label %84
41: ; preds = %7
%42 = bitcast i32* %13 to i8*
%43 = bitcast i32* %2 to i8*
%44 = shl nuw nsw i64 %10, 2
%45 = and i64 %10, 1
%46 = icmp eq i32 %3, 1
br i1 %46, label %72, label %47
47: ; preds = %41
%48 = and i64 %10, 4294967294
br label %49
49: ; preds = %49, %47
%50 = phi i64 [ 0, %47 ], [ %69, %49 ]
%51 = phi i64 [ 0, %47 ], [ %70, %49 ]
%52 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %50, i64 0
%53 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %50, i64 0
%54 = bitcast double* %52 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = bitcast double* %53 to <2 x double>*
store <2 x double> %55, <2 x double>* %56
%57 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %50, i64 2
%58 = load double, double* %57
%59 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %50, i64 2
store double %58, double* %59
%60 = or i64 %50, 1
%61 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %60, i64 0
%62 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %60, i64 0
%63 = bitcast double* %61 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = bitcast double* %62 to <2 x double>*
store <2 x double> %64, <2 x double>* %65
%66 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %60, i64 2
%67 = load double, double* %66
%68 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %60, i64 2
store double %67, double* %68
%69 = add nuw nsw i64 %50, 2
%70 = add i64 %51, 2
%71 = icmp eq i64 %70, %48
br i1 %71, label %72, label %49
72: ; preds = %49, %41
%73 = phi i64 [ 0, %41 ], [ %69, %49 ]
%74 = icmp eq i64 %45, 0
br i1 %74, label %84, label %75
75: ; preds = %72
%76 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %73, i64 0
%77 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %73, i64 0
%78 = bitcast double* %76 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = bitcast double* %77 to <2 x double>*
store <2 x double> %79, <2 x double>* %80
%81 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %73, i64 2
%82 = load double, double* %81
%83 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %73, i64 2
store double %82, double* %83
br label %84
84: ; preds = %75, %72, %7
%85 = bitcast [3 x [3 x double]]* %8 to double**
%86 = bitcast [3 x double]* %12 to double**
%87 = call i32 @spg_standardize_cell(double** %85, double** %86, i32* %13, i32 %3, i32 %5, i32 %6, double %4)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%89 = icmp eq i32 %5, 0
%90 = select i1 %89, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %90)
%92 = icmp eq i32 %6, 0
%93 = select i1 %92, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0)
%94 = call i32 @puts(i8* dereferenceable(1) %93)
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.9, i64 0, i64 0))
%96 = load double, double* %14
%97 = load double, double* %23
%98 = load double, double* %32
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %96, double %97, double %98)
%100 = load double, double* %17
%101 = load double, double* %26
%102 = load double, double* %35
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %100, double %101, double %102)
%104 = load double, double* %20
%105 = load double, double* %29
%106 = load double, double* %39
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %104, double %105, double %106)
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %87)
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
%110 = icmp sgt i32 %87, 0
br i1 %110, label %111, label %124
111: ; preds = %84
%112 = zext i32 %87 to i64
br label %113
113: ; preds = %111, %113
%114 = phi i64 [ 0, %111 ], [ %122, %113 ]
%115 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %114, i64 0
%116 = load double, double* %115
%117 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %114, i64 1
%118 = load double, double* %117
%119 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 %114, i64 2
%120 = load double, double* %119
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %116, double %118, double %120)
%122 = add nuw nsw i64 %114, 1
%123 = icmp eq i64 %122, %112
br i1 %123, label %124, label %113
124: ; preds = %113, %84
ret i32 undef
}