#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 evenSum(int **, int);
int oddSum(int **, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int elems[3][3] = {{8, 27, 30}, {4, 5, 2}, {17, 19, 24}};
  int evens[4][4] = {
      {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};
  int sum = 0;
  sum = oddSum(elems, 3);
  printf("sum=%d\n", sum);
  sum = evenSum(evens, 4);
  printf("sum=%d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x30(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1060 <oddSum@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x4,%esi
call   1040 <evenSum@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xf03(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1050 <oddSum@plt>
lea    0xed6(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0x30(%rsp),%rdi
mov    $0x4,%esi
call   1040 <evenSum@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.elems = [3 x [3 x i32]] [[3 x i32] [i32 8, i32 27, i32 30], [3 x i32] [i32 4, i32 5, i32 2], [3 x i32] [i32 17, i32 19, i32 24]]
@__const.main.evens = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12], [4 x i32] [i32 13, i32 14, i32 15, i32 16]]
@.str = [8 x i8] c"sum=%d\0A\00"
define void @main() {
%1 = alloca [3 x [3 x i32]]
%2 = alloca [4 x [4 x i32]]
%3 = bitcast [3 x [3 x i32]]* %1 to i8*
%4 = bitcast [4 x [4 x i32]]* %2 to i8*
%5 = bitcast [3 x [3 x i32]]* %1 to i32**
%6 = call i32 @oddSum(i32** %5, i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [4 x [4 x i32]]* %2 to i32**
%9 = call i32 @evenSum(i32** %8, i32 4)
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}