#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_get_symmetry_from_database(int ***, double **, int);
void test_spg_get_symmetry_from_database(void) {
  int rotations[192][3][3];
  double translations[192][3];
  int max_size, i, j, size;
  size = spg_get_symmetry_from_database(rotations, translations, 460);
  printf("*** Example of spg_get_symmetry_from_database ***:\n");
  for (i = 0; i < size; i++) {
    printf("--- %d ---\n", i + 1);
    for (j = 0; j < 3; j++) {
      printf("%2d %2d %2d\n", rotations[i][j][0], rotations[i][j][1],
             rotations[i][j][2]);
    }
    printf("%f %f %f\n", translations[i][0], translations[i][1],
           translations[i][2]);
  }
}


x86 assembly (clang, -O0):
<test_spg_get_symmetry_from_database>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d10,%rsp
lea    -0x1b00(%rbp),%rdi
lea    -0x2d00(%rbp),%rsi
mov    $0x1cc,%edx
call   1040 <spg_get_symmetry_from_database@plt>
mov    %eax,-0x2d10(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2d08(%rbp)
mov    -0x2d08(%rbp),%eax
cmp    -0x2d10(%rbp),%eax
jge    12a3 <test_spg_get_symmetry_from_database+0x183>
mov    -0x2d08(%rbp),%esi
add    $0x1,%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2d0c(%rbp)
cmpl   $0x3,-0x2d0c(%rbp)
jge    1234 <test_spg_get_symmetry_from_database+0x114>
movslq -0x2d08(%rbp),%rcx
lea    -0x1b00(%rbp),%rax
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x2d0c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%esi
movslq -0x2d08(%rbp),%rcx
lea    -0x1b00(%rbp),%rax
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x2d0c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
movslq -0x2d08(%rbp),%rcx
lea    -0x1b00(%rbp),%rax
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x2d0c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2d0c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d0c(%rbp)
jmp    1194 <test_spg_get_symmetry_from_database+0x74>
movslq -0x2d08(%rbp),%rcx
lea    -0x2d00(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x2d08(%rbp),%rcx
lea    -0x2d00(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0x2d08(%rbp),%rcx
lea    -0x2d00(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
lea    0xdc5(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x2d08(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d08(%rbp)
jmp    1161 <test_spg_get_symmetry_from_database+0x41>
add    $0x2d10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_get_symmetry_from_database>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2d08,%rsp
mov    %rsp,%rdi
lea    0x1b00(%rsp),%rsi
mov    $0x1cc,%edx
call   1050 <spg_get_symmetry_from_database@plt>
mov    %eax,%ebx
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1226 <test_spg_get_symmetry_from_database+0xf6>
mov    %ebx,%eax
lea    0x1b10(%rsp),%rbx
shl    $0x2,%rax
lea    (%rax,%rax,8),%r13
mov    $0x1,%ebp
lea    0xe82(%rip),%r15
lea    0xe88(%rip),%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe59(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%r14,1),%esi
mov    0x4(%rsp,%r14,1),%edx
mov    0x8(%rsp,%r14,1),%ecx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp,%r14,1),%esi
mov    0x10(%rsp,%r14,1),%edx
mov    0x14(%rsp,%r14,1),%ecx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp,%r14,1),%esi
mov    0x1c(%rsp,%r14,1),%edx
mov    0x20(%rsp,%r14,1),%ecx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  -0x10(%rbx),%xmm0
movsd  -0x8(%rbx),%xmm1
movsd  (%rbx),%xmm2
mov    %r12,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x18,%rbx
add    $0x24,%r14
add    $0x1,%ebp
cmp    %r14,%r13
jne    11a0 <test_spg_get_symmetry_from_database+0x70>
add    $0x2d08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"*** Example of spg_get_symmetry_from_database ***:\0A\00"
@.str.1 = [12 x i8] c"--- %d ---\0A\00"
@.str.2 = [13 x i8] c"%2d %2d %2d\0A\00"
@.str.3 = [10 x i8] c"%f %f %f\0A\00"
define void @test_spg_get_symmetry_from_database() {
%1 = alloca [192 x [3 x [3 x i32]]]
%2 = alloca [192 x [3 x double]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 0
%8 = bitcast [3 x [3 x i32]]* %7 to i32***
%9 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 0
%10 = bitcast [3 x double]* %9 to double**
%11 = call i32 @spg_get_symmetry_from_database(i32*** %8, double** %10, i32 460)
store i32 %11, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %13
13: ; preds = %70, %0
%14 = load i32, i32* %4
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %73
17: ; preds = %13
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %19)
store i32 0, i32* %5
br label %21
21: ; preds = %50, %17
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %53
24: ; preds = %21
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %26
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %27, i64 0, i64 %29
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %30, i64 0, i64 0
%32 = load i32, i32* %31
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %34
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %35, i64 0, i64 %37
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %38, i64 0, i64 1
%40 = load i32, i32* %39
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %42
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %43, i64 0, i64 %45
%47 = getelementptr inbounds [3 x i32], [3 x i32]* %46, i64 0, i64 2
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %40, i32 %48)
br label %50
50: ; preds = %24
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %21
53: ; preds = %21
%54 = load i32, i32* %4
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %55
%57 = getelementptr inbounds [3 x double], [3 x double]* %56, i64 0, i64 0
%58 = load double, double* %57
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %60
%62 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 0, i64 1
%63 = load double, double* %62
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %65
%67 = getelementptr inbounds [3 x double], [3 x double]* %66, i64 0, i64 2
%68 = load double, double* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %58, double %63, double %68)
br label %70
70: ; preds = %53
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
br label %13
73: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"--- %d ---\0A\00"
@.str.2 = [13 x i8] c"%2d %2d %2d\0A\00"
@.str.3 = [10 x i8] c"%f %f %f\0A\00"
@str = [51 x i8] c"*** Example of spg_get_symmetry_from_database ***:\00"
define void @test_spg_get_symmetry_from_database() {
%1 = alloca [192 x [3 x [3 x i32]]]
%2 = alloca [192 x [3 x double]]
%3 = bitcast [192 x [3 x [3 x i32]]]* %1 to i8*
%4 = bitcast [192 x [3 x double]]* %2 to i8*
%5 = bitcast [192 x [3 x [3 x i32]]]* %1 to i32***
%6 = bitcast [192 x [3 x double]]* %2 to double**
%7 = call i32 @spg_get_symmetry_from_database(i32*** %5, double** %6, i32 460)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%9 = icmp sgt i32 %7, 0
br i1 %9, label %10, label %46
10: ; preds = %0
%11 = zext i32 %7 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %14, %12 ]
%14 = add nuw nsw i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 0, i64 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 0, i64 1
%20 = load i32, i32* %19
%21 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 0, i64 2
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %20, i32 %22)
%24 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 1, i64 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 1, i64 1
%27 = load i32, i32* %26
%28 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 1, i64 2
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %27, i32 %29)
%31 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 2, i64 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 2, i64 1
%34 = load i32, i32* %33
%35 = getelementptr inbounds [192 x [3 x [3 x i32]]], [192 x [3 x [3 x i32]]]* %1, i64 0, i64 %13, i64 2, i64 2
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %34, i32 %36)
%38 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %13, i64 0
%39 = load double, double* %38
%40 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %13, i64 1
%41 = load double, double* %40
%42 = getelementptr inbounds [192 x [3 x double]], [192 x [3 x double]]* %2, i64 0, i64 %13, i64 2
%43 = load double, double* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %39, double %41, double %43)
%45 = icmp eq i64 %14, %11
br i1 %45, label %46, label %12
46: ; preds = %12, %0
ret void
}