#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) {
  printf("*** spg_get_dataset (Rutile two unit cells) ***:\n");
  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;
  if (show_spg_dataset(lattice, origin_shift, position, num_atom, types) == 1) {
    return 1;
  }
  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;
  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    0xede(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe77(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    -0x190(%rbp),%rdi
lea    0xed3(%rip),%rsi
mov    $0x120,%edx
call   1060 <memcpy@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xfdb(%rip),%rsi
mov    $0x30,%edx
call   1060 <memcpy@plt>
movl   $0xc,-0x1c4(%rbp)
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    121f <test_spg_get_dataset+0xdf>
movl   $0x1,-0x4(%rbp)
jmp    131d <test_spg_get_dataset+0x1dd>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xdee(%rip),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
movsd  0xdd6(%rip),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  0xdbe(%rip),%xmm0
movsd  %xmm0,-0x1f0(%rbp)
ff
movsd  0xda6(%rip),%xmm0
movsd  %xmm0,-0x1d0(%rbp)
ff
mov    0xf67(%rip),%rax
mov    %rax,-0x230(%rbp)
mov    0xf61(%rip),%rax
mov    %rax,-0x228(%rbp)
mov    0xf5b(%rip),%rax
mov    %rax,-0x220(%rbp)
lea    -0x290(%rbp),%rdi
lea    0xf56(%rip),%rsi
mov    $0x60,%edx
call   1060 <memcpy@plt>
mov    0xfa5(%rip),%rax
mov    %rax,-0x2a0(%rbp)
mov    0xf9f(%rip),%rax
mov    %rax,-0x298(%rbp)
movl   $0x4,-0x2a4(%rbp)
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
lea    0x10af(%rip),%rdi
call   1040 <puts@plt>
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    0xff3(%rip),%r14
mov    %r14,0x40(%rsp)
movaps 0xfd7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xe7b(%rip),%rsi
lea    0x180(%rsp),%rbx
mov    $0x120,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
movaps 0xf9f(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xf80(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xf61(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
lea    0x50(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0xf0(%rsp),%r8
mov    %rbx,%rdx
mov    $0xc,%ecx
call   1030 <show_spg_dataset@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     1305 <test_spg_get_dataset+0x1d5>
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps 0xdc8(%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    %r14,0x20(%rsp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xf64(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xf45(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xf26(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xf07(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xd3a(%rip),%xmm0
movaps %xmm0,(%rsp)
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):
@.str = [50 x i8] c"*** spg_get_dataset (Rutile two unit cells) ***:\0A\00"
@__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]
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 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%13 = bitcast [3 x [3 x double]]* %2 to i8*
%14 = bitcast i8* %13 to [3 x [3 x double]]*
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %14, i32 0, i32 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i32 0, i32 0
store double 4.000000e+00, double* %16
%17 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %14, i32 0, i32 1
%18 = getelementptr inbounds [3 x double], [3 x double]* %17, i32 0, i32 1
store double 4.000000e+00, double* %18
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %14, i32 0, i32 2
%20 = getelementptr inbounds [3 x double], [3 x double]* %19, i32 0, i32 2
store double 3.000000e+00, double* %20
%21 = bitcast [3 x double]* %3 to i8*
%22 = bitcast [12 x [3 x double]]* %4 to i8*
%23 = bitcast [12 x i32]* %5 to i8*
store i32 12, i32* %6
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%25 = bitcast [3 x double]* %24 to double**
%26 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%27 = getelementptr inbounds [12 x [3 x double]], [12 x [3 x double]]* %4, i64 0, i64 0
%28 = bitcast [3 x double]* %27 to double**
%29 = load i32, i32* %6
%30 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
%31 = call i32 @show_spg_dataset(double** %25, double* %26, double** %28, i32 %29, i32* %30)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %34
33: ; preds = %0
store i32 1, i32* %1
br label %58
34: ; preds = %0
%35 = bitcast [3 x [3 x double]]* %7 to i8*
%36 = bitcast i8* %35 to [3 x [3 x double]]*
%37 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %36, i32 0, i32 0
%38 = getelementptr inbounds [3 x double], [3 x double]* %37, i32 0, i32 0
store double 0x400DDDCB782A68C4, double* %38
%39 = getelementptr inbounds [3 x double], [3 x double]* %37, i32 0, i32 1
store double 0xBFFDDDCB782A68C0, double* %39
%40 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %36, i32 0, i32 1
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i32 0, i32 1
store double 0x4009DD73D9116060, double* %41
%42 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %36, i32 0, i32 2
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i32 0, i32 2
store double 0x401864595C1CBD18, double* %43
%44 = bitcast [3 x double]* %8 to i8*
%45 = bitcast [4 x [3 x double]]* %9 to i8*
%46 = bitcast [4 x i32]* %10 to i8*
store i32 4, i32* %11
%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 = %34
store i32 1, i32* %1
br label %58
57: ; preds = %34
store i32 0, i32* %1
br label %58
58: ; preds = %57, %56, %33
%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 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%10 = bitcast [3 x [3 x double]]* %1 to i8*
%11 = 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* %11
%12 = 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* %12
%13 = 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* %13
%14 = bitcast [3 x double]* %2 to i8*
%15 = bitcast [12 x [3 x double]]* %3 to i8*
%16 = bitcast [12 x i32]* %4 to i8*
%17 = bitcast [3 x [3 x double]]* %1 to double**
%18 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%19 = bitcast [12 x [3 x double]]* %3 to double**
%20 = getelementptr inbounds [12 x i32], [12 x i32]* %4, i64 0, i64 0
%21 = call i32 @show_spg_dataset(double** %17, double* %18, double** %19, i32 12, i32* %20)
%22 = icmp eq i32 %21, 1
br i1 %22, label %40, label %23
23: ; preds = %0
%24 = bitcast [3 x [3 x double]]* %5 to i8*
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 2
%26 = bitcast double* %25 to i8*
%27 = bitcast [3 x [3 x double]]* %5 to <2 x double>*
store <2 x double> <double 0x400DDDCB782A68C4, double 0xBFFDDDCB782A68C0>, <2 x double>* %27
%28 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 1, i64 1
store double 0x4009DD73D9116060, double* %28
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 2, i64 2
store double 0x401864595C1CBD18, double* %29
%30 = bitcast [3 x double]* %6 to i8*
%31 = bitcast [4 x [3 x double]]* %7 to i8*
%32 = bitcast [4 x i32]* %8 to i8*
%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 = %0, %23
%41 = phi i32 [ %39, %23 ], [ 1, %0 ]
ret i32 %41
}