#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*/ free(int *);
int get_symmetry_with_site_tensors(int ***, double **, int *, double **, int *,
                                   int, int const, double **, double **,
                                   int const *, double const *,
                                   int /*<<< orphan*/, int const, int,
                                   double const, double);
scalar_t__ malloc(int);
int spg_get_symmetry_with_collinear_spin(
    int rotation[][3][3], double translation[][3], int equivalent_atoms[],
    const int max_size, double lattice[3][3], double position[][3],
    const int types[], const double spins[], const int num_atom,
    const double symprec) {
  int succeeded;
  double primitive_lattice[3][3];
  int *spin_flips;
  if ((spin_flips = (int *)malloc(sizeof(int) * max_size)) == NULL) {
    ;
    return 0;
  }
  succeeded = get_symmetry_with_site_tensors(
      rotation, translation, equivalent_atoms, primitive_lattice, spin_flips, 1,
      max_size, lattice, position, types, spins, 0, num_atom, 1, symprec, -1.0);
  free(spin_flips);
  spin_flips = NULL;
  return succeeded;
}


x86 assembly (clang, -O0):
<spg_get_symmetry_with_collinear_spin>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %ecx,-0x44(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movsd  %xmm0,-0x60(%rbp)
movslq -0x44(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0xb8(%rbp)
cmp    $0x0,%rax
jne    1195 <spg_get_symmetry_with_collinear_spin+0x65>
movl   $0x0,-0x24(%rbp)
jmp    122d <spg_get_symmetry_with_collinear_spin+0xfd>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
mov    -0xb8(%rbp),%r8
mov    -0x44(%rbp),%r15d
mov    -0x50(%rbp),%r14
mov    -0x58(%rbp),%rbx
mov    0x10(%rbp),%r11
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%eax
movsd  -0x60(%rbp),%xmm0
mov    $0x1,%r9d
xor    %r12d,%r12d
movsd  0xe24(%rip),%xmm1
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
movl   $0x0,0x28(%rsp)
mov    %eax,0x30(%rsp)
movl   $0x1,0x38(%rsp)
call   1050 <get_symmetry_with_site_tensors@plt>
mov    %eax,-0x64(%rbp)
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xb8(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<spg_get_symmetry_with_collinear_spin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm0,(%rsp)
mov    %r9,%r15
mov    %r8,0x8(%rsp)
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0x0(,%r12,4),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11c7 <spg_get_symmetry_with_collinear_spin+0x97>
mov    %rax,%rbx
mov    0xa0(%rsp),%eax
lea    0x10(%rsp),%rcx
movsd  0xe80(%rip),%xmm1
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %rbx,%r8
mov    $0x1,%r9d
movsd  (%rsp),%xmm0
push   $0x1
push   %rax
push   $0x0
push   0xb0(%rsp)
push   0xb0(%rsp)
push   %r15
push   0x38(%rsp)
push   %r12
call   1050 <get_symmetry_with_site_tensors@plt>
add    $0x40,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11c9 <spg_get_symmetry_with_collinear_spin+0x99>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @spg_get_symmetry_with_collinear_spin([3 x [3 x i32]]* %0, [3 x double]* %1, i32* %2, i32 %3, [3 x double]* %4, [3 x double]* %5, i32* %6, double* %7, i32 %8, double %9) {
%11 = alloca i32
%12 = alloca [3 x [3 x i32]]*
%13 = alloca [3 x double]*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca [3 x double]*
%17 = alloca [3 x double]*
%18 = alloca i32*
%19 = alloca double*
%20 = alloca i32
%21 = alloca double
%22 = alloca i32
%23 = alloca [3 x [3 x double]]
%24 = alloca i32*
store [3 x [3 x i32]]* %0, [3 x [3 x i32]]** %12
store [3 x double]* %1, [3 x double]** %13
store i32* %2, i32** %14
store i32 %3, i32* %15
store [3 x double]* %4, [3 x double]** %16
store [3 x double]* %5, [3 x double]** %17
store i32* %6, i32** %18
store double* %7, double** %19
store i32 %8, i32* %20
store double %9, double* %21
%25 = load i32, i32* %15
%26 = sext i32 %25 to i64
%27 = mul i64 4, %26
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to i32*
store i32* %30, i32** %24
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %33
32: ; preds = %10
store i32 0, i32* %11
br label %55
33: ; preds = %10
%34 = load [3 x [3 x i32]]*, [3 x [3 x i32]]** %12
%35 = bitcast [3 x [3 x i32]]* %34 to i32***
%36 = load [3 x double]*, [3 x double]** %13
%37 = bitcast [3 x double]* %36 to double**
%38 = load i32*, i32** %14
%39 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %23, i64 0, i64 0
%40 = bitcast [3 x double]* %39 to double**
%41 = load i32*, i32** %24
%42 = load i32, i32* %15
%43 = load [3 x double]*, [3 x double]** %16
%44 = bitcast [3 x double]* %43 to double**
%45 = load [3 x double]*, [3 x double]** %17
%46 = bitcast [3 x double]* %45 to double**
%47 = load i32*, i32** %18
%48 = load double*, double** %19
%49 = load i32, i32* %20
%50 = load double, double* %21
%51 = call i32 @get_symmetry_with_site_tensors(i32*** %35, double** %37, i32* %38, double** %40, i32* %41, i32 1, i32 %42, double** %44, double** %46, i32* %47, double* %48, i32 0, i32 %49, i32 1, double %50, double -1.000000e+00)
store i32 %51, i32* %22
%52 = load i32*, i32** %24
%53 = call i32 @free(i32* %52)
store i32* null, i32** %24
%54 = load i32, i32* %22
store i32 %54, i32* %11
br label %55
55: ; preds = %33, %32
%56 = load i32, i32* %11
ret i32 %56
}

LLVM IR (-O2):
define i32 @spg_get_symmetry_with_collinear_spin([3 x [3 x i32]]* %0, [3 x double]* %1, i32* %2, i32 %3, [3 x double]* %4, [3 x double]* %5, i32* %6, double* %7, i32 %8, double %9) {
%11 = alloca [3 x [3 x double]]
%12 = bitcast [3 x [3 x double]]* %11 to i8*
%13 = shl i32 %3, 2
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
%16 = icmp eq i64 %14, 0
br i1 %16, label %25, label %17
17: ; preds = %10
%18 = bitcast [3 x [3 x i32]]* %0 to i32***
%19 = bitcast [3 x double]* %1 to double**
%20 = bitcast [3 x [3 x double]]* %11 to double**
%21 = bitcast [3 x double]* %4 to double**
%22 = bitcast [3 x double]* %5 to double**
%23 = call i32 @get_symmetry_with_site_tensors(i32*** %18, double** %19, i32* %2, double** %20, i32* %15, i32 1, i32 %3, double** %21, double** %22, i32* %6, double* %7, i32 0, i32 %8, i32 1, double %9, double -1.000000e+00)
%24 = call i32 @free(i32* %15)
br label %25
25: ; preds = %10, %17
%26 = phi i32 [ %23, %17 ], [ 0, %10 ]
ret i32 %26
}