#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*/ printFloatArray(float *, int);
int /*<<< orphan*/ printMatrixVersion1(int **, int);
int /*<<< orphan*/ printMatrixVersion2(int **, int);
int /*<<< orphan*/ printf(char *);
int main() {
  float F1[10] = {1.2F, 1.1F, -10.9F, 7.34F};
  float F2[4] = {5.4F, 2.21F, -12.2F, 0.01F};
  int TableA[3][4] = {{6, 15, -2, 0}, {12, 90, 5, 43}, {-50, 20, 1, 10}};
  printf("Array Example 4 - "
         "Passing Arrays to Functions\n\n");
  printFloatArray(F1, 10);
  printFloatArray(F2, 4);
  printFloatArray(F1, 6);
  printMatrixVersion1(TableA, 3);
  printMatrixVersion2(TableA, 3);
  printMatrixVersion2(TableA, 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movss  0xe85(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xe74(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xe63(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xe52(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    0xe56(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe53(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x30,%edx
call   1060 <memcpy@plt>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <printFloatArray@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
call   1070 <printFloatArray@plt>
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1070 <printFloatArray@plt>
lea    -0x70(%rbp),%rdi
mov    $0x3,%esi
call   1080 <printMatrixVersion1@plt>
lea    -0x70(%rbp),%rdi
mov    $0x3,%esi
call   1040 <printMatrixVersion2@plt>
lea    -0x70(%rbp),%rdi
mov    $0x2,%esi
call   1040 <printMatrixVersion2@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printFloatArray@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
call   1050 <printFloatArray@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printFloatArray@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <printMatrixVersion1@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printMatrixVersion2@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printMatrixVersion2@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.F2 = [4 x float] [float 0x40159999A0000000, float 0x4001AE1480000000, float 0xC028666660000000, float 0x3F847AE140000000]
@__const.main.TableA = [3 x [4 x i32]] [[4 x i32] [i32 6, i32 15, i32 -2, i32 0], [4 x i32] [i32 12, i32 90, i32 5, i32 43], [4 x i32] [i32 -50, i32 20, i32 1, i32 10]]
@.str = [48 x i8] c"Array Example 4 - Passing Arrays to Functions\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca [4 x float]
%4 = alloca [3 x [4 x i32]]
store i32 0, i32* %1
%5 = bitcast [10 x float]* %2 to i8*
%6 = bitcast i8* %5 to [10 x float]*
%7 = getelementptr inbounds [10 x float], [10 x float]* %6, i32 0, i32 0
store float 0x3FF3333340000000, float* %7
%8 = getelementptr inbounds [10 x float], [10 x float]* %6, i32 0, i32 1
store float 0x3FF19999A0000000, float* %8
%9 = getelementptr inbounds [10 x float], [10 x float]* %6, i32 0, i32 2
store float 0xC025CCCCC0000000, float* %9
%10 = getelementptr inbounds [10 x float], [10 x float]* %6, i32 0, i32 3
store float 0x401D5C2900000000, float* %10
%11 = bitcast [4 x float]* %3 to i8*
%12 = bitcast [3 x [4 x i32]]* %4 to i8*
%13 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%15 = call i32 @printFloatArray(float* %14, i32 10)
%16 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%17 = call i32 @printFloatArray(float* %16, i32 4)
%18 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%19 = call i32 @printFloatArray(float* %18, i32 6)
%20 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 0
%21 = bitcast [4 x i32]* %20 to i32**
%22 = call i32 @printMatrixVersion1(i32** %21, i32 3)
%23 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 0
%24 = bitcast [4 x i32]* %23 to i32**
%25 = call i32 @printMatrixVersion2(i32** %24, i32 3)
%26 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 0
%27 = bitcast [4 x i32]* %26 to i32**
%28 = call i32 @printMatrixVersion2(i32** %27, i32 2)
ret i32 0
}

LLVM IR (-O2):
@__const.main.F2 = [4 x float] [float 0x40159999A0000000, float 0x4001AE1480000000, float 0xC028666660000000, float 0x3F847AE140000000]
@__const.main.TableA = [3 x [4 x i32]] [[4 x i32] [i32 6, i32 15, i32 -2, i32 0], [4 x i32] [i32 12, i32 90, i32 5, i32 43], [4 x i32] [i32 -50, i32 20, i32 1, i32 10]]
@str = [47 x i8] c"Array Example 4 - Passing Arrays to Functions\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = alloca [4 x float]
%3 = alloca [3 x [4 x i32]]
%4 = bitcast [10 x float]* %1 to i8*
%5 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 4
%6 = bitcast float* %5 to i8*
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%8 = bitcast [10 x float]* %1 to <4 x float>*
store <4 x float> <float 0x3FF3333340000000, float 0x3FF19999A0000000, float 0xC025CCCCC0000000, float 0x401D5C2900000000>, <4 x float>* %8
%9 = bitcast [4 x float]* %2 to i8*
%10 = bitcast [3 x [4 x i32]]* %3 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printFloatArray(float* %7, i32 10)
%13 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 0
%14 = call i32 @printFloatArray(float* %13, i32 4)
%15 = call i32 @printFloatArray(float* %7, i32 6)
%16 = bitcast [3 x [4 x i32]]* %3 to i32**
%17 = call i32 @printMatrixVersion1(i32** %16, i32 3)
%18 = call i32 @printMatrixVersion2(i32** %16, i32 3)
%19 = call i32 @printMatrixVersion2(i32** %16, i32 2)
ret i32 0
}