#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*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  int n, d[99];
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d;", &n) != EOF) {
    int m = 0, cm = 0, c, i = 0;
    do {
      fscanf(fp, "%d", &c);
      if (i < n) {
        cm += c;
        d[i++] = c;
      } else {
        cm += c - d[i % n];
        d[i++ % n] = c;
      }
      if (i >= n && cm > m)
        m = cm;
    } while (getc(fp) == ' ');
    printf("%d\n", m);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1184 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1304 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe62(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <fscanf@plt>
mov    0x2e26(%rip),%rcx
cmp    (%rcx),%rax
je     12fd <main+0x1bd>
movl   $0x0,-0x1b4(%rbp)
movl   $0x0,-0x1b8(%rbp)
movl   $0x0,-0x1c0(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe24(%rip),%rsi
lea    -0x1bc(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x1c0(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1246 <main+0x106>
mov    -0x1bc(%rbp),%eax
add    -0x1b8(%rbp),%eax
mov    %eax,-0x1b8(%rbp)
mov    -0x1bc(%rbp),%ecx
mov    -0x1c0(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1c0(%rbp)
cltq
mov    %ecx,-0x1b0(%rbp,%rax,4)
jmp    129d <main+0x15d>
mov    -0x1bc(%rbp),%eax
mov    %eax,-0x1c4(%rbp)
mov    -0x1c0(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    -0x1c4(%rbp),%eax
movslq %edx,%rcx
sub    -0x1b0(%rbp,%rcx,4),%eax
add    -0x1b8(%rbp),%eax
mov    %eax,-0x1b8(%rbp)
mov    -0x1bc(%rbp),%ecx
mov    -0x1c0(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1c0(%rbp)
cltd
idivl  -0x1c(%rbp)
movslq %edx,%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x1c0(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     12ca <main+0x18a>
mov    -0x1b8(%rbp),%eax
cmp    -0x1b4(%rbp),%eax
jle    12ca <main+0x18a>
mov    -0x1b8(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
jmp    12cf <main+0x18f>
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
movsbl %al,%eax
cmp    $0x20,%eax
je     11e9 <main+0xa9>
mov    -0x1b4(%rbp),%esi
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <main+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
cmp    $0x2,%edi
jne    1255 <main+0x115>
mov    0x8(%rsi),%rdi
lea    0xead(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xea0(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    0x2e60(%rip),%rcx
xor    %ebp,%ebp
cmp    (%rcx),%rax
je     126b <main+0x12b>
lea    0xc(%rsp),%r15
jmp    11d7 <main+0x97>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
lea    0xe72(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0xe57(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1040 <fscanf@plt>
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%rax
je     126b <main+0x12b>
xor    %r13d,%r13d
lea    0x10(%rsp),%rbp
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    121a <main+0xda>
nopw   0x0(%rax,%rax,1)
add    %edi,%r14d
add    $0x1,%r13
cmp    %r12d,%r14d
mov    %r12d,%edx
cmovg  %r14d,%edx
mov    %esi,(%rax)
cmp    %r13d,%ecx
cmovle %edx,%r12d
mov    %rbx,%rdi
call   1060 <getc@plt>
add    $0x4,%rbp
cmp    $0x20,%al
jne    11a0 <main+0x60>
mov    %rbx,%rdi
lea    0xdf4(%rip),%rsi
mov    %r15,%rdx
call   1040 <fscanf@plt>
movslq 0x8(%rsp),%rcx
mov    0xc(%rsp),%esi
mov    %rbp,%rax
mov    %esi,%edi
cmp    %rcx,%r13
jl     11f0 <main+0xb0>
mov    %r13d,%eax
cltd
idiv   %ecx
lea    (%rsp,%rdx,4),%rax
add    $0x10,%rax
mov    %esi,%edi
sub    0x10(%rsp,%rdx,4),%edi
jmp    11f0 <main+0xb0>
mov    (%rsi),%rsi
lea    0xda1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d;\00"
@EOF = global i64 0
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [99 x 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 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %84
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %5
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
br label %25
25: ; preds = %80, %20
%26 = load i32*, i32** %6
%27 = call i64 @fscanf(i32* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%28 = load i64, i64* @EOF
%29 = icmp ne i64 %27, %28
br i1 %29, label %30, label %83
30: ; preds = %25
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %12
br label %31
31: ; preds = %75, %30
%32 = load i32*, i32** %6
%33 = call i64 @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %11)
%34 = load i32, i32* %12
%35 = load i32, i32* %7
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %46
37: ; preds = %31
%38 = load i32, i32* %11
%39 = load i32, i32* %10
%40 = add nsw i32 %39, %38
store i32 %40, i32* %10
%41 = load i32, i32* %11
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [99 x i32], [99 x i32]* %8, i64 0, i64 %44
store i32 %41, i32* %45
br label %64
46: ; preds = %31
%47 = load i32, i32* %11
%48 = load i32, i32* %12
%49 = load i32, i32* %7
%50 = srem i32 %48, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [99 x i32], [99 x i32]* %8, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = sub nsw i32 %47, %53
%55 = load i32, i32* %10
%56 = add nsw i32 %55, %54
store i32 %56, i32* %10
%57 = load i32, i32* %11
%58 = load i32, i32* %12
%59 = add nsw i32 %58, 1
store i32 %59, i32* %12
%60 = load i32, i32* %7
%61 = srem i32 %58, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [99 x i32], [99 x i32]* %8, i64 0, i64 %62
store i32 %57, i32* %63
br label %64
64: ; preds = %46, %37
%65 = load i32, i32* %12
%66 = load i32, i32* %7
%67 = icmp sge i32 %65, %66
br i1 %67, label %68, label %74
68: ; preds = %64
%69 = load i32, i32* %10
%70 = load i32, i32* %9
%71 = icmp sgt i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = load i32, i32* %10
store i32 %73, i32* %9
br label %74
74: ; preds = %72, %68, %64
br label %75
75: ; preds = %74
%76 = load i32*, i32** %6
%77 = call signext i8 @getc(i32* %76)
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 32
br i1 %79, label %31, label %80
80: ; preds = %75
%81 = load i32, i32* %9
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %81)
br label %25
83: ; preds = %25
store i32 0, i32* %3
br label %84
84: ; preds = %83, %15
%85 = load i32, i32* %3
ret i32 %85
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d;\00"
@EOF = global i64 0
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [99 x i32]
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast [99 x i32]* %4 to i8*
%8 = icmp eq i32 %0, 2
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %57
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%17 = load i64, i64* @EOF
%18 = icmp eq i64 %16, %17
br i1 %18, label %57, label %19
19: ; preds = %12
%20 = bitcast i32* %5 to i8*
br label %21
21: ; preds = %19, %52
br label %22
22: ; preds = %40, %21
%23 = phi i64 [ %43, %40 ], [ 0, %21 ]
%24 = phi i32 [ %49, %40 ], [ 0, %21 ]
%25 = phi i32 [ %44, %40 ], [ 0, %21 ]
%26 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %23, %28
%30 = load i32, i32* %5
br i1 %29, label %31, label %33
31: ; preds = %22
%32 = getelementptr inbounds [99 x i32], [99 x i32]* %4, i64 0, i64 %23
br label %40
33: ; preds = %22
%34 = trunc i64 %23 to i32
%35 = srem i32 %34, %27
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds [99 x i32], [99 x i32]* %4, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = sub nsw i32 %30, %38
br label %40
40: ; preds = %33, %31
%41 = phi i32* [ %37, %33 ], [ %32, %31 ]
%42 = phi i32 [ %39, %33 ], [ %30, %31 ]
store i32 %30, i32* %41
%43 = add nuw i64 %23, 1
%44 = add nsw i32 %42, %25
%45 = trunc i64 %43 to i32
%46 = icmp sle i32 %27, %45
%47 = icmp sgt i32 %44, %24
%48 = select i1 %46, i1 %47, i1 false
%49 = select i1 %48, i32 %44, i32 %24
%50 = call signext i8 @getc(i32* %15)
%51 = icmp eq i8 %50, 32
br i1 %51, label %22, label %52
52: ; preds = %40
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%54 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%55 = load i64, i64* @EOF
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %21
57: ; preds = %52, %12, %9
%58 = phi i32 [ 1, %9 ], [ 0, %12 ], [ 0, %52 ]
ret i32 %58
}