#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main(void) {
  unsigned int lato = 0;
  unsigned int righe;
  unsigned int colonne;
  unsigned int valoreSentinella = 0;
  do {
    printf("Inserire il lato del quadrtato: ");
    scanf("%u", &lato);
    lato++;
    if (--lato > (unsigned int)1) {
      if (--lato < (unsigned int)20) {
        valoreSentinella = 1;
        righe = 0;
        while (righe <= lato) {
          colonne = 0;
          while (colonne <= lato) {
            if (righe == 0) {
              printf("%s", "*");
            } else if (righe == lato) {
              printf("%s", "*");
            } else if (colonne == 0) {
              printf("%s", "*");
            } else if (colonne == lato) {
              printf("%s", "*");
            } else
              printf("%s", " ");
            colonne++;
          }
          puts("");
          righe++;
        }
      }
    }
  } while (valoreSentinella != 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   $0x0,-0x14(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x1,%eax
jbe    12af <main+0x17f>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x14,%eax
jae    12aa <main+0x17a>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     12a5 <main+0x175>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     128b <main+0x15b>
cmpl   $0x0,-0xc(%rbp)
jne    11e9 <main+0xb9>
lea    0xe4e(%rip),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127d <main+0x14d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    120f <main+0xdf>
lea    0xe28(%rip),%rdi
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1278 <main+0x148>
cmpl   $0x0,-0x10(%rbp)
jne    1233 <main+0x103>
lea    0xe04(%rip),%rdi
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1259 <main+0x129>
lea    0xdde(%rip),%rdi
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126e <main+0x13e>
lea    0xdc4(%rip),%rdi
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
jmp    1278 <main+0x148>
jmp    127d <main+0x14d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b9 <main+0x89>
lea    0xd8e(%rip),%rdi
call   1030 <puts@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x76>
jmp    12aa <main+0x17a>
jmp    12af <main+0x17f>
jmp    12b4 <main+0x184>
cmpl   $0x1,-0x14(%rbp)
jne    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeba(%rip),%r14
lea    0xed4(%rip),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jb     1160 <main+0x30>
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
cmp    $0x13,%eax
ja     1160 <main+0x30>
xor    %ebx,%ebx
jmp    11a5 <main+0x75>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
ja     11e4 <main+0xb4>
xor    %ebp,%ebp
jmp    11cf <main+0x9f>
nopl   0x0(%rax)
test   %ebp,%ebp
cmove  %ecx,%edi
cmp    %eax,%ebx
cmove  %ecx,%edi
test   %ebx,%ebx
cmove  %ecx,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
ja     1190 <main+0x60>
mov    $0x2a,%ecx
mov    $0x2a,%edi
cmp    %eax,%ebp
je     11b0 <main+0x80>
mov    $0x20,%edi
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Inserire il lato del quadrtato: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [1 x i8] zeroinitializer
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 0, i32* %5
br label %6
6: ; preds = %65, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = add i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = add i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ugt i32 %12, 1
br i1 %13, label %14, label %64
14: ; preds = %6
%15 = load i32, i32* %2
%16 = add i32 %15, -1
store i32 %16, i32* %2
%17 = icmp ult i32 %16, 20
br i1 %17, label %18, label %63
18: ; preds = %14
store i32 1, i32* %5
store i32 0, i32* %3
br label %19
19: ; preds = %58, %18
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = icmp ule i32 %20, %21
br i1 %22, label %23, label %62
23: ; preds = %19
store i32 0, i32* %4
br label %24
24: ; preds = %55, %23
%25 = load i32, i32* %4
%26 = load i32, i32* %2
%27 = icmp ule i32 %25, %26
br i1 %27, label %28, label %58
28: ; preds = %24
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %55
33: ; preds = %28
%34 = load i32, i32* %3
%35 = load i32, i32* %2
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %54
39: ; preds = %33
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %53
44: ; preds = %39
%45 = load i32, i32* %4
%46 = load i32, i32* %2
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %52
50: ; preds = %44
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52, %42
br label %54
54: ; preds = %53, %37
br label %55
55: ; preds = %54, %31
%56 = load i32, i32* %4
%57 = add i32 %56, 1
store i32 %57, i32* %4
br label %24
58: ; preds = %24
%59 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* %3
%61 = add i32 %60, 1
store i32 %61, i32* %3
br label %19
62: ; preds = %19
br label %63
63: ; preds = %62, %14
br label %64
64: ; preds = %63, %6
br label %65
65: ; preds = %64
%66 = load i32, i32* %5
%67 = icmp ne i32 %66, 1
br i1 %67, label %6, label %68
68: ; preds = %65
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Inserire il lato del quadrtato: \00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %11, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ugt i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = add i32 %6, -1
store i32 %9, i32* %1
%10 = icmp ult i32 %9, 20
br i1 %10, label %12, label %11
11: ; preds = %8, %3
br label %3
12: ; preds = %8, %30
%13 = phi i32 [ %33, %30 ], [ %9, %8 ]
%14 = phi i32 [ %32, %30 ], [ 0, %8 ]
%15 = icmp eq i32 %14, 0
br label %16
16: ; preds = %12, %16
%17 = phi i32 [ %13, %12 ], [ %28, %16 ]
%18 = phi i32 [ 0, %12 ], [ %27, %16 ]
%19 = icmp eq i32 %14, %17
%20 = select i1 %15, i1 true, i1 %19
%21 = icmp eq i32 %18, 0
%22 = select i1 %20, i1 true, i1 %21
%23 = icmp eq i32 %18, %17
%24 = select i1 %22, i1 true, i1 %23
%25 = select i1 %24, i32 42, i32 32
%26 = call i32 @putchar(i32 %25)
%27 = add i32 %18, 1
%28 = load i32, i32* %1
%29 = icmp ugt i32 %27, %28
br i1 %29, label %30, label %16
30: ; preds = %16
%31 = call i32 @putchar(i32 10)
%32 = add i32 %14, 1
%33 = load i32, i32* %1
%34 = icmp ugt i32 %32, %33
br i1 %34, label %35, label %12
35: ; preds = %30
ret i32 0
}