#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 /*<<< orphan*/ array_to_1d_pointer(int **, int, int);
int /*<<< orphan*/ array_to_2d_pointer(int **, int, int);
int /*<<< orphan*/ array_to_array(int **, int, int);
int /*<<< orphan*/ array_to_pointer(int **, int, int);
int main() {
  int arr[][2] = {
      {11, 12}, {21, 22}, {31, 32}, {41, 42}, {51, 52},
  };
  int m, n;
  m = 5;
  n = 2;
  array_to_array(arr, m, n);
  array_to_pointer(arr, m, n);
  array_to_1d_pointer(arr, m, n);
  array_to_2d_pointer(arr, m, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x5,-0x34(%rbp)
movl   $0x2,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1040 <array_to_array@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1060 <array_to_pointer@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1070 <array_to_1d_pointer@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <array_to_2d_pointer@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1040 <array_to_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1050 <array_to_pointer@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1060 <array_to_1d_pointer@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1030 <array_to_2d_pointer@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [5 x [2 x i32]] [[2 x i32] [i32 11, i32 12], [2 x i32] [i32 21, i32 22], [2 x i32] [i32 31, i32 32], [2 x i32] [i32 41, i32 42], [2 x i32] [i32 51, i32 52]]
define i32 @main() {
%1 = alloca [5 x [2 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [5 x [2 x i32]]* %1 to i8*
store i32 5, i32* %2
store i32 2, i32* %3
%5 = getelementptr inbounds [5 x [2 x i32]], [5 x [2 x i32]]* %1, i64 0, i64 0
%6 = bitcast [2 x i32]* %5 to i32**
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 @array_to_array(i32** %6, i32 %7, i32 %8)
%10 = getelementptr inbounds [5 x [2 x i32]], [5 x [2 x i32]]* %1, i64 0, i64 0
%11 = bitcast [2 x i32]* %10 to i32**
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 @array_to_pointer(i32** %11, i32 %12, i32 %13)
%15 = getelementptr inbounds [5 x [2 x i32]], [5 x [2 x i32]]* %1, i64 0, i64 0
%16 = bitcast [2 x i32]* %15 to i32**
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 @array_to_1d_pointer(i32** %16, i32 %17, i32 %18)
%20 = getelementptr inbounds [5 x [2 x i32]], [5 x [2 x i32]]* %1, i64 0, i64 0
%21 = bitcast [2 x i32]* %20 to i32**
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 @array_to_2d_pointer(i32** %21, i32 %22, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [5 x [2 x i32]] [[2 x i32] [i32 11, i32 12], [2 x i32] [i32 21, i32 22], [2 x i32] [i32 31, i32 32], [2 x i32] [i32 41, i32 42], [2 x i32] [i32 51, i32 52]]
define i32 @main() {
%1 = alloca [5 x [2 x i32]]
%2 = bitcast [5 x [2 x i32]]* %1 to i8*
%3 = bitcast [5 x [2 x i32]]* %1 to i32**
%4 = call i32 @array_to_array(i32** %3, i32 5, i32 2)
%5 = call i32 @array_to_pointer(i32** %3, i32 5, i32 2)
%6 = call i32 @array_to_1d_pointer(i32** %3, i32 5, i32 2)
%7 = call i32 @array_to_2d_pointer(i32** %3, i32 5, i32 2)
ret i32 0
}