#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 */
typedef int /*<<< orphan*/ arreglo_multi;
typedef int /*<<< orphan*/ arreglo;

/* Variables and functions */
int /*<<< orphan*/ ent_dir(int *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int col, row, size_uni, size_multi;
  int arreglo_multi[3][3] = {{-1, -2, -3}, {-4, -5, -6}, {-7, -8, -9}};
  int arreglo[10] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
  row = sizeof(arreglo_multi) / sizeof(arreglo_multi[0]);
  col = sizeof(arreglo_multi[0]) / sizeof(arreglo_multi[0][0]);
  size_uni = sizeof(arreglo) / sizeof(arreglo[0]);
  size_multi = row * col;
  printf("Arreglo unidimensional \n");
  ent_dir(&arreglo[0], size_uni);
  printf("Arreglo multidimensional[3][3] \n");
  ent_dir(&arreglo_multi[0][0], size_multi);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xed1(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x3,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0xa,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <ent_dir@plt>
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <ent_dir@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xf04(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
call   1030 <ent_dir@plt>
lea    0xee5(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
mov    $0x9,%esi
call   1030 <ent_dir@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.arreglo_multi = [3 x [3 x i32]] [[3 x i32] [i32 -1, i32 -2, i32 -3], [3 x i32] [i32 -4, i32 -5, i32 -6], [3 x i32] [i32 -7, i32 -8, i32 -9]]
@__const.main.arreglo = [10 x i32] [i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8, i32 -9, i32 -10]
@.str = [25 x i8] c"Arreglo unidimensional \0A\00"
@.str.1 = [33 x i8] c"Arreglo multidimensional[3][3] \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x [3 x i32]]
%7 = alloca [10 x i32]
store i32 0, i32* %1
%8 = bitcast [3 x [3 x i32]]* %6 to i8*
%9 = bitcast [10 x i32]* %7 to i8*
store i32 3, i32* %3
store i32 3, i32* %2
store i32 10, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = mul nsw i32 %10, %11
store i32 %12, i32* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @ent_dir(i32* %14, i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 0
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %18, i64 0, i64 0
%20 = load i32, i32* %5
%21 = call i32 @ent_dir(i32* %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arreglo_multi = [3 x [3 x i32]] [[3 x i32] [i32 -1, i32 -2, i32 -3], [3 x i32] [i32 -4, i32 -5, i32 -6], [3 x i32] [i32 -7, i32 -8, i32 -9]]
@__const.main.arreglo = [10 x i32] [i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8, i32 -9, i32 -10]
@str = [24 x i8] c"Arreglo unidimensional \00"
@str.2 = [32 x i8] c"Arreglo multidimensional[3][3] \00"
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = alloca [10 x i32]
%3 = bitcast [3 x [3 x i32]]* %1 to i8*
%4 = bitcast [10 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @ent_dir(i32* %6, i32 10)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
%9 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0, i64 0
%10 = call i32 @ent_dir(i32* %9, i32 9)
ret i32 0
}