#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 */
scalar_t__ mat_Nint(double);
int /*<<< orphan*/ mat_multiply_matrix_vector_d3(double *, double **, double *);
int /*<<< orphan*/ mat_norm_squared_d3(double *);
double const sqrt(int /*<<< orphan*/);
int cel_is_overlap(const double a[3], const double b[3], double lattice[3][3],
                   const double symprec) {
  int i;
  double v_diff[3];
  for (i = 0; i < 3; i++) {
    v_diff[i] = a[i] - b[i];
    v_diff[i] -= mat_Nint(v_diff[i]);
  }
  mat_multiply_matrix_vector_d3(v_diff, lattice, v_diff);
  if (sqrt(mat_norm_squared_d3(v_diff)) < symprec) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cel_is_overlap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11c4 <cel_is_overlap+0x84>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x50(%rbp,%rax,8)
movslq -0x2c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
call   1060 <mat_Nint@plt>
cvtsi2sd %rax,%xmm1
movslq -0x2c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1160 <cel_is_overlap+0x20>
lea    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1040 <mat_multiply_matrix_vector_d3@plt>
lea    -0x50(%rbp),%rdi
call   1030 <mat_norm_squared_d3@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1203 <cel_is_overlap+0xc3>
movl   $0x1,-0x4(%rbp)
jmp    120a <cel_is_overlap+0xca>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cel_is_overlap>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
movsd  %xmm0,(%rsp)
call   1060 <mat_Nint@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rbx),%xmm0
subsd  0x8(%r15),%xmm0
movsd  %xmm0,(%rsp)
call   1060 <mat_Nint@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rbx),%xmm0
subsd  0x10(%r15),%xmm0
movsd  %xmm0,(%rsp)
call   1060 <mat_Nint@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <mat_multiply_matrix_vector_d3@plt>
mov    %rbx,%rdi
call   1030 <mat_norm_squared_d3@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
xor    %eax,%eax
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cel_is_overlap(double* %0, double* %1, [3 x double]* %2, double %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca [3 x double]*
%9 = alloca double
%10 = alloca i32
%11 = alloca [3 x double]
store double* %0, double** %6
store double* %1, double** %7
store [3 x double]* %2, [3 x double]** %8
store double %3, double* %9
store i32 0, i32* %10
br label %12
12: ; preds = %41, %4
%13 = load i32, i32* %10
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %44
15: ; preds = %12
%16 = load double*, double** %6
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fsub double %20, %25
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 %28
store double %26, double* %29
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 %31
%33 = load double, double* %32
%34 = call i64 @mat_Nint(double %33)
%35 = sitofp i64 %34 to double
%36 = load i32, i32* %10
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 %37
%39 = load double, double* %38
%40 = fsub double %39, %35
store double %40, double* %38
br label %41
41: ; preds = %15
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %12
44: ; preds = %12
%45 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%46 = load [3 x double]*, [3 x double]** %8
%47 = bitcast [3 x double]* %46 to double**
%48 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%49 = call i32 @mat_multiply_matrix_vector_d3(double* %45, double** %47, double* %48)
%50 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%51 = call i32 @mat_norm_squared_d3(double* %50)
%52 = call double @sqrt(i32 %51)
%53 = load double, double* %9
%54 = fcmp olt double %52, %53
br i1 %54, label %55, label %56
55: ; preds = %44
store i32 1, i32* %5
br label %57
56: ; preds = %44
store i32 0, i32* %5
br label %57
57: ; preds = %56, %55
%58 = load i32, i32* %5
ret i32 %58
}

LLVM IR (-O2):
define i32 @cel_is_overlap(double* nocapture %0, double* nocapture %1, [3 x double]* %2, double %3) {
%5 = alloca [3 x double]
%6 = bitcast [3 x double]* %5 to i8*
%7 = load double, double* %0
%8 = load double, double* %1
%9 = fsub double %7, %8
%10 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%11 = tail call i64 @mat_Nint(double %9)
%12 = sitofp i64 %11 to double
%13 = fsub double %9, %12
store double %13, double* %10
%14 = getelementptr inbounds double, double* %0, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %1, i64 1
%17 = load double, double* %16
%18 = fsub double %15, %17
%19 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%20 = tail call i64 @mat_Nint(double %18)
%21 = sitofp i64 %20 to double
%22 = fsub double %18, %21
store double %22, double* %19
%23 = getelementptr inbounds double, double* %0, i64 2
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %1, i64 2
%26 = load double, double* %25
%27 = fsub double %24, %26
%28 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%29 = tail call i64 @mat_Nint(double %27)
%30 = sitofp i64 %29 to double
%31 = fsub double %27, %30
store double %31, double* %28
%32 = bitcast [3 x double]* %2 to double**
%33 = call i32 @mat_multiply_matrix_vector_d3(double* %10, double** %32, double* %10)
%34 = call i32 @mat_norm_squared_d3(double* %10)
%35 = call double @sqrt(i32 %34)
%36 = fcmp olt double %35, %3
%37 = zext i1 %36 to i32
ret i32 %37
}