#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 getint(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int lado = getint("Introduce el lado del cuadrado: ");
  int i = 1, n = 1;
  while (i <= lado) {
    while (n <= lado) {
      printf("*");
      n++;
    }
    printf("\n");
    i++;
    n = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a4 <main+0x84>
jmp    115d <main+0x3d>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1183 <main+0x63>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <main+0x3d>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xed5(%rip),%rdi
call   1040 <getint@plt>
test   %eax,%eax
jle    1173 <main+0x53>
mov    %eax,%r14d
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Introduce el lado del cuadrado: \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @getint(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %23
10: ; preds = %6
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %11
19: ; preds = %11
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
store i32 1, i32* %4
br label %6
23: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Introduce el lado del cuadrado: \00"
define i32 @main() {
%1 = tail call i32 @getint(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i32 %1, 1
br i1 %2, label %14, label %3
3: ; preds = %0, %10
%4 = phi i32 [ %12, %10 ], [ 1, %0 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 1, %3 ]
%7 = tail call i32 @putchar(i32 42)
%8 = add nuw i32 %6, 1
%9 = icmp eq i32 %6, %1
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = tail call i32 @putchar(i32 10)
%12 = add nuw i32 %4, 1
%13 = icmp eq i32 %4, %1
br i1 %13, label %14, label %3
14: ; preds = %10, %0
ret i32 0
}