#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 max_subsequece_sum1(int *, int);
int max_subsequece_sum2(int *, int);
int max_subsequece_sum3(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argv, char *args[]) {
  int a[10] = {[0] = 1, [1] = -2, [2] = 5, [3] = 2, -3, 9, -4, 5, -6, 3};
  printf("algorithm one output:%d\n", max_subsequece_sum1(a, 10));
  printf("algorithm two output:%d\n", max_subsequece_sum2(a, 10));
  printf("algorithm three output:%d\n", max_subsequece_sum3(a, 10));
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <max_subsequece_sum1@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1060 <max_subsequece_sum2@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1070 <max_subsequece_sum3@plt>
mov    %eax,%esi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <max_subsequece_sum1@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <max_subsequece_sum2@plt>
lea    0xea7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <max_subsequece_sum3@plt>
lea    0xea5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 -2, i32 5, i32 2, i32 -3, i32 9, i32 -4, i32 5, i32 -6, i32 3]
@.str = [25 x i8] c"algorithm one output:%d\0A\00"
@.str.1 = [25 x i8] c"algorithm two output:%d\0A\00"
@.str.2 = [27 x i8] c"algorithm three output:%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [10 x i32]* %6 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%9 = call i32 @max_subsequece_sum1(i32* %8, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%12 = call i32 @max_subsequece_sum2(i32* %11, i32 10)
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%15 = call i32 @max_subsequece_sum3(i32* %14, i32 10)
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 1
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 -2, i32 5, i32 2, i32 -3, i32 9, i32 -4, i32 5, i32 -6, i32 3]
@.str = [25 x i8] c"algorithm one output:%d\0A\00"
@.str.1 = [25 x i8] c"algorithm two output:%d\0A\00"
@.str.2 = [27 x i8] c"algorithm three output:%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @max_subsequece_sum1(i32* %5, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @max_subsequece_sum2(i32* %5, i32 10)
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @max_subsequece_sum3(i32* %5, i32 10)
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 1
}