#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 MaxSubSequenceSum1(int *, int);
int MaxSubSequenceSum2(int *, int);
int MaxSubSequenceSum3(int *, int);
int MaxSubSequenceSum4(int *, int);
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int A[] = {4, -3, 5, -2, -1, 2, 6, -2};
  int R = MaxSubSequenceSum1(A, 8);
  printf("%d\n", R);
  R = MaxSubSequenceSum2(A, 8);
  printf("%d\n", R);
  R = MaxSubSequenceSum3(A, 8);
  printf("%d\n", R);
  R = MaxSubSequenceSum4(A, 8);
  printf("%d\n", R);
  int B[1000] = {0};
  srand((unsigned int)time(NULL));
  for (int i = 0; i < 1000; ++i) {
    B[i] = rand() % 90 + 10;
  }
  printf("%d\n", rand() % 90 + 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xff0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe50(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe4d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe4a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe47(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   10a0 <MaxSubSequenceSum1@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1050 <MaxSubSequenceSum2@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1090 <MaxSubSequenceSum3@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1030 <MaxSubSequenceSum4@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xdd0(%rip),%rdi
call   1040 <printf@plt>
lea    -0xfe0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1060 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,-0xfe4(%rbp)
cmpl   $0x3e8,-0xfe4(%rbp)
jge    12c6 <main+0x136>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5a,%ecx
cltd
idiv   %ecx
add    $0xa,%edx
movslq -0xfe4(%rbp),%rax
mov    %edx,-0xfe0(%rbp,%rax,4)
mov    -0xfe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfe4(%rbp)
jmp    1282 <main+0xf2>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5a,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0xa,%esi
lea    0xd3f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xff0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xe82(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe66(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x8,%esi
call   1090 <MaxSubSequenceSum1@plt>
lea    0xe6b(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1050 <MaxSubSequenceSum2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1080 <MaxSubSequenceSum3@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1030 <MaxSubSequenceSum4@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x3e8,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <rand@plt>
add    $0xffffffff,%ebx
jne    1220 <main+0xa0>
xor    %eax,%eax
call   10a0 <rand@plt>
cltq
imul   $0xffffffffb60b60b7,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x5a,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0xa,%esi
lea    0xdc2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.A = [8 x i32] [i32 4, i32 -3, i32 5, i32 -2, i32 -1, i32 2, i32 6, i32 -2]
@.str = [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 [8 x i32]
%7 = alloca i32
%8 = alloca [1000 x i32]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [8 x i32]* %6 to i8*
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%12 = call i32 @MaxSubSequenceSum1(i32* %11, i32 8)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%16 = call i32 @MaxSubSequenceSum2(i32* %15, i32 8)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%20 = call i32 @MaxSubSequenceSum3(i32* %19, i32 8)
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%24 = call i32 @MaxSubSequenceSum4(i32* %23, i32 8)
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = bitcast [1000 x i32]* %8 to i8*
%28 = call i64 @time(i32* null)
%29 = trunc i64 %28 to i32
%30 = call i32 @srand(i32 %29)
store i32 0, i32* %9
br label %31
31: ; preds = %41, %2
%32 = load i32, i32* %9
%33 = icmp slt i32 %32, 1000
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 90
%37 = add nsw i32 %36, 10
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %39
store i32 %37, i32* %40
br label %41
41: ; preds = %34
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
br label %31
44: ; preds = %31
%45 = call i32 (...) @rand()
%46 = srem i32 %45, 90
%47 = add nsw i32 %46, 10
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [8 x i32] [i32 4, i32 -3, i32 5, i32 -2, i32 -1, i32 2, i32 6, i32 -2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%6 = call i32 @MaxSubSequenceSum1(i32* %5, i32 8)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @MaxSubSequenceSum2(i32* %5, i32 8)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @MaxSubSequenceSum3(i32* %5, i32 8)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @MaxSubSequenceSum4(i32* %5, i32 8)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i64 @time(i32* null)
%15 = trunc i64 %14 to i32
%16 = call i32 @srand(i32 %15)
br label %22
17: ; preds = %22
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 90
%20 = add nsw i32 %19, 10
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
22: ; preds = %2, %22
%23 = phi i32 [ 0, %2 ], [ %25, %22 ]
%24 = call i32 (...) @rand()
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, 1000
br i1 %26, label %17, label %22
}