#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 multiply(int **, int **);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[1][2];
  a[0][0] = 1;
  a[0][1] = 2;
  int b[2][1];
  b[0][0] = 3;
  b[1][0] = 4;
  int c;
  c = multiply(a, b);
  printf("%d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x4,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <multiply@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x200000001,%rax
mov    %rax,0x10(%rsp)
movabs $0x400000003,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <multiply@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

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