#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 *);
scalar_t__ sub_spg_standardize_cell(double **, double **, int *, int, double,
                                    int, int);
int test_spg_standardize_cell_BCC(void) {
  double lattice[3][3] = {{3.97, 0, 0}, {0, 4.03, 0}, {0, 0, 4.0}};
  double position[][3] = {{0.002, 0, 0}, {0.5, 0.5001, 0.5}};
  int types[] = {1, 1};
  int j, k, num_atom = 2;
  double symprec = 1e-1;
  printf("*** spg_standardize_cell (BCC unitcell --> primitive) ***:\n");
  printf("------------------------------------------------------\n");
  for (j = 0; j < 2; j++) {
    for (k = 0; k < 2; k++) {
      if (sub_spg_standardize_cell(lattice, position, types, num_atom, symprec,
                                   j, k)) {
        return 1;
      }
      printf("------------------------------------------------------\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_spg_standardize_cell_BCC>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1040 <memset@plt>
movsd  0xedd(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x88(%rbp)
movl   $0x2,-0x94(%rbp)
movsd  0xe2a(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x2,-0x8c(%rbp)
jge    12a3 <test_spg_standardize_cell_BCC+0x173>
movl   $0x0,-0x90(%rbp)
cmpl   $0x2,-0x90(%rbp)
jge    128a <test_spg_standardize_cell_BCC+0x15a>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x88(%rbp),%rdx
mov    -0x94(%rbp),%ecx
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x8c(%rbp),%r8d
mov    -0x90(%rbp),%r9d
call   1050 <sub_spg_standardize_cell@plt>
cmp    $0x0,%rax
je     126a <test_spg_standardize_cell_BCC+0x13a>
movl   $0x1,-0x4(%rbp)
jmp    12aa <test_spg_standardize_cell_BCC+0x17a>
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1217 <test_spg_standardize_cell_BCC+0xe7>
jmp    128f <test_spg_standardize_cell_BCC+0x15f>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1200 <test_spg_standardize_cell_BCC+0xd0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_standardize_cell_BCC>:
push   %rbx
sub    $0x90,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x50(%rsp)
movabs $0x400fc28f5c28f5c3,%rax
c2 0f 40
mov    %rax,0x40(%rsp)
movabs $0x40101eb851eb851f,%rax
1e 10 40
mov    %rax,0x60(%rsp)
movabs $0x4010000000000000,%rax
mov    %rax,0x80(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movabs $0x3f60624dd2f1a9fc,%rax
62 60 3f
mov    %rax,0x10(%rsp)
movaps 0xe71(%rip),%xmm0
movups %xmm0,0x28(%rsp)
movabs $0x3fe0000000000000,%rax
mov    %rax,0x38(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x8(%rsp)
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
movsd  0xe2f(%rip),%xmm0
mov    $0x2,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <sub_spg_standardize_cell@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    12d4 <test_spg_standardize_cell_BCC+0x1b4>
lea    0xe4d(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
movsd  0xdee(%rip),%xmm0
mov    $0x1,%ebx
mov    $0x2,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   1040 <sub_spg_standardize_cell@plt>
test   %rax,%rax
jne    12d4 <test_spg_standardize_cell_BCC+0x1b4>
lea    0xe09(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
movsd  0xdaa(%rip),%xmm0
mov    $0x1,%ebx
mov    $0x2,%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
call   1040 <sub_spg_standardize_cell@plt>
test   %rax,%rax
jne    12d4 <test_spg_standardize_cell_BCC+0x1b4>
lea    0xdc9(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
movsd  0xd6a(%rip),%xmm0
mov    $0x1,%ebx
mov    $0x2,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1040 <sub_spg_standardize_cell@plt>
test   %rax,%rax
jne    12d4 <test_spg_standardize_cell_BCC+0x1b4>
lea    0xd86(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_spg_standardize_cell_BCC.types = [2 x i32] [i32 1, i32 1]
@.str = [60 x i8] c"*** spg_standardize_cell (BCC unitcell --> primitive) ***:\0A\00"
@.str.1 = [56 x i8] c"------------------------------------------------------\0A\00"
define i32 @test_spg_standardize_cell_BCC() {
%1 = alloca i32
%2 = alloca [3 x [3 x double]]
%3 = alloca [2 x [3 x double]]
%4 = alloca [2 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = bitcast [3 x [3 x double]]* %2 to i8*
%10 = bitcast i8* %9 to [3 x [3 x double]]*
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i32 0, i32 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 0
store double 3.970000e+00, double* %12
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i32 0, i32 1
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i32 0, i32 1
store double 4.030000e+00, double* %14
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i32 0, i32 2
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i32 0, i32 2
store double 4.000000e+00, double* %16
%17 = bitcast [2 x [3 x double]]* %3 to i8*
%18 = bitcast i8* %17 to [2 x [3 x double]]*
%19 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %18, i32 0, i32 0
%20 = getelementptr inbounds [3 x double], [3 x double]* %19, i32 0, i32 0
store double 2.000000e-03, double* %20
%21 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %18, i32 0, i32 1
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i32 0, i32 0
store double 5.000000e-01, double* %22
%23 = getelementptr inbounds [3 x double], [3 x double]* %21, i32 0, i32 1
store double 5.001000e-01, double* %23
%24 = getelementptr inbounds [3 x double], [3 x double]* %21, i32 0, i32 2
store double 5.000000e-01, double* %24
%25 = bitcast [2 x i32]* %4 to i8*
store i32 2, i32* %7
store double 1.000000e-01, double* %8
%26 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %28
28: ; preds = %54, %0
%29 = load i32, i32* %5
%30 = icmp slt i32 %29, 2
br i1 %30, label %31, label %57
31: ; preds = %28
store i32 0, i32* %6
br label %32
32: ; preds = %50, %31
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 2
br i1 %34, label %35, label %53
35: ; preds = %32
%36 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%37 = bitcast [3 x double]* %36 to double**
%38 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %3, i64 0, i64 0
%39 = bitcast [3 x double]* %38 to double**
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%41 = load i32, i32* %7
%42 = load double, double* %8
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = call i64 @sub_spg_standardize_cell(double** %37, double** %39, i32* %40, i32 %41, double %42, i32 %43, i32 %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %35
store i32 1, i32* %1
br label %58
48: ; preds = %35
%49 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %32
53: ; preds = %32
br label %54
54: ; preds = %53
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %28
57: ; preds = %28
store i32 0, i32* %1
br label %58
58: ; preds = %57, %47
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@str = [59 x i8] c"*** spg_standardize_cell (BCC unitcell --> primitive) ***:\00"
@str.3 = [55 x i8] c"------------------------------------------------------\00"
define i32 @test_spg_standardize_cell_BCC() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [2 x [3 x double]]
%3 = alloca i64
%4 = bitcast [3 x [3 x double]]* %1 to i8*
%5 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0, i64 0
store double 3.970000e+00, double* %5
%6 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 1
store double 4.030000e+00, double* %6
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 2
store double 4.000000e+00, double* %7
%8 = bitcast [2 x [3 x double]]* %2 to i8*
%9 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %2, i64 0, i64 0, i64 0
store double 2.000000e-03, double* %9
%10 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %2, i64 0, i64 1, i64 0
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 5.000000e-01, double 5.001000e-01>, <2 x double>* %11
%12 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %2, i64 0, i64 1, i64 2
store double 5.000000e-01, double* %12
%13 = bitcast i64* %3 to i8*
store i64 4294967297, i64* %3
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
%16 = bitcast [3 x [3 x double]]* %1 to double**
%17 = bitcast [2 x [3 x double]]* %2 to double**
%18 = bitcast i64* %3 to i32*
%19 = call i64 @sub_spg_standardize_cell(double** %16, double** %17, i32* %18, i32 2, double 1.000000e-01, i32 0, i32 0)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
%23 = call i64 @sub_spg_standardize_cell(double** %16, double** %17, i32* %18, i32 2, double 1.000000e-01, i32 0, i32 1)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
%27 = call i64 @sub_spg_standardize_cell(double** %16, double** %17, i32* %18, i32 2, double 1.000000e-01, i32 1, i32 0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %25
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
%31 = call i64 @sub_spg_standardize_cell(double** %16, double** %17, i32* %18, i32 2, double 1.000000e-01, i32 1, i32 1)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
br label %35
35: ; preds = %0, %21, %25, %29, %33
%36 = phi i32 [ 0, %33 ], [ 1, %29 ], [ 1, %25 ], [ 1, %21 ], [ 1, %0 ]
ret i32 %36
}