#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, ...);
int main(void) {
  int a, b, c, max;
  scanf("%*d%d%d", &a, &b);
  for (max = c = a - b; scanf("%d", &a) != EOF; b = a)
    if ((c = c > 0 ? b - a + c : b - a) > max)
      max = c;
  printf("%d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0x14(%rbp)
lea    0xead(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
je     11bc <main+0x9c>
cmpl   $0x0,-0x10(%rbp)
jle    118e <main+0x6e>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1197 <main+0x77>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmp    -0x14(%rbp),%eax
jle    11ac <main+0x8c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
mov    -0x14(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
xor    %r12d,%r12d
lea    0x4(%rsp),%r14
mov    %rsp,%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebp
sub    (%rsp),%ebp
lea    0xeb0(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x2e82(%rip),%r13
cmp    0x0(%r13),%rax
je     11aa <main+0x8a>
lea    0xe92(%rip),%r14
lea    0x4(%rsp),%r15
mov    %ebp,%ebx
nopw   0x0(%rax,%rax,1)
test   %ebx,%ebx
cmovs  %r12d,%ebx
mov    0x4(%rsp),%eax
add    (%rsp),%ebx
sub    %eax,%ebx
cmp    %ebp,%ebx
cmovg  %ebx,%ebp
mov    %eax,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
jne    1180 <main+0x60>
lea    0xe57(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%*d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %4
store i32 %9, i32* %5
br label %10
10: ; preds = %34, %0
%11 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %36
14: ; preds = %10
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %18, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
br label %27
23: ; preds = %14
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = sub nsw i32 %24, %25
br label %27
27: ; preds = %23, %17
%28 = phi i32 [ %22, %17 ], [ %26, %23 ]
store i32 %28, i32* %4
%29 = load i32, i32* %5
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = load i32, i32* %4
store i32 %32, i32* %5
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %33
%35 = load i32, i32* %2
store i32 %35, i32* %3
br label %10
36: ; preds = %10
%37 = load i32, i32* %5
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%*d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %6, %7
%9 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %26, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %22, %12 ], [ %8, %0 ]
%14 = phi i32 [ %20, %12 ], [ %8, %0 ]
%15 = icmp sgt i32 %14, 0
%16 = load i32, i32* %2
%17 = load i32, i32* %1
%18 = select i1 %15, i32 %14, i32 0
%19 = add i32 %16, %18
%20 = sub i32 %19, %17
%21 = icmp sgt i32 %20, %13
%22 = select i1 %21, i32 %20, i32 %13
store i32 %17, i32* %2
%23 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %12
26: ; preds = %12, %0
%27 = phi i32 [ %8, %0 ], [ %22, %12 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
ret i32 0
}