#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 show_spg_dataset(double **, double *, double **, int, int *);
int test_spg_get_dataset(void) {
  double lattice[3][3] = {{4, 0, 0}, {0, 4, 0}, {0, 0, 3}};
  double origin_shift[3] = {0.1, 0.1, 0};
  double position[][3] = {{0, 0, 0},       {0.5, 0.5, 0.25}, {0.3, 0.3, 0},
                          {0.7, 0.7, 0},   {0.2, 0.8, 0.25}, {0.8, 0.2, 0.25},
                          {0, 0, 0.5},     {0.5, 0.5, 0.75}, {0.3, 0.3, 0.5},
                          {0.7, 0.7, 0.5}, {0.2, 0.8, 0.75}, {0.8, 0.2, 0.75}};
  int types[] = {1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2};
  int num_atom = 12;
  double lattice_2[3][3] = {{3.7332982433264039, -1.8666491216632011, 0},
                            {0, 3.2331311186244847, 0},
                            {0, 0, 6.0979971306362799}};
  double origin_shift_2[3] = {0.1, 0.1, 0};
  double position_2[][3] = {
      {0, 0, 0},
      {1.0 / 3, 2.0 / 3, 0.4126},
      {1.0 / 3, 2.0 / 3, 0.776},
      {2.0 / 3, 1.0 / 3, 0.2542},
  };
  int types_2[] = {1, 2, 3, 3};
  int num_atom_2 = 4;
  printf("*** spg_get_dataset (Rutile two unit cells) ***:\n");
  if (show_spg_dataset(lattice, origin_shift, position, num_atom, types) == 1) {
    return 1;
  }
  if (show_spg_dataset(lattice_2, origin_shift_2, position_2, num_atom_2,
                       types_2)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_spg_get_dataset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    -0x190(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x120,%edx
call   1060 <memcpy@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xfa7(%rip),%rsi
mov    $0x30,%edx
call   1060 <memcpy@plt>
movl   $0xc,-0x1c4(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xe20(%rip),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
movsd  0xe08(%rip),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  0xdf0(%rip),%xmm0
movsd  %xmm0,-0x1f0(%rbp)
ff
movsd  0xdd8(%rip),%xmm0
movsd  %xmm0,-0x1d0(%rbp)
ff
mov    0xf69(%rip),%rax
mov    %rax,-0x230(%rbp)
mov    0xf63(%rip),%rax
mov    %rax,-0x228(%rbp)
mov    0xf5d(%rip),%rax
mov    %rax,-0x220(%rbp)
lea    -0x290(%rbp),%rdi
lea    0xf58(%rip),%rsi
mov    $0x60,%edx
call   1060 <memcpy@plt>
mov    0xfa7(%rip),%rax
mov    %rax,-0x2a0(%rbp)
mov    0xfa1(%rip),%rax
mov    %rax,-0x298(%rbp)
movl   $0x4,-0x2a4(%rbp)
lea    0xf91(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x190(%rbp),%rdx
mov    -0x1c4(%rbp),%ecx
lea    -0x1c0(%rbp),%r8
call   1030 <show_spg_dataset@plt>
cmp    $0x1,%eax
jne    12da <test_spg_get_dataset+0x19a>
movl   $0x1,-0x4(%rbp)
jmp    131d <test_spg_get_dataset+0x1dd>
lea    -0x210(%rbp),%rdi
lea    -0x230(%rbp),%rsi
lea    -0x290(%rbp),%rdx
mov    -0x2a4(%rbp),%ecx
lea    -0x2a0(%rbp),%r8
call   1030 <show_spg_dataset@plt>
cmp    $0x0,%eax
je     1316 <test_spg_get_dataset+0x1d6>
movl   $0x1,-0x4(%rbp)
jmp    131d <test_spg_get_dataset+0x1dd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spg_get_dataset>:
push   %r14
push   %rbx
sub    $0x2a8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x60(%rsp)
movabs $0x4010000000000000,%rax
mov    %rax,0x50(%rsp)
mov    %rax,0x70(%rsp)
movabs $0x4008000000000000,%rax
mov    %rax,0x90(%rsp)
mov    0xfff(%rip),%rbx
mov    %rbx,0x40(%rsp)
movaps 0xfe3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xe87(%rip),%rsi
lea    0x180(%rsp),%r14
mov    $0x120,%edx
mov    %r14,%rdi
call   1050 <memcpy@plt>
movaps 0xfab(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xf8c(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xf6d(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps 0xe03(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movabs $0x4009dd73d9116060,%rax
dd 09 40
mov    %rax,0xc0(%rsp)
movabs $0x401864595c1cbd18,%rax
64 18 40
mov    %rax,0xe0(%rsp)
mov    %rbx,0x20(%rsp)
movaps 0xf3b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xf9f(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xf80(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xf61(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xf42(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xf23(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xf04(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xd75(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xf4a(%rip),%rdi
call   1040 <puts@plt>
lea    0x50(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0xf0(%rsp),%r8
mov    %r14,%rdx
mov    $0xc,%ecx
call   1030 <show_spg_dataset@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     1301 <test_spg_get_dataset+0x1d1>
lea    0xa0(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x120(%rsp),%rdx
mov    %rsp,%r8
mov    $0x4,%ecx
call   1030 <show_spg_dataset@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
add    $0x2a8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_spg_get_dataset.origin_shift = [3 x double] [double 1.000000e-01, double 1.000000e-01, double 0.000000e+00]
@__const.test_spg_get_dataset.position = [12 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 5.000000e-01, double 5.000000e-01, double 2.500000e-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 2.500000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 2.500000e-01], [3 x double] [double 0.000000e+00, double 0.000000e+00, double 5.000000e-01], [3 x double] [double 5.000000e-01, double 5.000000e-01, double 7.500000e-01], [3 x double] [double 3.000000e-01, double 3.000000e-01, double 5.000000e-01], [3 x double] [double 0x3FE6666666666666, double 0x3FE6666666666666, double 5.000000e-01], [3 x double] [double 2.000000e-01, double 8.000000e-01, double 7.500000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 7.500000e-01]]
@__const.test_spg_get_dataset.types = [12 x i32] [i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2]
@__const.test_spg_get_dataset.origin_shift_2 = [3 x double] [double 1.000000e-01, double 1.000000e-01, double 0.000000e+00]
@__const.test_spg_get_dataset.position_2 = [4 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 0x3FD5555555555555, double 0x3FE5555555555555, double 4.126000e-01], [3 x double] [double 0x3FD5555555555555, double 0x3FE5555555555555, double 7.760000e-01], [3 x double] [double 0x3FE5555555555555, double 0x3FD5555555555555, double 2.542000e-01]]
@__const.test_spg_get_dataset.types_2 = [4 x i32] [i32 1, i32 2, i32 3, i32 3]
@.str = [50 x i8] c"*** spg_get_dataset (Rutile two unit cells) ***:\0A\00"
define i32 @test_spg_get_dataset() {
%1 = alloca i32
%2 = alloca [3 x [3 x double]]
%3 = alloca [3 x double]
%4 = alloca [12 x [3 x double]]
%5 = alloca [12 x i32]
%6 = alloca i32
%7 = alloca [3 x [3 x double]]
%8 = alloca [3 x double]
%9 = alloca [4 x [3 x double]]
%10 = alloca [4 x i32]
%11 = alloca i32
%12 = bitcast [3 x [3 x double]]* %2 to i8*
%13 = bitcast i8* %12 to [3 x [3 x double]]*
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %13, i32 0, i32 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i32 0, i32 0
store double 4.000000e+00, double* %15
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %13, i32 0, i32 1
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i32 0, i32 1
store double 4.000000e+00, double* %17
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %13, i32 0, i32 2
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i32 0, i32 2
store double 3.000000e+00, double* %19
%20 = bitcast [3 x double]* %3 to i8*
%21 = bitcast [12 x [3 x double]]* %4 to i8*
%22 = bitcast [12 x i32]* %5 to i8*
store i32 12, i32* %6
%23 = bitcast [3 x [3 x double]]* %7 to i8*
%24 = bitcast i8* %23 to [3 x [3 x double]]*
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %24, i32 0, i32 0
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i32 0, i32 0
store double 0x400DDDCB782A68C4, double* %26
%27 = getelementptr inbounds [3 x double], [3 x double]* %25, i32 0, i32 1
store double 0xBFFDDDCB782A68C0, double* %27
%28 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %24, i32 0, i32 1
%29 = getelementptr inbounds [3 x double], [3 x double]* %28, i32 0, i32 1
store double 0x4009DD73D9116060, double* %29
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %24, i32 0, i32 2
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i32 0, i32 2
store double 0x401864595C1CBD18, double* %31
%32 = bitcast [3 x double]* %8 to i8*
%33 = bitcast [4 x [3 x double]]* %9 to i8*
%34 = bitcast [4 x i32]* %10 to i8*
store i32 4, i32* %11
%35 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%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 [3 x double], [3 x double]* %3, i64 0, i64 0
%39 = getelementptr inbounds [12 x [3 x double]], [12 x [3 x double]]* %4, i64 0, i64 0
%40 = bitcast [3 x double]* %39 to double**
%41 = load i32, i32* %6
%42 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
%43 = call i32 @show_spg_dataset(double** %37, double* %38, double** %40, i32 %41, i32* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %46
45: ; preds = %0
store i32 1, i32* %1
br label %58
46: ; preds = %0
%47 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%48 = bitcast [3 x double]* %47 to double**
%49 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%50 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %9, i64 0, i64 0
%51 = bitcast [3 x double]* %50 to double**
%52 = load i32, i32* %11
%53 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%54 = call i32 @show_spg_dataset(double** %48, double* %49, double** %51, i32 %52, i32* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %46
store i32 1, i32* %1
br label %58
57: ; preds = %46
store i32 0, i32* %1
br label %58
58: ; preds = %57, %56, %45
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@__const.test_spg_get_dataset.position = [12 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 5.000000e-01, double 5.000000e-01, double 2.500000e-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 2.500000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 2.500000e-01], [3 x double] [double 0.000000e+00, double 0.000000e+00, double 5.000000e-01], [3 x double] [double 5.000000e-01, double 5.000000e-01, double 7.500000e-01], [3 x double] [double 3.000000e-01, double 3.000000e-01, double 5.000000e-01], [3 x double] [double 0x3FE6666666666666, double 0x3FE6666666666666, double 5.000000e-01], [3 x double] [double 2.000000e-01, double 8.000000e-01, double 7.500000e-01], [3 x double] [double 8.000000e-01, double 2.000000e-01, double 7.500000e-01]]
@__const.test_spg_get_dataset.types = [12 x i32] [i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2]
@__const.test_spg_get_dataset.origin_shift_2 = [3 x double] [double 1.000000e-01, double 1.000000e-01, double 0.000000e+00]
@__const.test_spg_get_dataset.position_2 = [4 x [3 x double]] [[3 x double] zeroinitializer, [3 x double] [double 0x3FD5555555555555, double 0x3FE5555555555555, double 4.126000e-01], [3 x double] [double 0x3FD5555555555555, double 0x3FE5555555555555, double 7.760000e-01], [3 x double] [double 0x3FE5555555555555, double 0x3FD5555555555555, double 2.542000e-01]]
@__const.test_spg_get_dataset.types_2 = [4 x i32] [i32 1, i32 2, i32 3, i32 3]
@str = [49 x i8] c"*** spg_get_dataset (Rutile two unit cells) ***:\00"
define i32 @test_spg_get_dataset() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x double]
%3 = alloca [12 x [3 x double]]
%4 = alloca [12 x i32]
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x double]
%7 = alloca [4 x [3 x double]]
%8 = alloca [4 x i32]
%9 = bitcast [3 x [3 x double]]* %1 to i8*
%10 = 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* %10
%11 = 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* %11
%12 = 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* %12
%13 = bitcast [3 x double]* %2 to i8*
%14 = bitcast [12 x [3 x double]]* %3 to i8*
%15 = bitcast [12 x i32]* %4 to i8*
%16 = bitcast [3 x [3 x double]]* %5 to i8*
%17 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 2
%18 = bitcast double* %17 to i8*
%19 = bitcast [3 x [3 x double]]* %5 to <2 x double>*
store <2 x double> <double 0x400DDDCB782A68C4, double 0xBFFDDDCB782A68C0>, <2 x double>* %19
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 1, i64 1
store double 0x4009DD73D9116060, double* %20
%21 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 2, i64 2
store double 0x401864595C1CBD18, double* %21
%22 = bitcast [3 x double]* %6 to i8*
%23 = bitcast [4 x [3 x double]]* %7 to i8*
%24 = bitcast [4 x i32]* %8 to i8*
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%26 = bitcast [3 x [3 x double]]* %1 to double**
%27 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%28 = bitcast [12 x [3 x double]]* %3 to double**
%29 = getelementptr inbounds [12 x i32], [12 x i32]* %4, i64 0, i64 0
%30 = call i32 @show_spg_dataset(double** %26, double* %27, double** %28, i32 12, i32* %29)
%31 = icmp eq i32 %30, 1
br i1 %31, label %40, label %32
32: ; preds = %0
%33 = bitcast [3 x [3 x double]]* %5 to double**
%34 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%35 = bitcast [4 x [3 x double]]* %7 to double**
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%37 = call i32 @show_spg_dataset(double** %33, double* %34, double** %35, i32 4, i32* %36)
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i32
br label %40
40: ; preds = %32, %0
%41 = phi i32 [ 1, %0 ], [ %39, %32 ]
ret i32 %41
}