#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, i, j;
  printf("Digite a quantidade de caracterers:\n");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    printf("*");
  }
  printf("\n");
  for (j = 1; j <= (n - 2); j++) {
    printf("*");
    for (i = 1; i <= n - 2; i++) {
      printf(" ");
    }
    printf("*\n");
  }
  for (i = 1; i <= n; i++) {
    printf("*");
  }
  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    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1178 <main+0x58>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x32>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11f4 <main+0xd4>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11da <main+0xba>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11af <main+0x8f>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118b <main+0x6b>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1221 <main+0x101>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fb <main+0xdb>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1173 <main+0x43>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
jge    11ae <main+0x7e>
test   %eax,%eax
jle    11a3 <main+0x73>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1190 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%ebx
lea    0xe6d(%rip),%r14
jmp    11d8 <main+0xa8>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
lea    -0x2(%rax),%edx
cmp    %edx,%ebx
mov    %ecx,%ebx
jge    1186 <main+0x56>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmpl   $0x3,0xc(%rsp)
jl     11c0 <main+0x90>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffe,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     11f0 <main+0xc0>
jmp    11c0 <main+0x90>

LLVM IR (-O0):
@.str = [37 x i8] c"Digite a quantidade de caracterers:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [3 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 ([37 x i8], [37 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)
store i32 1, i32* %3
br label %7
7: ; preds = %13, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %7
16: ; preds = %7
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %4
br label %18
18: ; preds = %37, %16
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 2
%22 = icmp sle i32 %19, %21
br i1 %22, label %23, label %40
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %25
25: ; preds = %32, %23
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 2
%29 = icmp sle i32 %26, %28
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %25
35: ; preds = %25
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %18
40: ; preds = %18
store i32 1, i32* %3
br label %41
41: ; preds = %47, %40
%42 = load i32, i32* %3
%43 = load i32, i32* %2
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %41
50: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [36 x i8] c"Digite a quantidade de caracterers:\00"
@str.6 = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 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 slt i32 %5, 1
br i1 %6, label %13, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %10, %7 ], [ 1, %0 ]
%9 = call i32 @putchar(i32 42)
%10 = add nuw nsw i32 %8, 1
%11 = load i32, i32* %1
%12 = icmp slt i32 %8, %11
br i1 %12, label %7, label %13
13: ; preds = %7, %0
%14 = call i32 @putchar(i32 10)
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %20
17: ; preds = %32, %13
%18 = phi i32 [ %15, %13 ], [ %35, %32 ]
%19 = icmp slt i32 %18, 1
br i1 %19, label %44, label %38
20: ; preds = %13, %32
%21 = phi i32 [ %34, %32 ], [ 1, %13 ]
%22 = call i32 @putchar(i32 42)
%23 = load i32, i32* %1
%24 = icmp slt i32 %23, 3
br i1 %24, label %32, label %25
25: ; preds = %20, %25
%26 = phi i32 [ %28, %25 ], [ 1, %20 ]
%27 = call i32 @putchar(i32 32)
%28 = add nuw nsw i32 %26, 1
%29 = load i32, i32* %1
%30 = add nsw i32 %29, -2
%31 = icmp slt i32 %26, %30
br i1 %31, label %25, label %32
32: ; preds = %25, %20
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%34 = add nuw nsw i32 %21, 1
%35 = load i32, i32* %1
%36 = add nsw i32 %35, -2
%37 = icmp slt i32 %21, %36
br i1 %37, label %20, label %17
38: ; preds = %17, %38
%39 = phi i32 [ %41, %38 ], [ 1, %17 ]
%40 = call i32 @putchar(i32 42)
%41 = add nuw nsw i32 %39, 1
%42 = load i32, i32* %1
%43 = icmp slt i32 %39, %42
br i1 %43, label %38, label %44
44: ; preds = %38, %17
ret i32 0
}