#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 /*<<< orphan*/ show_cell(double **, double **, int *, int);
int spg_refine_cell(double **, double **, int *, int, double);
void test_spg_refine_cell_BCC(void) {
  double lattice[3][3] = {{0, 2, 2}, {2, 0, 2}, {2, 2, 0}};
  double position[4][3];
  int types[4];
  int i, num_atom_bravais, num_atom = 1;
  double symprec = 1e-5;
  position[0][0] = 0;
  position[0][1] = 0;
  position[0][2] = 0;
  types[0] = 1;
  printf("*** Example of spg_refine_cell ***:\n");
  num_atom_bravais =
      spg_refine_cell(lattice, position, types, num_atom, symprec);
  show_cell(lattice, position, types, num_atom_bravais);
}


x86 assembly (clang, -O0):
<test_spg_refine_cell_BCC>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe8b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0xcc(%rbp)
movsd  0xe45(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x1,-0xc0(%rbp)
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
mov    -0xcc(%rbp),%ecx
movsd  -0xd8(%rbp),%xmm0
ff
call   1030 <spg_refine_cell@plt>
mov    %eax,-0xc8(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
mov    -0xc8(%rbp),%ecx
call   1060 <show_cell@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_refine_cell_BCC>:
push   %r15
push   %r14
push   %rbx
sub    $0xc0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movaps 0xe9e(%rip),%xmm1
movups %xmm1,0x8(%rsp)
movabs $0x4000000000000000,%rax
mov    %rax,0x18(%rsp)
movups %xmm1,0x28(%rsp)
mov    %rax,0x38(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x70(%rsp)
movl   $0x1,0x50(%rsp)
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
lea    0x60(%rsp),%r14
lea    0x50(%rsp),%r15
movsd  0xe59(%rip),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x1,%ecx
call   1040 <spg_refine_cell@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1050 <show_cell@plt>
add    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"*** Example of spg_refine_cell ***:\0A\00"
define void @test_spg_refine_cell_BCC() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [4 x [3 x double]]
%3 = alloca [4 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = bitcast [3 x [3 x double]]* %1 to i8*
%9 = bitcast i8* %8 to [3 x [3 x double]]*
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i32 0, i32 0
%11 = getelementptr inbounds [3 x double], [3 x double]* %10, i32 0, i32 1
store double 2.000000e+00, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %10, i32 0, i32 2
store double 2.000000e+00, double* %12
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i32 0, i32 1
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i32 0, i32 0
store double 2.000000e+00, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %13, i32 0, i32 2
store double 2.000000e+00, double* %15
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i32 0, i32 2
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i32 0, i32 0
store double 2.000000e+00, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %16, i32 0, i32 1
store double 2.000000e+00, double* %18
store i32 1, i32* %6
store double 1.000000e-05, double* %7
%19 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 0
%20 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 0
store double 0.000000e+00, double* %20
%21 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 0
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
store double 0.000000e+00, double* %22
%23 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 0
%24 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 2
store double 0.000000e+00, double* %24
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 1, i32* %25
%26 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%27 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%28 = bitcast [3 x double]* %27 to double**
%29 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 0
%30 = bitcast [3 x double]* %29 to double**
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%32 = load i32, i32* %6
%33 = load double, double* %7
%34 = call i32 @spg_refine_cell(double** %28, double** %30, i32* %31, i32 %32, double %33)
store i32 %34, i32* %5
%35 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%36 = bitcast [3 x double]* %35 to double**
%37 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %2, i64 0, i64 0
%38 = bitcast [3 x double]* %37 to double**
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%40 = load i32, i32* %5
%41 = call i32 @show_cell(double** %36, double** %38, i32* %39, i32 %40)
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"*** Example of spg_refine_cell ***:\00"
define void @test_spg_refine_cell_BCC() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [4 x [3 x double]]
%3 = alloca [4 x i32]
%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 1
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 0
store double 2.000000e+00, double* %7
%8 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 2
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %9
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 1
store double 2.000000e+00, double* %10
%11 = bitcast [4 x [3 x double]]* %2 to i8*
%12 = bitcast [4 x i32]* %3 to i8*
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%14 = bitcast [4 x [3 x double]]* %2 to i8*
store i32 1, i32* %13
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%16 = bitcast [3 x [3 x double]]* %1 to double**
%17 = bitcast [4 x [3 x double]]* %2 to double**
%18 = call i32 @spg_refine_cell(double** %16, double** %17, i32* %13, i32 1, double 1.000000e-05)
%19 = call i32 @show_cell(double** %16, double** %17, i32* %13, i32 %18)
ret void
}