#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*/ printf(char *, ...);
int main() {
  long a[5] = {-2147483648, -1, 0, -1, -2147483648};
  int n = 5;
  int i;
  long long sumLeft = 0;
  long long sumRight = 0;
  int equilibriumIndex = 0;
  int isFound = 0;
  for (i = equilibriumIndex + 1; i < n; i++) {
    sumRight += a[i];
  }
  while (equilibriumIndex != n) {
    if (sumLeft == sumRight) {
      isFound = 1;
      break;
    } else {
      sumLeft += a[equilibriumIndex];
      equilibriumIndex++;
      sumRight -= a[equilibriumIndex];
    }
  }
  if (isFound) {
    printf("%d\n", equilibriumIndex);
  } else {
    printf("Not found");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movq   $0xffffffff80000000,-0x30(%rbp)
80
movq   $0xffffffffffffffff,-0x28(%rbp)
ff
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
movq   $0xffffffff80000000,-0x10(%rbp)
80
movl   $0x5,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11b8 <main+0x98>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    118d <main+0x6d>
jmp    11bd <main+0x9d>
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
je     1216 <main+0xf6>
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jne    11e3 <main+0xc3>
movl   $0x1,-0x50(%rbp)
jmp    1216 <main+0xf6>
movslq -0x4c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rcx
mov    -0x48(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    11bd <main+0x9d>
cmpl   $0x0,-0x50(%rbp)
je     1236 <main+0x116>
mov    -0x4c(%rbp),%esi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [10 x i8] c"Not found\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i64]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [5 x i64]* %2 to i8*
%10 = bitcast i8* %9 to [5 x i64]*
%11 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 0
store i64 -2147483648, i64* %11
%12 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 1
store i64 -1, i64* %12
%13 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 3
store i64 -1, i64* %13
%14 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 4
store i64 -2147483648, i64* %14
store i32 5, i32* %3
store i64 0, i64* %5
store i64 0, i64* %6
store i32 0, i32* %7
store i32 0, i32* %8
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %28, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i64], [5 x i64]* %2, i64 0, i64 %23
%25 = load i64, i64* %24
%26 = load i64, i64* %6
%27 = add nsw i64 %26, %25
store i64 %27, i64* %6
br label %28
28: ; preds = %21
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %17
31: ; preds = %17
br label %32
32: ; preds = %56, %31
%33 = load i32, i32* %7
%34 = load i32, i32* %3
%35 = icmp ne i32 %33, %34
br i1 %35, label %36, label %57
36: ; preds = %32
%37 = load i64, i64* %5
%38 = load i64, i64* %6
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 1, i32* %8
br label %57
41: ; preds = %36
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x i64], [5 x i64]* %2, i64 0, i64 %43
%45 = load i64, i64* %44
%46 = load i64, i64* %5
%47 = add nsw i64 %46, %45
store i64 %47, i64* %5
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [5 x i64], [5 x i64]* %2, i64 0, i64 %51
%53 = load i64, i64* %52
%54 = load i64, i64* %6
%55 = sub nsw i64 %54, %53
store i64 %55, i64* %6
br label %56
56: ; preds = %41
br label %32
57: ; preds = %40, %32
%58 = load i32, i32* %8
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32, i32* %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %61)
br label %65
63: ; preds = %57
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}