#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 */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char const *argv[]) {
  int a[] = {-5, -1, 2, -3, 0, -3, 3};
  int size = sizeof(a) / sizeof(a[0]);
  int maxSum = 0, l = 3;
  for (int i = 0; i < size; i++) {
    int sum = 0;
    for (int j = i; j <= i + l; j++) {
      sum += a[j];
    }
    if (sum > maxSum)
      maxSum = sum;
  }
  printf("Maximum Sum of length %d is %d\n", l, maxSum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x7,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x3,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11d7 <main+0xc7>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    -0x40(%rbp),%ecx
add    -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jg     11b2 <main+0xa2>
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1185 <main+0x75>
mov    -0x44(%rbp),%eax
cmp    -0x38(%rbp),%eax
jle    11c4 <main+0xb4>
mov    -0x44(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    11c9 <main+0xb9>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    116c <main+0x5c>
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xe38(%rip),%rdi
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    $0x3,%esi
mov    $0x7fffffff,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [7 x i32] [i32 -5, i32 -1, i32 2, i32 -3, i32 0, i32 -3, i32 3]
@.str = [32 x i8] c"Maximum Sum of length %d is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [7 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [7 x i32]* %6 to i8*
store i32 7, i32* %7
store i32 0, i32* %8
store i32 3, i32* %9
store i32 0, i32* %10
br label %14
14: ; preds = %43, %2
%15 = load i32, i32* %10
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %46
18: ; preds = %14
store i32 0, i32* %11
%19 = load i32, i32* %10
store i32 %19, i32* %12
br label %20
20: ; preds = %33, %18
%21 = load i32, i32* %12
%22 = load i32, i32* %10
%23 = load i32, i32* %9
%24 = add nsw i32 %22, %23
%25 = icmp sle i32 %21, %24
br i1 %25, label %26, label %36
26: ; preds = %20
%27 = load i32, i32* %12
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %11
%32 = add nsw i32 %31, %30
store i32 %32, i32* %11
br label %33
33: ; preds = %26
%34 = load i32, i32* %12
%35 = add nsw i32 %34, 1
store i32 %35, i32* %12
br label %20
36: ; preds = %20
%37 = load i32, i32* %11
%38 = load i32, i32* %8
%39 = icmp sgt i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i32, i32* %11
store i32 %41, i32* %8
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
store i32 %45, i32* %10
br label %14
46: ; preds = %14
%47 = load i32, i32* %9
%48 = load i32, i32* %8
%49 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %47, i32 %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Maximum Sum of length %d is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 3, i32 2147483647)
ret i32 0
}