#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_subarray(int *, int *, int *);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int array[16] = {13, -3, -25, 20, -3,  -16, -23, 18,
                   20, -7, 12,  -5, -22, 15,  -4,  7};
  int low = 0;
  int high = 15;
  printf("%d", max_subarray(array, &low, &high));
  printf("\n%d %d", low, high);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
movl   $0xf,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x54(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1050 <max_subarray@plt>
mov    %eax,%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0xf,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <max_subarray@plt>
lea    0xec5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.array = [16 x i32] [i32 13, i32 -3, i32 -25, i32 20, i32 -3, i32 -16, i32 -23, i32 18, i32 20, i32 -7, i32 12, i32 -5, i32 -22, i32 15, i32 -4, i32 7]
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"\0A%d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [16 x i32]* %2 to i8*
store i32 0, i32* %3
store i32 15, i32* %4
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%7 = call i32 @max_subarray(i32* %6, i32* %3, i32* %4)
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [16 x i32] [i32 13, i32 -3, i32 -25, i32 20, i32 -3, i32 -16, i32 -23, i32 18, i32 20, i32 -7, i32 12, i32 -5, i32 -22, i32 15, i32 -4, i32 7]
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"\0A%d %d\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [16 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 15, i32* %3
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%8 = call i32 @max_subarray(i32* %7, i32* %2, i32* %3)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
ret i32 0
}