#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 const);
scalar_t__ malloc(int);
int spgat_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, const double angle_tolerance) {
  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,
      angle_tolerance);
  free(spin_flips);
  spin_flips = NULL;
  return succeeded;
}


x86 assembly (clang, -O0):
<spgat_get_symmetry_with_collinear_spin>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf0,%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)
movsd  %xmm1,-0x68(%rbp)
movslq -0x44(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0xc8(%rbp)
cmp    $0x0,%rax
jne    119a <spgat_get_symmetry_with_collinear_spin+0x6a>
movl   $0x0,-0x24(%rbp)
jmp    122f <spgat_get_symmetry_with_collinear_spin+0xff>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
mov    -0xc8(%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
movsd  -0x68(%rbp),%xmm1
mov    $0x1,%r9d
xor    %r12d,%r12d
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,-0x6c(%rbp)
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xc8(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<spgat_get_symmetry_with_collinear_spin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %r9,%r15
mov    %r8,0x18(%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     11cd <spgat_get_symmetry_with_collinear_spin+0x9d>
mov    %rax,%rbx
mov    0xb0(%rsp),%eax
lea    0x20(%rsp),%rcx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %rbx,%r8
mov    $0x1,%r9d
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
push   $0x1
push   %rax
push   $0x0
push   0xc0(%rsp)
push   0xc0(%rsp)
push   %r15
push   0x48(%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    11cf <spgat_get_symmetry_with_collinear_spin+0x9f>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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