#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*/ abort();
int foo(float *, int);
int main() {
  float dists[16] = {0., 1., 1., 0.,  0.,  -1., -1., 0.,
                     1., 1., 1., -1., -1., 1.,  -1., -1.};
  if (foo(&dists[0], 1) + foo(&dists[2], 2) + foo(&dists[4], 4) +
          foo(&dists[6], 8) + foo(&dists[8], 16) + foo(&dists[10], 32) +
          foo(&dists[12], 64) + foo(&dists[14], 128) !=
      156)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
call   1050 <foo@plt>
mov    %eax,-0x6c(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x8,%rdi
mov    $0x2,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x68(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x10,%rdi
mov    $0x4,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x64(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x18,%rdi
mov    $0x8,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
mov    $0x10,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x28,%rdi
mov    $0x20,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x30,%rdi
mov    $0x40,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x38,%rdi
mov    $0x80,%esi
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
add    %ecx,%eax
cmp    $0x9c,%eax
je     1238 <main+0x108>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x10(%rsp),%r12
mov    %rsp,%rdi
mov    $0x1,%esi
call   1040 <foo@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1040 <foo@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
mov    $0x4,%esi
call   1040 <foo@plt>
mov    %eax,%ebp
add    %ebx,%ebp
lea    0x18(%rsp),%rdi
mov    $0x8,%esi
call   1040 <foo@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r15,%rdi
mov    $0x10,%esi
call   1040 <foo@plt>
mov    %eax,%ebp
add    %ebx,%ebp
lea    0x28(%rsp),%rdi
mov    $0x20,%esi
call   1040 <foo@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    $0x40,%esi
call   1040 <foo@plt>
mov    %eax,%ebp
add    %ebx,%ebp
lea    0x38(%rsp),%rdi
mov    $0x80,%esi
call   1040 <foo@plt>
add    %ebp,%eax
cmp    $0x9c,%eax
jne    120c <main+0xec>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const.main.dists = [16 x float] [float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00]
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x float]
store i32 0, i32* %1
%3 = bitcast [16 x float]* %2 to i8*
%4 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 0
%5 = call i32 @foo(float* %4, i32 1)
%6 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 2
%7 = call i32 @foo(float* %6, i32 2)
%8 = add nsw i32 %5, %7
%9 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 4
%10 = call i32 @foo(float* %9, i32 4)
%11 = add nsw i32 %8, %10
%12 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 6
%13 = call i32 @foo(float* %12, i32 8)
%14 = add nsw i32 %11, %13
%15 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 8
%16 = call i32 @foo(float* %15, i32 16)
%17 = add nsw i32 %14, %16
%18 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 10
%19 = call i32 @foo(float* %18, i32 32)
%20 = add nsw i32 %17, %19
%21 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 12
%22 = call i32 @foo(float* %21, i32 64)
%23 = add nsw i32 %20, %22
%24 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 14
%25 = call i32 @foo(float* %24, i32 128)
%26 = add nsw i32 %23, %25
%27 = icmp ne i32 %26, 156
br i1 %27, label %28, label %30
28: ; preds = %0
%29 = call i32 (...) @abort()
unreachable
30: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@__const.main.dists = [16 x float] [float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00]
define i32 @main() {
%1 = alloca [16 x float]
%2 = bitcast [16 x float]* %1 to i8*
%3 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%4 = call i32 @foo(float* %3, i32 1)
%5 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 2
%6 = call i32 @foo(float* %5, i32 2)
%7 = add nsw i32 %6, %4
%8 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 4
%9 = call i32 @foo(float* %8, i32 4)
%10 = add nsw i32 %7, %9
%11 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 6
%12 = call i32 @foo(float* %11, i32 8)
%13 = add nsw i32 %10, %12
%14 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 8
%15 = call i32 @foo(float* %14, i32 16)
%16 = add nsw i32 %13, %15
%17 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 10
%18 = call i32 @foo(float* %17, i32 32)
%19 = add nsw i32 %16, %18
%20 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 12
%21 = call i32 @foo(float* %20, i32 64)
%22 = add nsw i32 %19, %21
%23 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 14
%24 = call i32 @foo(float* %23, i32 128)
%25 = add nsw i32 %22, %24
%26 = icmp eq i32 %25, 156
br i1 %26, label %29, label %27
27: ; preds = %0
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %0
ret i32 0
}