int main(int argc, char const *argv[]) {
  int total1, total2, total3;
  int *pt1;
  int(*pt2)[4];
  pt1 = (int[2]){10, 20};
  pt2 = (int[2][4]){{1, 2, 3, -9}, {4, 5, 6, -8}};
  total1 = sum(pt1, 2);
  total2 = sum2d(pt2, 2);
  total3 = sum((int[]){4, 4, 4, 5, 5, 5}, 6);
  printf("total1 = %d\n", total1);
  printf("total2 = %d\n", total2);
  printf("total3 = %d\n", total3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x38(%rbp)
movl   $0x14,-0x34(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2ed5(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0x2ed2(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2ecf(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2ecc(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    -0x58(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1050 <sum@plt>
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <sum2d@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e9b(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2e98(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0x2e95(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1050 <sum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
movabs $0x140000000a,%rax
mov    %rax,0x8(%rsp)
movups 0xeb2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0xeb6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <sum@plt>
mov    %eax,%r14d
lea    0x30(%rsp),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <sum2d@plt>
mov    %eax,%ebp
movups 0xe93(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xe97(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <sum@plt>
mov    %eax,%ebx
lea    0xe80(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@constinit = private global [2 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 -9], [4 x i32] [i32 4, i32 5, i32 6, i32 -8]]
@constinit.1 = private global [6 x i32] [i32 4, i32 4, i32 4, i32 5, i32 5, i32 5]
@.str = [13 x i8] c"total1 = %d\0A\00"
@.str.2 = [13 x i8] c"total2 = %d\0A\00"
@.str.3 = [13 x i8] c"total3 = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [4 x i32]*
%11 = alloca [2 x i32]
%12 = alloca [2 x [4 x i32]]
%13 = alloca [6 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32 10, i32* %14
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 20, i32* %15
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32* %16, i32** %9
%17 = getelementptr inbounds [2 x [4 x i32]], [2 x [4 x i32]]* %12, i64 0, i64 0
%18 = bitcast [2 x [4 x i32]]* %12 to i8*
%19 = getelementptr inbounds [2 x [4 x i32]], [2 x [4 x i32]]* %12, i64 0, i64 0
store [4 x i32]* %19, [4 x i32]** %10
%20 = load i32*, i32** %9
%21 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @sum to i32 (i32*, i32, ...)*)(i32* %20, i32 2)
store i32 %21, i32* %6
%22 = load [4 x i32]*, [4 x i32]** %10
%23 = call i32 ([4 x i32]*, i32, ...) bitcast (i32 (...)* @sum2d to i32 ([4 x i32]*, i32, ...)*)([4 x i32]* %22, i32 2)
store i32 %23, i32* %7
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%25 = bitcast [6 x i32]* %13 to i8*
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0, i64 0
%27 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @sum to i32 (i32*, i32, ...)*)(i32* %26, i32 6)
store i32 %27, i32* %8
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@constinit = [2 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 -9], [4 x i32] [i32 4, i32 5, i32 6, i32 -8]]
@constinit.1 = [6 x i32] [i32 4, i32 4, i32 4, i32 5, i32 5, i32 5]
@.str = [13 x i8] c"total1 = %d\0A\00"
@.str.2 = [13 x i8] c"total2 = %d\0A\00"
@.str.3 = [13 x i8] c"total3 = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x [4 x i32]]
%5 = alloca [6 x i32]
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 10, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 20, i32* %7
%8 = bitcast [2 x [4 x i32]]* %4 to i8*
%9 = getelementptr inbounds [2 x [4 x i32]], [2 x [4 x i32]]* %4, i64 0, i64 0
%10 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @sum to i32 (i32*, i32, ...)*)(i32* %6, i32 2)
%11 = call i32 ([4 x i32]*, i32, ...) bitcast (i32 (...)* @sum2d to i32 ([4 x i32]*, i32, ...)*)([4 x i32]* %9, i32 2)
%12 = bitcast [6 x i32]* %5 to i8*
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%14 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @sum to i32 (i32*, i32, ...)*)(i32* %13, i32 6)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %14)
ret i32 0
}