#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 m, n, i, j;
  scanf("%d", &m);
  n = m;
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++)
      if (i > 0 && i < m - 1 && j > 0 && j < n - 1)
        printf("%%");
      else if (j > 0 && j < n - 1)
        printf("*");
      else
        printf("+");
    printf("\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>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121c <main+0xfc>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1202 <main+0xe2>
cmpl   $0x0,-0x10(%rbp)
jle    11b2 <main+0x92>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11b2 <main+0x92>
cmpl   $0x0,-0x14(%rbp)
jle    11b2 <main+0x92>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11b2 <main+0x92>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
cmpl   $0x0,-0x14(%rbp)
jle    11de <main+0xbe>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11de <main+0xbe>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <main+0xca>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
jmp    11f4 <main+0xd4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <main+0x3f>
lea    0xe01(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r14d
test   %r14d,%r14d
jle    11af <main+0x8f>
lea    -0x1(%r14),%r15d
xor    %ebx,%ebx
jmp    1163 <main+0x43>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jge    11af <main+0x8f>
xor    %ebp,%ebp
jmp    1190 <main+0x70>
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
setne  %al
cmp    %r15d,%ebp
setl   %cl
and    %al,%cl
movzbl %cl,%edi
xor    $0x2b,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
je     1150 <main+0x30>
test   %ebx,%ebx
je     1170 <main+0x50>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jge    1170 <main+0x50>
test   %ebp,%ebp
je     1170 <main+0x50>
mov    $0x25,%edi
cmp    %r15d,%ebp
jl     1183 <main+0x63>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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