#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_international(char *, double **, double **, int *, int, int);
void test_spg_get_international(void) {
  double lattice[3][3] = {{4, 0, 0}, {0, 4, 0}, {0, 0, 3}};
  double position[][3] = {
      {0, 0, 0},     {0.5, 0.5, 0.5}, {0.3, 0.3, 0},
      {0.7, 0.7, 0}, {0.2, 0.8, 0.5}, {0.8, 0.2, 0.5},
  };
  int types[] = {1, 1, 2, 2, 2, 2};
  int num_spg, num_atom = 6;
  char symbol[21];
  num_spg =
      spg_get_international(symbol, lattice, position, types, num_atom, 1e-5);
  printf("*** Example of spg_get_international ***:\n");
  if (num_spg > 0) {
    printf("%s (%d)\n", symbol, num_spg);
  } else {
    printf("Space group could not be found.\n");
  }
}


x86 assembly (clang, -O0):
<test_spg_get_international>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1040 <memset@plt>
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x90,%edx
call   1050 <memcpy@plt>
mov    0xeff(%rip),%rax
mov    %rax,-0x100(%rbp)
mov    0xef9(%rip),%rax
mov    %rax,-0xf8(%rbp)
mov    0xef3(%rip),%rax
mov    %rax,-0xf0(%rbp)
movl   $0x6,-0x108(%rbp)
lea    -0x120(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    -0x100(%rbp),%rcx
mov    -0x108(%rbp),%r8d
xor    %r9d,%r9d
call   1060 <spg_get_international@plt>
mov    %eax,-0x104(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x104(%rbp)
jle    1237 <test_spg_get_international+0xf7>
lea    -0x120(%rbp),%rsi
mov    -0x104(%rbp),%edx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1245 <test_spg_get_international+0x105>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_get_international>:
push   %rbx
sub    $0x120,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x30(%rsp)
movabs $0x4010000000000000,%rax
mov    %rax,0x20(%rsp)
mov    %rax,0x40(%rsp)
movabs $0x4008000000000000,%rax
mov    %rax,0x60(%rsp)
lea    0xe77(%rip),%rsi
lea    0x90(%rsp),%rbx
mov    $0x90,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    0xefb(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x70(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rcx
mov    %rbx,%rdx
mov    $0x6,%r8d
xor    %r9d,%r9d
call   1060 <spg_get_international@plt>
mov    %eax,%ebx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    11fc <test_spg_get_international+0xbc>
lea    0xebc(%rip),%rdi
lea    0x70(%rsp),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1208 <test_spg_get_international+0xc8>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_spg_get_international.position = [6 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 5.000000e-01, double 5.000000e-01, double 5.000000e-01], [3 x double] [double 3.000000e-01, double 3.000000e-01, double 0.000000e+00], [3 x double] [double 0x3FE6666666666666, double 0x3FE6666666666666, double 0.000000e+00], [3 x double] [double 2.000000e-01, double 8.000000e-01, double 5.000000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 5.000000e-01]]
@__const.test_spg_get_international.types = [6 x i32] [i32 1, i32 1, i32 2, i32 2, i32 2, i32 2]
@.str = [43 x i8] c"*** Example of spg_get_international ***:\0A\00"
@.str.1 = [9 x i8] c"%s (%d)\0A\00"
@.str.2 = [33 x i8] c"Space group could not be found.\0A\00"
define void @test_spg_get_international() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [6 x [3 x double]]
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [21 x i8]
%7 = bitcast [3 x [3 x double]]* %1 to i8*
%8 = bitcast i8* %7 to [3 x [3 x double]]*
%9 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i32 0, i32 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %9, i32 0, i32 0
store double 4.000000e+00, double* %10
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i32 0, i32 1
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 1
store double 4.000000e+00, double* %12
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i32 0, i32 2
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i32 0, i32 2
store double 3.000000e+00, double* %14
%15 = bitcast [6 x [3 x double]]* %2 to i8*
%16 = bitcast [6 x i32]* %3 to i8*
store i32 6, i32* %5
%17 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%19 = bitcast [3 x double]* %18 to double**
%20 = getelementptr inbounds [6 x [3 x double]], [6 x [3 x double]]* %2, i64 0, i64 0
%21 = bitcast [3 x double]* %20 to double**
%22 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%23 = load i32, i32* %5
%24 = call i32 @spg_get_international(i8* %17, double** %19, double** %21, i32* %22, i32 %23, i32 0)
store i32 %24, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %0
%29 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 %30)
br label %34
32: ; preds = %0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
ret void
}

LLVM IR (-O2):
@__const.test_spg_get_international.position = [6 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 5.000000e-01, double 5.000000e-01, double 5.000000e-01], [3 x double] [double 3.000000e-01, double 3.000000e-01, double 0.000000e+00], [3 x double] [double 0x3FE6666666666666, double 0x3FE6666666666666, double 0.000000e+00], [3 x double] [double 2.000000e-01, double 8.000000e-01, double 5.000000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 5.000000e-01]]
@__const.test_spg_get_international.types = [6 x i32] [i32 1, i32 1, i32 2, i32 2, i32 2, i32 2]
@.str.1 = [9 x i8] c"%s (%d)\0A\00"
@str = [42 x i8] c"*** Example of spg_get_international ***:\00"
@str.3 = [32 x i8] c"Space group could not be found.\00"
define void @test_spg_get_international() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [6 x [3 x double]]
%3 = alloca [6 x i32]
%4 = alloca [21 x i8]
%5 = bitcast [3 x [3 x double]]* %1 to i8*
%6 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0, i64 0
store double 4.000000e+00, double* %6
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 1
store double 4.000000e+00, double* %7
%8 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 2
store double 3.000000e+00, double* %8
%9 = bitcast [6 x [3 x double]]* %2 to i8*
%10 = bitcast [6 x i32]* %3 to i8*
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%12 = bitcast [3 x [3 x double]]* %1 to double**
%13 = bitcast [6 x [3 x double]]* %2 to double**
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%15 = call i32 @spg_get_international(i8* %11, double** %12, double** %13, i32* %14, i32 6, i32 0)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%17 = icmp sgt i32 %15, 0
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %15)
br label %22
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
ret void
}