#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: ");
  for (int n = 1, i = 1; i <= lado && n <= lado; i++) {
    printf("*");
    if (i == lado) {
      printf("\n");
      n++;
      i = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1169 <main+0x49>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1179 <main+0x59>
jmp    11c0 <main+0xa0>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11ad <main+0x8d>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11b2 <main+0x92>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x20,%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    117a <main+0x5a>
mov    %eax,%ebx
mov    $0x1,%ebp
mov    $0x1,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    %ebx,%ebp
jne    116e <main+0x4e>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
xor    %ebp,%ebp
cmp    %ebx,%ebp
jge    117a <main+0x5a>
add    $0x1,%ebp
cmp    %ebx,%r14d
jle    1150 <main+0x30>
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 = %26, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %29
16: ; preds = %14
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
store i32 0, i32* %4
br label %25
25: ; preds = %21, %16
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %6
29: ; preds = %14
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 sgt i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %12, %0
ret i32 0
4: ; preds = %0, %12
%5 = phi i32 [ %15, %12 ], [ 1, %0 ]
%6 = phi i32 [ %13, %12 ], [ 1, %0 ]
%7 = tail call i32 @putchar(i32 42)
%8 = icmp eq i32 %5, %1
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32 @putchar(i32 10)
%11 = add nsw i32 %6, 1
br label %12
12: ; preds = %4, %9
%13 = phi i32 [ %11, %9 ], [ %6, %4 ]
%14 = phi i32 [ 0, %9 ], [ %5, %4 ]
%15 = add nsw i32 %14, 1
%16 = icmp slt i32 %14, %1
%17 = icmp sle i32 %13, %1
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %4, label %3
}