#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*/ imprimirMatriz(int **, int);
int /*<<< orphan*/ montarMatriz(int **, int);
int scanf(char *, int *);
int main(void) {
  int n, matriz[128][128];
  while (scanf("%d", &n), n != 0) {
    montarMatriz(matriz, n);
    imprimirMatriz(matriz, n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10010,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     117f <main+0x4f>
lea    -0x10010(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <montarMatriz@plt>
lea    -0x10010(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <imprimirMatriz@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x10010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10010,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1197 <main+0x67>
lea    0x10(%rsp),%rbx
lea    0xe9f(%rip),%r14
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <montarMatriz@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <imprimirMatriz@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x10010,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x [128 x i32]]
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = getelementptr inbounds [128 x [128 x i32]], [128 x [128 x i32]]* %3, i64 0, i64 0
%10 = bitcast [128 x i32]* %9 to i32**
%11 = load i32, i32* %2
%12 = call i32 @montarMatriz(i32** %10, i32 %11)
%13 = getelementptr inbounds [128 x [128 x i32]], [128 x [128 x i32]]* %3, i64 0, i64 0
%14 = bitcast [128 x i32]* %13 to i32**
%15 = load i32, i32* %2
%16 = call i32 @imprimirMatriz(i32** %14, i32 %15)
br label %4
17: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x [128 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [128 x [128 x i32]]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %0
%9 = bitcast [128 x [128 x i32]]* %2 to i32**
br label %10
10: ; preds = %8, %10
%11 = phi i32 [ %6, %8 ], [ %16, %10 ]
%12 = call i32 @montarMatriz(i32** %9, i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @imprimirMatriz(i32** %9, i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %10
18: ; preds = %10, %0
ret i32 0
}