#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);
int 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("*** spg_get_international ***:\n");
  if (num_spg > 0) {
    printf("%s (%d)\n", symbol, num_spg);
    return 0;
  } else {
    printf("Space group could not be found.\n");
    return 1;
  }
}


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    123e <test_spg_get_international+0xfe>
lea    -0x120(%rbp),%rsi
mov    -0x104(%rbp),%edx
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1253 <test_spg_get_international+0x113>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_get_international>:
push   %rbp
push   %rbx
sub    $0x128,%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    0xe76(%rip),%rsi
lea    0x90(%rsp),%rbp
mov    $0x90,%edx
mov    %rbp,%rdi
call   1050 <memcpy@plt>
mov    0xefa(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x70(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rcx
xor    %ebx,%ebx
mov    %rbp,%rdx
mov    $0x6,%r8d
xor    %r9d,%r9d
call   1060 <spg_get_international@plt>
mov    %eax,%ebp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    11ff <test_spg_get_international+0xbf>
lea    0xeb9(%rip),%rdi
lea    0x70(%rsp),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1210 <test_spg_get_international+0xd0>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x128,%rsp
pop    %rbx
pop    %rbp
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 = [32 x i8] c"*** 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 i32 @test_spg_get_international() {
%1 = alloca i32
%2 = alloca [3 x [3 x double]]
%3 = alloca [6 x [3 x double]]
%4 = alloca [6 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca [21 x i8]
%8 = bitcast [3 x [3 x double]]* %2 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 0
store double 4.000000e+00, double* %11
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i32 0, i32 1
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i32 0, i32 1
store double 4.000000e+00, double* %13
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i32 0, i32 2
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i32 0, i32 2
store double 3.000000e+00, double* %15
%16 = bitcast [6 x [3 x double]]* %3 to i8*
%17 = bitcast [6 x i32]* %4 to i8*
store i32 6, i32* %6
%18 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%20 = bitcast [3 x double]* %19 to double**
%21 = getelementptr inbounds [6 x [3 x double]], [6 x [3 x double]]* %3, i64 0, i64 0
%22 = bitcast [3 x double]* %21 to double**
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%24 = load i32, i32* %6
%25 = call i32 @spg_get_international(i8* %18, double** %20, double** %22, i32* %23, i32 %24, i32 0)
store i32 %25, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* %5
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %0
%30 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%31 = load i32, i32* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %30, i32 %31)
store i32 0, i32* %1
br label %35
33: ; preds = %0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %35
35: ; preds = %33, %29
%36 = load i32, i32* %1
ret i32 %36
}

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 = [31 x i8] c"*** spg_get_international ***:\00"
@str.3 = [32 x i8] c"Space group could not be found.\00"
define i32 @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 ([31 x i8], [31 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
%23 = phi i32 [ 0, %18 ], [ 1, %20 ]
ret i32 %23
}