#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(void) {
  int side = 0;
  int flag = 1;
  unsigned int internalCounter = 1;
  unsigned int externalCounter = 1;
  printf("%s", "Enter the square's side(1-20): ");
  scanf("%d", &side);
  while (flag != -1) {
    if (side >= 1) {
      if (side <= 20) {
        while (externalCounter <= side) {
          if (externalCounter == 1) {
            while (internalCounter <= side) {
              printf("%s", "*");
              internalCounter++;
            }
          } else if (externalCounter == side) {
            while (internalCounter <= side) {
              printf("%s", "*");
              internalCounter++;
            }
          } else if (externalCounter < side) {
            while (internalCounter <= side) {
              if (internalCounter == 1) {
                printf("%s", "*");
              } else if (internalCounter == side) {
                printf("%s", "*");
              } else if (internalCounter < side) {
                printf("%s", " ");
              }
              internalCounter++;
            }
          }
          printf("\n");
          externalCounter++;
          internalCounter = 1;
        }
        flag = -1;
      } else {
        printf("%s\n", "You have enter a side that is out of bounds!!! Please "
                       "re-enter!!!!");
        printf("%s", "Enter the square's side(1-20): ");
        scanf("%d", &side);
        flag = 1;
      }
    } else {
      printf(
          "%s\n",
          "You have enter a side that is out of bounds!!! Please re-enter!!!!");
      printf("%s", "Enter the square's side(1-20): ");
      scanf("%d", &side);
      flag = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeae(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     1391 <main+0x271>
cmpl   $0x1,-0x8(%rbp)
jl     134b <main+0x22b>
cmpl   $0x14,-0x8(%rbp)
jg     1305 <main+0x1e5>
jmp    1193 <main+0x73>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     12f9 <main+0x1d9>
cmpl   $0x1,-0x14(%rbp)
jne    11e2 <main+0xc2>
jmp    11ae <main+0x8e>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     11dd <main+0xbd>
lea    0xe3f(%rip),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ae <main+0x8e>
jmp    12d6 <main+0x1b6>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1227 <main+0x107>
jmp    11f3 <main+0xd3>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1222 <main+0x102>
lea    0xdfa(%rip),%rdi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f3 <main+0xd3>
jmp    12d1 <main+0x1b1>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    12cc <main+0x1ac>
jmp    1238 <main+0x118>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     12c7 <main+0x1a7>
cmpl   $0x1,-0x10(%rbp)
jne    1268 <main+0x148>
lea    0xdab(%rip),%rdi
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b9 <main+0x199>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    128e <main+0x16e>
lea    0xd85(%rip),%rdi
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b4 <main+0x194>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    12af <main+0x18f>
lea    0xd5f(%rip),%rdi
lea    0xd79(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b4 <main+0x194>
jmp    12b9 <main+0x199>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1238 <main+0x118>
jmp    12cc <main+0x1ac>
jmp    12d1 <main+0x1b1>
jmp    12d6 <main+0x1b6>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    1193 <main+0x73>
movl   $0xffffffff,-0xc(%rbp)
jmp    1346 <main+0x226>
lea    0xd1c(%rip),%rdi
lea    0xd19(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xcdf(%rip),%rdi
lea    0xcdb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xced(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    138c <main+0x26c>
lea    0xcd6(%rip),%rdi
lea    0xcd3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc99(%rip),%rdi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xca7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xea6(%rip),%rdi
lea    0xea2(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x14,%ecx
jb     11dc <main+0x9c>
lea    0xe9a(%rip),%r14
lea    0xe6d(%rip),%r15
lea    0xe69(%rip),%r12
lea    0xe82(%rip),%r13
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x14,%ecx
jae    11b0 <main+0x70>
test   %eax,%eax
je     12ab <main+0x16b>
mov    $0x1,%ebx
jmp    1209 <main+0xc9>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
ja     12ab <main+0x16b>
cmp    $0x1,%ebx
jne    1240 <main+0x100>
test   %eax,%eax
je     11f0 <main+0xb0>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jbe    1220 <main+0xe0>
jmp    11f0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %eax,%ebx
jne    1270 <main+0x130>
test   %eax,%eax
je     11f0 <main+0xb0>
mov    $0x1,%ebp
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jbe    1250 <main+0x110>
jmp    11f0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nop
jae    11f0 <main+0xb0>
mov    $0x1,%ebp
jmp    1294 <main+0x154>
nopl   (%rax)
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
ja     11f0 <main+0xb0>
mov    $0x2a,%edi
cmp    $0x1,%ebp
je     1280 <main+0x140>
cmp    %eax,%ebp
je     1280 <main+0x140>
mov    $0x20,%edi
jb     1280 <main+0x140>
jmp    1285 <main+0x145>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [32 x i8] c"Enter the square's side(1-20): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [67 x i8] c"You have enter a side that is out of bounds!!! Please re-enter!!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %97, %0
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %98
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 1
br i1 %13, label %14, label %93
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 20
br i1 %16, label %17, label %88
17: ; preds = %14
br label %18
18: ; preds = %83, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %2
%21 = icmp ule i32 %19, %20
br i1 %21, label %22, label %87
22: ; preds = %18
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %35
25: ; preds = %22
br label %26
26: ; preds = %30, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = icmp ule i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* %4
%33 = add i32 %32, 1
store i32 %33, i32* %4
br label %26
34: ; preds = %26
br label %83
35: ; preds = %22
%36 = load i32, i32* %5
%37 = load i32, i32* %2
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %49
39: ; preds = %35
br label %40
40: ; preds = %44, %39
%41 = load i32, i32* %4
%42 = load i32, i32* %2
%43 = icmp ule i32 %41, %42
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* %4
%47 = add i32 %46, 1
store i32 %47, i32* %4
br label %40
48: ; preds = %40
br label %82
49: ; preds = %35
%50 = load i32, i32* %5
%51 = load i32, i32* %2
%52 = icmp ult i32 %50, %51
br i1 %52, label %53, label %81
53: ; preds = %49
br label %54
54: ; preds = %77, %53
%55 = load i32, i32* %4
%56 = load i32, i32* %2
%57 = icmp ule i32 %55, %56
br i1 %57, label %58, label %80
58: ; preds = %54
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, 1
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %77
63: ; preds = %58
%64 = load i32, i32* %4
%65 = load i32, i32* %2
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %76
69: ; preds = %63
%70 = load i32, i32* %4
%71 = load i32, i32* %2
%72 = icmp ult i32 %70, %71
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73, %69
br label %76
76: ; preds = %75, %67
br label %77
77: ; preds = %76, %61
%78 = load i32, i32* %4
%79 = add i32 %78, 1
store i32 %79, i32* %4
br label %54
80: ; preds = %54
br label %81
81: ; preds = %80, %49
br label %82
82: ; preds = %81, %48
br label %83
83: ; preds = %82, %34
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%85 = load i32, i32* %5
%86 = add i32 %85, 1
store i32 %86, i32* %5
store i32 1, i32* %4
br label %18
87: ; preds = %18
store i32 -1, i32* %3
br label %92
88: ; preds = %14
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%91 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %92
92: ; preds = %88, %87
br label %97
93: ; preds = %11
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0))
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%96 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %97
97: ; preds = %93, %92
br label %8
98: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [32 x i8] c"Enter the square's side(1-20): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.7 = [67 x i8] c"You have enter a side that is out of bounds!!! Please re-enter!!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -1
%7 = icmp ult i32 %6, 20
br i1 %7, label %8, label %55
8: ; preds = %55, %0
%9 = phi i32 [ %5, %0 ], [ %59, %55 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %62, label %11
11: ; preds = %8, %50
%12 = phi i32 [ %53, %50 ], [ %9, %8 ]
%13 = phi i32 [ %52, %50 ], [ 1, %8 ]
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = icmp eq i32 %12, 0
br i1 %16, label %50, label %17
17: ; preds = %15, %17
%18 = phi i32 [ %20, %17 ], [ 1, %15 ]
%19 = call i32 @putchar(i32 42)
%20 = add i32 %18, 1
%21 = load i32, i32* %1
%22 = icmp ugt i32 %20, %21
br i1 %22, label %50, label %17
23: ; preds = %11
%24 = icmp eq i32 %13, %12
br i1 %24, label %25, label %33
25: ; preds = %23
%26 = icmp eq i32 %12, 0
br i1 %26, label %50, label %27
27: ; preds = %25, %27
%28 = phi i32 [ %30, %27 ], [ 1, %25 ]
%29 = call i32 @putchar(i32 42)
%30 = add i32 %28, 1
%31 = load i32, i32* %1
%32 = icmp ugt i32 %30, %31
br i1 %32, label %50, label %27
33: ; preds = %23
%34 = icmp ult i32 %13, %12
br i1 %34, label %35, label %50
35: ; preds = %33, %46
%36 = phi i32 [ %48, %46 ], [ %12, %33 ]
%37 = phi i32 [ %47, %46 ], [ 1, %33 ]
%38 = icmp eq i32 %37, 1
%39 = icmp eq i32 %37, %36
%40 = select i1 %38, i1 true, i1 %39
br i1 %40, label %43, label %41
41: ; preds = %35
%42 = icmp ult i32 %37, %36
br i1 %42, label %43, label %46
43: ; preds = %41, %35
%44 = phi i32 [ 42, %35 ], [ 32, %41 ]
%45 = call i32 @putchar(i32 %44)
br label %46
46: ; preds = %43, %41
%47 = add i32 %37, 1
%48 = load i32, i32* %1
%49 = icmp ugt i32 %47, %48
br i1 %49, label %50, label %35
50: ; preds = %46, %27, %17, %25, %15, %33
%51 = call i32 @putchar(i32 10)
%52 = add i32 %13, 1
%53 = load i32, i32* %1
%54 = icmp ugt i32 %52, %53
br i1 %54, label %62, label %11
55: ; preds = %0, %55
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%59 = load i32, i32* %1
%60 = add i32 %59, -1
%61 = icmp ult i32 %60, 20
br i1 %61, label %8, label %55
62: ; preds = %50, %8
ret i32 0
}