#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 main() {
  int i, j, lado;
  printf("Entre o tamanho do lado do quadrado: ");
  scanf("%d", &lado);
  for (i = 0; i < lado; i++) {
    for (j = 0; j < lado; j++) {
      if (i == 0 || i == lado - 1) {
        printf("*");
      } else if (j == 0 || j == lado - 1) {
        printf("*");
      } else if (j > 0 && j < lado - 1) {
        printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1227 <main+0x107>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    120d <main+0xed>
cmpl   $0x0,-0x8(%rbp)
je     118c <main+0x6c>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    119d <main+0x7d>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xda>
cmpl   $0x0,-0xc(%rbp)
je     11b8 <main+0x98>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11c9 <main+0xa9>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
cmpl   $0x0,-0xc(%rbp)
jle    11f0 <main+0xd0>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f0 <main+0xd0>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
jmp    11fa <main+0xda>
jmp    11ff <main+0xdf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b2 <main+0x82>
xor    %ebx,%ebx
jmp    1175 <main+0x45>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    11b2 <main+0x82>
test   %eax,%eax
jle    1160 <main+0x30>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
test   %ebx,%ebx
je     11a0 <main+0x70>
add    $0xffffffff,%eax
cmp    %eax,%ebx
je     11a0 <main+0x70>
test   %ebp,%ebp
je     11a0 <main+0x70>
cmp    %eax,%ebp
je     11a0 <main+0x70>
mov    $0x20,%edi
jge    11a5 <main+0x75>
nop
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jl     1180 <main+0x50>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Entre o tamanho do lado do quadrado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [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 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %7
7: ; preds = %54, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %57
11: ; preds = %7
store i32 0, i32* %3
br label %12
12: ; preds = %49, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %52
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = load i32, i32* %2
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %19, %16
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %48
26: ; preds = %19
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %26
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 1
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %36
34: ; preds = %29, %26
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %47
36: ; preds = %29
%37 = load i32, i32* %3
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load i32, i32* %3
%41 = load i32, i32* %4
%42 = sub nsw i32 %41, 1
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %44, %39, %36
br label %47
47: ; preds = %46, %34
br label %48
48: ; preds = %47, %24
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %12
52: ; preds = %12
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %7
57: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Entre o tamanho do lado do quadrado: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %37
7: ; preds = %0, %32
%8 = phi i32 [ %35, %32 ], [ %5, %0 ]
%9 = phi i32 [ %34, %32 ], [ 0, %0 ]
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %32
11: ; preds = %7
%12 = icmp eq i32 %9, 0
br label %13
13: ; preds = %11, %28
%14 = phi i32 [ %8, %11 ], [ %30, %28 ]
%15 = phi i32 [ 0, %11 ], [ %29, %28 ]
br i1 %12, label %25, label %16
16: ; preds = %13
%17 = add nsw i32 %14, -1
%18 = icmp eq i32 %9, %17
br i1 %18, label %25, label %19
19: ; preds = %16
%20 = icmp eq i32 %15, 0
%21 = icmp eq i32 %15, %17
%22 = select i1 %20, i1 true, i1 %21
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = icmp slt i32 %15, %17
br i1 %24, label %25, label %28
25: ; preds = %23, %19, %13, %16
%26 = phi i32 [ 42, %16 ], [ 42, %13 ], [ 42, %19 ], [ 32, %23 ]
%27 = call i32 @putchar(i32 %26)
br label %28
28: ; preds = %25, %23
%29 = add nuw nsw i32 %15, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
br i1 %31, label %13, label %32
32: ; preds = %28, %7
%33 = call i32 @putchar(i32 10)
%34 = add nuw nsw i32 %9, 1
%35 = load i32, i32* %1
%36 = icmp slt i32 %34, %35
br i1 %36, label %7, label %37
37: ; preds = %32, %0
ret i32 0
}