#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, row, column;
  printf("Ingrese un numero, entre el 1 y el 50: ");
  scanf("%d", &n);
  if (n < 1 || n > 50) {
    printf("No entra dentro del rango.\n");
    return -1;
  }
  for (column = 0; column < n; column++) {
    for (row = 0; row < n; row++) {
      if (column == 0 || column == (n - 1))
        printf("*");
      else if (row == 0 || row == (n - 1))
        printf("*");
      else
        printf(" ");
    }
    printf("\n");
  }
}


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    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     115f <main+0x3f>
cmpl   $0x32,-0x8(%rbp)
jle    1177 <main+0x57>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1233 <main+0x113>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1233 <main+0x113>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1219 <main+0xf9>
cmpl   $0x0,-0x10(%rbp)
je     11b8 <main+0x98>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11c9 <main+0xa9>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
cmpl   $0x0,-0xc(%rbp)
je     11e4 <main+0xc4>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11f5 <main+0xd5>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    1201 <main+0xe1>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
jmp    120b <main+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1191 <main+0x71>
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117e <main+0x5e>
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 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x33(%rax),%ecx
cmp    $0xffffffce,%ecx
jae    117f <main+0x3f>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    11ec <main+0xac>
xor    %ebx,%ebx
jmp    11a5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    11ea <main+0xaa>
test   %eax,%eax
jle    1190 <main+0x50>
xor    %ebp,%ebp
jmp    11c5 <main+0x85>
nopl   (%rax)
test   %ebp,%ebp
cmove  %ecx,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jge    1190 <main+0x50>
mov    $0x2a,%edi
test   %ebx,%ebx
je     11b5 <main+0x75>
add    $0xffffffff,%eax
cmp    %eax,%ebx
je     11b5 <main+0x75>
mov    $0x2a,%ecx
mov    $0x2a,%edi
cmp    %eax,%ebp
je     11b0 <main+0x70>
mov    $0x20,%edi
jmp    11b0 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [40 x i8] c"Ingrese un numero, entre el 1 y el 50: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"No entra dentro del rango.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 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 = add i32 %5, -51
%7 = icmp ult i32 %6, -50
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %38
10: ; preds = %0, %33
%11 = phi i32 [ %36, %33 ], [ %5, %0 ]
%12 = phi i32 [ %35, %33 ], [ 0, %0 ]
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %33
14: ; preds = %10
%15 = icmp eq i32 %12, 0
br label %16
16: ; preds = %14, %27
%17 = phi i32 [ %11, %14 ], [ %31, %27 ]
%18 = phi i32 [ 0, %14 ], [ %30, %27 ]
br i1 %15, label %27, label %19
19: ; preds = %16
%20 = add nsw i32 %17, -1
%21 = icmp eq i32 %12, %20
br i1 %21, label %27, label %22
22: ; preds = %19
%23 = icmp eq i32 %18, 0
%24 = icmp eq i32 %18, %20
%25 = select i1 %23, i1 true, i1 %24
%26 = select i1 %25, i32 42, i32 32
br label %27
27: ; preds = %22, %16, %19
%28 = phi i32 [ 42, %19 ], [ 42, %16 ], [ %26, %22 ]
%29 = call i32 @putchar(i32 %28)
%30 = add nuw nsw i32 %18, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %30, %31
br i1 %32, label %16, label %33
33: ; preds = %27, %10
%34 = call i32 @putchar(i32 10)
%35 = add nuw nsw i32 %12, 1
%36 = load i32, i32* %1
%37 = icmp slt i32 %35, %36
br i1 %37, label %10, label %38
38: ; preds = %33, %8
%39 = phi i32 [ -1, %8 ], [ 0, %33 ]
ret i32 %39
}