#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*/ assert(int);
double fabs(float);
float neighbours_distance(unsigned int *, int, unsigned int *, int);
int main(int argc, char **argv) {
  unsigned int p0[] = {1};
  unsigned int p1[] = {3, 1};
  unsigned int p2[] = {3, 0};
  unsigned int p3[] = {0};
  unsigned int p4[] = {2};
  unsigned int p5[] = {4, 2};
  assert(neighbours_distance(p0, 1, p0, 1) == 0.0f);
  assert(neighbours_distance(p0, 1, p1, 2) == 0.5f);
  assert(neighbours_distance(p0, 1, p2, 2) == 1.0f);
  assert(neighbours_distance(p0, 1, p3, 1) == 1.0f);
  assert(neighbours_distance(p0, 1, p4, 1) == 1.0f);
  assert(neighbours_distance(p0, 1, p5, 2) == 1.0f);
  assert(fabs(neighbours_distance(p1, 2, p2, 2) - 0.6667f) < 0.01);
  assert(fabs(neighbours_distance(p2, 2, p3, 1) - 0.5f) < 0.01);
  assert(neighbours_distance(p3, 1, p4, 1) == 1.0f);
  assert(neighbours_distance(p4, 1, p5, 2) == 0.5f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb7(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x24(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0xe8c(%rip),%eax
mov    %eax,-0x2c(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x34(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <neighbours_distance@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <neighbours_distance@plt>
movss  0xe23(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x24(%rbp),%rdx
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <neighbours_distance@plt>
movss  0xdf3(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x28(%rbp),%rdx
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <neighbours_distance@plt>
movss  0xdc2(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x2c(%rbp),%rdx
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <neighbours_distance@plt>
movss  0xd91(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x34(%rbp),%rdx
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <neighbours_distance@plt>
movss  0xd5d(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x24(%rbp),%rdx
mov    $0x2,%ecx
mov    %ecx,%esi
call   1040 <neighbours_distance@plt>
movss  0xd30(%rip),%xmm1
subss  %xmm1,%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xd2c(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x24(%rbp),%rdi
lea    -0x28(%rbp),%rdx
mov    $0x2,%esi
mov    $0x1,%ecx
call   1040 <neighbours_distance@plt>
movss  0xce4(%rip),%xmm1
subss  %xmm1,%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xce8(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rdx
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <neighbours_distance@plt>
movss  0xca7(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x34(%rbp),%rdx
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <neighbours_distance@plt>
movss  0xc6f(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x1,0xc(%rsp)
movabs $0x100000003,%rax
mov    %rax,0x20(%rsp)
movq   $0x3,0x18(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x2,0x4(%rsp)
movabs $0x200000004,%rax
mov    %rax,0x10(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   1030 <neighbours_distance@plt>
xorps  %xmm1,%xmm1
cmpeqss %xmm0,%xmm1
movd   %xmm1,%edi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x20(%rsp),%r13
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13,%rdx
mov    $0x2,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xe32(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x18(%rsp),%r12
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r12,%rdx
mov    $0x2,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xe07(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xdd8(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x4(%rsp),%r15
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xda9(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x10(%rsp),%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    $0x2,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xd7a(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
mov    %r13,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
mov    $0x2,%ecx
call   1030 <neighbours_distance@plt>
addss  0xd55(%rip),%xmm0
call   1040 <fabs@plt>
movsd  0xd50(%rip),%xmm1
xor    %edi,%edi
ucomisd %xmm0,%xmm1
seta   %dil
call   1050 <assert@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <neighbours_distance@plt>
addss  0xd20(%rip),%xmm0
call   1040 <fabs@plt>
xor    %edi,%edi
movsd  0xd15(%rip),%xmm1
ucomisd %xmm0,%xmm1
seta   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xcde(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    $0x2,%ecx
call   1030 <neighbours_distance@plt>
cmpeqss 0xcb0(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.p0 = [1 x i32] [i32 1]
@__const.main.p1 = [2 x i32] [i32 3, i32 1]
@__const.main.p2 = [2 x i32] [i32 3, i32 0]
@__const.main.p4 = [1 x i32] [i32 2]
@__const.main.p5 = [2 x i32] [i32 4, i32 2]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1 x i32]
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [1 x i32]
%9 = alloca [1 x i32]
%10 = alloca [2 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = bitcast [1 x i32]* %5 to i8*
%12 = bitcast [2 x i32]* %6 to i8*
%13 = bitcast [2 x i32]* %7 to i8*
%14 = bitcast [1 x i32]* %8 to i8*
%15 = bitcast [1 x i32]* %9 to i8*
%16 = bitcast [2 x i32]* %10 to i8*
%17 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%18 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%19 = call float @neighbours_distance(i32* %17, i32 1, i32* %18, i32 1)
%20 = fcmp oeq float %19, 0.000000e+00
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%25 = call float @neighbours_distance(i32* %23, i32 1, i32* %24, i32 2)
%26 = fcmp oeq float %25, 5.000000e-01
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%31 = call float @neighbours_distance(i32* %29, i32 1, i32* %30, i32 2)
%32 = fcmp oeq float %31, 1.000000e+00
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%36 = getelementptr inbounds [1 x i32], [1 x i32]* %8, i64 0, i64 0
%37 = call float @neighbours_distance(i32* %35, i32 1, i32* %36, i32 1)
%38 = fcmp oeq float %37, 1.000000e+00
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%42 = getelementptr inbounds [1 x i32], [1 x i32]* %9, i64 0, i64 0
%43 = call float @neighbours_distance(i32* %41, i32 1, i32* %42, i32 1)
%44 = fcmp oeq float %43, 1.000000e+00
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%49 = call float @neighbours_distance(i32* %47, i32 1, i32* %48, i32 2)
%50 = fcmp oeq float %49, 1.000000e+00
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%55 = call float @neighbours_distance(i32* %53, i32 2, i32* %54, i32 2)
%56 = fsub float %55, 0x3FE5559B40000000
%57 = call double @fabs(float %56)
%58 = fcmp olt double %57, 1.000000e-02
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%62 = getelementptr inbounds [1 x i32], [1 x i32]* %8, i64 0, i64 0
%63 = call float @neighbours_distance(i32* %61, i32 2, i32* %62, i32 1)
%64 = fsub float %63, 5.000000e-01
%65 = call double @fabs(float %64)
%66 = fcmp olt double %65, 1.000000e-02
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
%69 = getelementptr inbounds [1 x i32], [1 x i32]* %8, i64 0, i64 0
%70 = getelementptr inbounds [1 x i32], [1 x i32]* %9, i64 0, i64 0
%71 = call float @neighbours_distance(i32* %69, i32 1, i32* %70, i32 1)
%72 = fcmp oeq float %71, 1.000000e+00
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = getelementptr inbounds [1 x i32], [1 x i32]* %9, i64 0, i64 0
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%77 = call float @neighbours_distance(i32* %75, i32 1, i32* %76, i32 2)
%78 = fcmp oeq float %77, 5.000000e-01
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1 x i32]
%4 = alloca i64
%5 = alloca i64
%6 = alloca [1 x i32]
%7 = alloca [1 x i32]
%8 = alloca i64
%9 = bitcast [1 x i32]* %3 to i8*
%10 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
store i32 1, i32* %10
%11 = bitcast i64* %4 to i8*
store i64 4294967299, i64* %4
%12 = bitcast i64* %5 to i8*
store i64 3, i64* %5
%13 = bitcast [1 x i32]* %6 to i8*
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
store i32 0, i32* %14
%15 = bitcast [1 x i32]* %7 to i8*
%16 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
store i32 2, i32* %16
%17 = bitcast i64* %8 to i8*
store i64 8589934596, i64* %8
%18 = call float @neighbours_distance(i32* %10, i32 1, i32* %10, i32 1)
%19 = fcmp oeq float %18, 0.000000e+00
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = bitcast i64* %4 to i32*
%23 = call float @neighbours_distance(i32* %10, i32 1, i32* %22, i32 2)
%24 = fcmp oeq float %23, 5.000000e-01
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = bitcast i64* %5 to i32*
%28 = call float @neighbours_distance(i32* %10, i32 1, i32* %27, i32 2)
%29 = fcmp oeq float %28, 1.000000e+00
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call float @neighbours_distance(i32* %10, i32 1, i32* %14, i32 1)
%33 = fcmp oeq float %32, 1.000000e+00
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call float @neighbours_distance(i32* %10, i32 1, i32* %16, i32 1)
%37 = fcmp oeq float %36, 1.000000e+00
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = bitcast i64* %8 to i32*
%41 = call float @neighbours_distance(i32* %10, i32 1, i32* %40, i32 2)
%42 = fcmp oeq float %41, 1.000000e+00
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = call float @neighbours_distance(i32* %22, i32 2, i32* %27, i32 2)
%46 = fadd float %45, 0xBFE5559B40000000
%47 = call double @fabs(float %46)
%48 = fcmp olt double %47, 1.000000e-02
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = call float @neighbours_distance(i32* %27, i32 2, i32* %14, i32 1)
%52 = fadd float %51, -5.000000e-01
%53 = call double @fabs(float %52)
%54 = fcmp olt double %53, 1.000000e-02
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = call float @neighbours_distance(i32* %14, i32 1, i32* %16, i32 1)
%58 = fcmp oeq float %57, 1.000000e+00
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = call float @neighbours_distance(i32* %16, i32 1, i32* %40, i32 2)
%62 = fcmp oeq float %61, 5.000000e-01
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
ret i32 0
}