#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 find_maximum_run(int, int **);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int size = 15;
  int triangle[15][15] = {
      {75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {95, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {17, 47, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {18, 35, 87, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {20, 4, 82, 47, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {19, 1, 23, 75, 3, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      {88, 2, 77, 73, 7, 63, 67, 0, 0, 0, 0, 0, 0, 0, 0},
      {99, 65, 4, 28, 6, 16, 70, 92, 0, 0, 0, 0, 0, 0, 0},
      {41, 41, 26, 56, 83, 40, 80, 70, 33, 0, 0, 0, 0, 0, 0},
      {41, 48, 72, 33, 47, 32, 37, 16, 94, 29, 0, 0, 0, 0, 0},
      {53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14, 0, 0, 0, 0},
      {70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57, 0, 0, 0},
      {91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48, 0, 0},
      {63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31, 0},
      {4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23}};
  int max = find_maximum_run(size, triangle);
  printf("max: %d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
lea    -0x390(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x384,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%edi
lea    -0x390(%rbp),%rsi
call   1050 <find_maximum_run@plt>
mov    %eax,-0x394(%rbp)
mov    -0x394(%rbp),%esi
lea    0x1201(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x390,%rsp
lea    0xec1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x384,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    $0xf,%edi
mov    %rbx,%rsi
call   1050 <find_maximum_run@plt>
lea    0x1221(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x390,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.triangle = <{ <{ i32, [14 x i32] }>, <{ i32, i32, [13 x i32] }>, <{ i32, i32, i32, [12 x i32] }>, <{ i32, i32, i32, i32, [11 x i32] }>, <{ i32, i32, i32, i32, i32, [10 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [9 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [8 x i32] }>, [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32] }> <{ <{ i32, [14 x i32] }> <{ i32 75, [14 x i32] zeroinitializer }>, <{ i32, i32, [13 x i32] }> <{ i32 95, i32 64, [13 x i32] zeroinitializer }>, <{ i32, i32, i32, [12 x i32] }> <{ i32 17, i32 47, i32 82, [12 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, [11 x i32] }> <{ i32 18, i32 35, i32 87, i32 10, [11 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [10 x i32] }> <{ i32 20, i32 4, i32 82, i32 47, i32 65, [10 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [9 x i32] }> <{ i32 19, i32 1, i32 23, i32 75, i32 3, i32 34, [9 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [8 x i32] }> <{ i32 88, i32 2, i32 77, i32 73, i32 7, i32 63, i32 67, [8 x i32] zeroinitializer }>, [15 x i32] [i32 99, i32 65, i32 4, i32 28, i32 6, i32 16, i32 70, i32 92, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 41, i32 41, i32 26, i32 56, i32 83, i32 40, i32 80, i32 70, i32 33, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 41, i32 48, i32 72, i32 33, i32 47, i32 32, i32 37, i32 16, i32 94, i32 29, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 53, i32 71, i32 44, i32 65, i32 25, i32 43, i32 91, i32 52, i32 97, i32 51, i32 14, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 70, i32 11, i32 33, i32 28, i32 77, i32 73, i32 17, i32 78, i32 39, i32 68, i32 17, i32 57, i32 0, i32 0, i32 0], [15 x i32] [i32 91, i32 71, i32 52, i32 38, i32 17, i32 14, i32 91, i32 43, i32 58, i32 50, i32 27, i32 29, i32 48, i32 0, i32 0], [15 x i32] [i32 63, i32 66, i32 4, i32 68, i32 89, i32 53, i32 67, i32 30, i32 73, i32 16, i32 69, i32 87, i32 40, i32 31, i32 0], [15 x i32] [i32 4, i32 62, i32 98, i32 27, i32 23, i32 9, i32 70, i32 98, i32 73, i32 93, i32 38, i32 53, i32 60, i32 4, i32 23] }>
@.str = [9 x i8] c"max: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [15 x [15 x i32]]
%4 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
%5 = bitcast [15 x [15 x i32]]* %3 to i8*
%6 = load i32, i32* %2
%7 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 0
%8 = bitcast [15 x i32]* %7 to i32**
%9 = call i32 @find_maximum_run(i32 %6, i32** %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.triangle = <{ <{ i32, [14 x i32] }>, <{ i32, i32, [13 x i32] }>, <{ i32, i32, i32, [12 x i32] }>, <{ i32, i32, i32, i32, [11 x i32] }>, <{ i32, i32, i32, i32, i32, [10 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [9 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [8 x i32] }>, [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32], [15 x i32] }> <{ <{ i32, [14 x i32] }> <{ i32 75, [14 x i32] zeroinitializer }>, <{ i32, i32, [13 x i32] }> <{ i32 95, i32 64, [13 x i32] zeroinitializer }>, <{ i32, i32, i32, [12 x i32] }> <{ i32 17, i32 47, i32 82, [12 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, [11 x i32] }> <{ i32 18, i32 35, i32 87, i32 10, [11 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [10 x i32] }> <{ i32 20, i32 4, i32 82, i32 47, i32 65, [10 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [9 x i32] }> <{ i32 19, i32 1, i32 23, i32 75, i32 3, i32 34, [9 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [8 x i32] }> <{ i32 88, i32 2, i32 77, i32 73, i32 7, i32 63, i32 67, [8 x i32] zeroinitializer }>, [15 x i32] [i32 99, i32 65, i32 4, i32 28, i32 6, i32 16, i32 70, i32 92, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 41, i32 41, i32 26, i32 56, i32 83, i32 40, i32 80, i32 70, i32 33, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 41, i32 48, i32 72, i32 33, i32 47, i32 32, i32 37, i32 16, i32 94, i32 29, i32 0, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 53, i32 71, i32 44, i32 65, i32 25, i32 43, i32 91, i32 52, i32 97, i32 51, i32 14, i32 0, i32 0, i32 0, i32 0], [15 x i32] [i32 70, i32 11, i32 33, i32 28, i32 77, i32 73, i32 17, i32 78, i32 39, i32 68, i32 17, i32 57, i32 0, i32 0, i32 0], [15 x i32] [i32 91, i32 71, i32 52, i32 38, i32 17, i32 14, i32 91, i32 43, i32 58, i32 50, i32 27, i32 29, i32 48, i32 0, i32 0], [15 x i32] [i32 63, i32 66, i32 4, i32 68, i32 89, i32 53, i32 67, i32 30, i32 73, i32 16, i32 69, i32 87, i32 40, i32 31, i32 0], [15 x i32] [i32 4, i32 62, i32 98, i32 27, i32 23, i32 9, i32 70, i32 98, i32 73, i32 93, i32 38, i32 53, i32 60, i32 4, i32 23] }>
@.str = [9 x i8] c"max: %d\0A\00"
define i32 @main() {
%1 = alloca [15 x [15 x i32]]
%2 = bitcast [15 x [15 x i32]]* %1 to i8*
%3 = bitcast [15 x [15 x i32]]* %1 to i32**
%4 = call i32 @find_maximum_run(i32 15, i32** %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}