#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 n;
  int i;
  int j;
  scanf("%d", &n);
  if (n == 1) {
    printf("+\n");
  } else {
    n = n - 2;
    printf("+");
    i = 1;
    while (i <= n) {
      printf("-");
      i = i + 1;
    }
    printf("+");
    printf("\n");
    j = 1;
    while (j <= n) {
      printf("|");
      i = 1;
      while (i <= n) {
        printf(" ");
        i = i + 1;
      }
      printf("|");
      printf("\n");
      j = j + 1;
    }
    printf("+");
    i = 1;
    while (i <= n) {
      printf("-");
      i = i + 1;
    }
    printf("+");
    printf("\n");
  }
  printf("FIM\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    115a <main+0x3a>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1277 <main+0x157>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119c <main+0x7c>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x56>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1226 <main+0x106>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1200 <main+0xe0>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11da <main+0xba>
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bb <main+0x9b>
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     125f <main+0x13f>
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1239 <main+0x119>
lea    0xda0(%rip),%rdi
call   1030 <printf@plt>
lea    0xd92(%rip),%rdi
call   1030 <printf@plt>
lea    0xd90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jne    115e <main+0x2e>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
jmp    1257 <main+0x127>
add    $0xfffffffe,%eax
mov    %eax,0x4(%rsp)
mov    $0x2b,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    1193 <main+0x63>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1180 <main+0x50>
mov    $0x2b,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    1215 <main+0xe5>
mov    $0x1,%ebx
jmp    11df <main+0xaf>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    0x4(%rsp),%ebx
mov    %eax,%ebx
jge    1215 <main+0xe5>
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    11c0 <main+0x90>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1200 <main+0xd0>
jmp    11c0 <main+0x90>
mov    $0x2b,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    1243 <main+0x113>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1230 <main+0x100>
mov    $0x2b,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xda5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [4 x i8] c"FIM\00"
@str.8 = [2 x i8] c"+\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
br label %54
8: ; preds = %0
%9 = add nsw i32 %4, -2
store i32 %9, i32* %1
%10 = call i32 @putchar(i32 43)
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
br i1 %12, label %19, label %13
13: ; preds = %8, %13
%14 = phi i32 [ %16, %13 ], [ 1, %8 ]
%15 = call i32 @putchar(i32 45)
%16 = add nuw nsw i32 %14, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %14, %17
br i1 %18, label %13, label %19
19: ; preds = %13, %8
%20 = call i32 @putchar(i32 43)
%21 = call i32 @putchar(i32 10)
%22 = load i32, i32* %1
%23 = icmp slt i32 %22, 1
br i1 %23, label %41, label %24
24: ; preds = %19, %35
%25 = phi i32 [ %38, %35 ], [ 1, %19 ]
%26 = call i32 @putchar(i32 124)
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 1
br i1 %28, label %35, label %29
29: ; preds = %24, %29
%30 = phi i32 [ %32, %29 ], [ 1, %24 ]
%31 = call i32 @putchar(i32 32)
%32 = add nuw nsw i32 %30, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %30, %33
br i1 %34, label %29, label %35
35: ; preds = %29, %24
%36 = call i32 @putchar(i32 124)
%37 = call i32 @putchar(i32 10)
%38 = add nuw nsw i32 %25, 1
%39 = load i32, i32* %1
%40 = icmp slt i32 %25, %39
br i1 %40, label %24, label %41
41: ; preds = %35, %19
%42 = call i32 @putchar(i32 43)
%43 = load i32, i32* %1
%44 = icmp slt i32 %43, 1
br i1 %44, label %51, label %45
45: ; preds = %41, %45
%46 = phi i32 [ %48, %45 ], [ 1, %41 ]
%47 = call i32 @putchar(i32 45)
%48 = add nuw nsw i32 %46, 1
%49 = load i32, i32* %1
%50 = icmp slt i32 %46, %49
br i1 %50, label %45, label %51
51: ; preds = %45, %41
%52 = call i32 @putchar(i32 43)
%53 = call i32 @putchar(i32 10)
br label %54
54: ; preds = %51, %6
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}