#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 n;
  int cont;
  int i;
  do {
    printf("Inserisci lato tra 2 e 20:");
    scanf("%d", &n);
  } while (n < 2 || n > 20);
  cont = 0;
  while (cont < n) {
    printf("*");
    i = 0;
    while (i < (n - 1)) {
      if ((cont = 0) || (cont = n - 1)) {
        printf(" ");
      } else {
        printf("*");
      }
      i++;
    }
    printf("\n");
    cont++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     1164 <main+0x44>
cmpl   $0x14,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120e <main+0xee>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f4 <main+0xd4>
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11c9 <main+0xa9>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     11da <main+0xba>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    11e6 <main+0xc6>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1195 <main+0x75>
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x56>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%r14
lea    0xed6(%rip),%r15
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffeb,%eax
cmp    $0xffffffed,%eax
jb     1150 <main+0x20>
xor    %ebx,%ebx
jmp    1193 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jge    11d5 <main+0xa5>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jl     1180 <main+0x50>
add    $0xffffffff,%eax
xor    %ebp,%ebp
jmp    11c3 <main+0x93>
nopl   (%rax)
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jge    1180 <main+0x50>
mov    %eax,%ebx
mov    $0x2a,%edi
test   %eax,%eax
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 = [27 x i8] c"Inserisci lato tra 2 e 20:\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
br label %5
5: ; preds = %14, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 2
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 20
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %5, label %16
16: ; preds = %14
store i32 0, i32* %3
br label %17
17: ; preds = %40, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %44
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %23
23: ; preds = %37, %21
%24 = load i32, i32* %4
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 1
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %40
28: ; preds = %23
store i32 0, i32* %3
br i1 false, label %33, label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %3
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29, %28
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
35: ; preds = %29
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %23
40: ; preds = %23
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %17
44: ; preds = %17
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [27 x i8] c"Inserisci lato tra 2 e 20:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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 = add i32 %6, -21
%8 = icmp ult i32 %7, -19
br i1 %8, label %3, label %9
9: ; preds = %3, %26
%10 = phi i32 [ %29, %26 ], [ 0, %3 ]
%11 = call i32 @putchar(i32 42)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = add nsw i32 %12, -1
br label %16
16: ; preds = %14, %16
%17 = phi i32 [ %24, %16 ], [ %15, %14 ]
%18 = phi i32 [ %22, %16 ], [ 0, %14 ]
%19 = icmp eq i32 %17, 0
%20 = select i1 %19, i32 42, i32 32
%21 = call i32 @putchar(i32 %20)
%22 = add nuw nsw i32 %18, 1
%23 = load i32, i32* %1
%24 = add nsw i32 %23, -1
%25 = icmp slt i32 %22, %24
br i1 %25, label %16, label %26
26: ; preds = %16, %9
%27 = phi i32 [ %10, %9 ], [ %17, %16 ]
%28 = call i32 @putchar(i32 10)
%29 = add nsw i32 %27, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
br i1 %31, label %9, label %32
32: ; preds = %26
ret i32 0
}