#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  system("color 27");
  system("title 17_FacerUnCadrado_Cascallar_Autrán_Manuel");
  system("cls");
  printf("CADRADO\n");
  printf("=======\n");
  int a, b, x;
  printf("Introduce o n\243mero de veces que queres que forme o cadrado:\n");
  scanf("%d", &x);
  for (a = 0; a < x; a++) {
    for (b = 0; b < x; b++) {
      printf("*");
    }
    printf("\n");
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
lea    0xeb7(%rip),%rdi
call   1030 <system@plt>
lea    0xedc(%rip),%rdi
call   1030 <system@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f1 <main+0xc1>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d7 <main+0xa7>
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b1 <main+0x81>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119e <main+0x6e>
lea    0xe9a(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
call   1050 <system@plt>
lea    0xeb3(%rip),%rdi
call   1050 <system@plt>
lea    0xed8(%rip),%rdi
call   1050 <system@plt>
lea    0xed9(%rip),%rdi
call   1040 <puts@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11e5 <main+0xa5>
xor    %ebx,%ebx
jmp    11c5 <main+0x85>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    11e5 <main+0xa5>
test   %eax,%eax
jle    11b0 <main+0x70>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11d0 <main+0x90>
jmp    11b0 <main+0x70>
lea    0xe55(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"color 27\00"
@.str.1 = [49 x i8] c"title 17_FacerUnCadrado_Cascallar_Autr\C3\A1n_Manuel\00"
@.str.2 = [4 x i8] c"cls\00"
@.str.3 = [9 x i8] c"CADRADO\0A\00"
@.str.4 = [9 x i8] c"=======\0A\00"
@.str.5 = [61 x i8] c"Introduce o n\A3mero de veces que queres que forme o cadrado:\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [2 x i8] c"*\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %12
12: ; preds = %28, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
store i32 0, i32* %3
br label %17
17: ; preds = %23, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %23
23: ; preds = %21
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %17
26: ; preds = %17
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %12
31: ; preds = %12
%32 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [9 x i8] c"color 27\00"
@.str.1 = [49 x i8] c"title 17_FacerUnCadrado_Cascallar_Autr\C3\A1n_Manuel\00"
@.str.2 = [4 x i8] c"cls\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.9 = [6 x i8] c"pause\00"
@str = [8 x i8] c"CADRADO\00"
@str.10 = [8 x i8] c"=======\00"
@str.11 = [60 x i8] c"Introduce o n\A3mero de veces que queres que forme o cadrado:\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.11, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %0, %22
%13 = phi i32 [ %25, %22 ], [ %10, %0 ]
%14 = phi i32 [ %24, %22 ], [ 0, %0 ]
%15 = icmp sgt i32 %13, 0
br i1 %15, label %16, label %22
16: ; preds = %12, %16
%17 = phi i32 [ %19, %16 ], [ 0, %12 ]
%18 = call i32 @putchar(i32 42)
%19 = add nuw nsw i32 %17, 1
%20 = load i32, i32* %1
%21 = icmp slt i32 %19, %20
br i1 %21, label %16, label %22
22: ; preds = %16, %12
%23 = call i32 @putchar(i32 10)
%24 = add nuw nsw i32 %14, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %24, %25
br i1 %26, label %12, label %27
27: ; preds = %22, %0
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}