#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 */
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int max_sum(int *, int *, int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a[] = {2, 3, 7, 10, 12, 15, 30, 34};
  int b[] = {1, 5, 7, 8, 10, 15, 16, 19};
  int len_a = sizeof(a) / sizeof(a[0]);
  int len_b = sizeof(b) / sizeof(b[0]);
  int res = max_sum(a, b, len_a, len_b);
  printf("Max sum is %d", res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x8,-0x44(%rbp)
movl   $0x8,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
call   1030 <max_sum@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x8,%edx
mov    $0x8,%ecx
call   1030 <max_sum@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [8 x i32] [i32 2, i32 3, i32 7, i32 10, i32 12, i32 15, i32 30, i32 34]
@__const.main.b = [8 x i32] [i32 1, i32 5, i32 7, i32 8, i32 10, i32 15, i32 16, i32 19]
@.str = [14 x i8] c"Max sum is %d\00"
define void @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [8 x i32]* %1 to i8*
%7 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
store i32 8, i32* %4
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @max_sum(i32* %8, i32* %9, i32 %10, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@__const.main.a = [8 x i32] [i32 2, i32 3, i32 7, i32 10, i32 12, i32 15, i32 30, i32 34]
@__const.main.b = [8 x i32] [i32 1, i32 5, i32 7, i32 8, i32 10, i32 15, i32 16, i32 19]
@.str = [14 x i8] c"Max sum is %d\00"
define void @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = call i32 @max_sum(i32* %5, i32* %6, i32 8, i32 8)
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}