#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);
  for (j = 1; j <= n; j++) {
    for (i = 1; i <= n; i++)
      if (i == 1 || i == n)
        printf(j == 1 || j == n ? "+" : "|");
      else
        printf(j == 1 || j == n ? "-" : " ");
    printf("\n");
  }
  printf("FIM\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     121d <main+0xfd>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1203 <main+0xe3>
cmpl   $0x1,-0xc(%rbp)
je     117b <main+0x5b>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11b8 <main+0x98>
mov    $0x1,%al
cmpl   $0x1,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1196 <main+0x76>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
lea    0xe65(%rip),%rdi
lea    0xe5c(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdi
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
mov    $0x1,%al
cmpl   $0x1,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     11d3 <main+0xb3>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%cl
lea    0xe2c(%rip),%rdi
lea    0xe23(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x39>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11eb <main+0xab>
mov    $0x1,%ebp
lea    0xe8f(%rip),%r14
lea    0xe8a(%rip),%r15
lea    0xe85(%rip),%r12
lea    0xe80(%rip),%r13
jmp    11a7 <main+0x67>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ecx
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    11eb <main+0xab>
test   %eax,%eax
jle    1190 <main+0x50>
xor    %ecx,%ecx
nopl   (%rax)
cmp    $0x1,%ebp
sete   %dl
cmp    %eax,%ebp
sete   %bl
or     %dl,%bl
mov    %r15,%rdx
cmovne %r14,%rdx
mov    %r13,%rdi
cmovne %r12,%rdi
lea    0x1(%rcx),%ebx
cmp    %eax,%ebx
cmove  %rdx,%rdi
test   %ecx,%ecx
cmove  %rdx,%rdi
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
mov    %ebx,%ecx
cmp    %eax,%ebx
jl     11b0 <main+0x70>
jmp    1190 <main+0x50>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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