#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 = 0, j = 1, c;
  char symb1 = '*', symb2 = '#';
  scanf("%d", &n);
  printf("%d\n", (n - 2) * (n - 2));
  while (n > 0) {
    for (c = 0; c < n; c++)
      printf(" ");
    if (j == 1) {
      printf("%c\n", symb1);
      j++;
      i++;
    } else if (n == 1) {
      for (c = 0; c <= j; c++)
        printf("%c", symb1);
    } else {
      printf("%c", symb1);
      for (c = 0; c < i; c++)
        printf("%c", symb2);
      printf("%c\n", symb1);
      j = j + 2;
      i = i + 2;
    }
    n--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movb   $0x2a,-0x15(%rbp)
movb   $0x23,-0x16(%rbp)
lea    0xeb4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
sub    $0x2,%esi
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
imul   %eax,%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    129c <main+0x17c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ab <main+0x8b>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <main+0x63>
cmpl   $0x1,-0x10(%rbp)
jne    11de <main+0xbe>
movsbl -0x15(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    128e <main+0x16e>
cmpl   $0x1,-0x8(%rbp)
jne    1220 <main+0x100>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     121b <main+0xfb>
movsbl -0x15(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ef <main+0xcf>
jmp    1289 <main+0x169>
movsbl -0x15(%rbp),%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1265 <main+0x145>
movsbl -0x16(%rbp),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1239 <main+0x119>
movsbl -0x15(%rbp),%esi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    128e <main+0x16e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <main+0x52>
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    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0xfffffffe,%esi
imul   %esi,%esi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    124a <main+0x11a>
mov    $0x1,%ebx
lea    0xe90(%rip),%r14
xor    %r15d,%r15d
jmp    11ac <main+0x7c>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x2a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
mov    $0x2,%ebx
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jle    124a <main+0x11a>
xor    %ebp,%ebp
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jl     11b0 <main+0x80>
cmp    $0x1,%ebx
je     1180 <main+0x50>
cmp    $0x1,%eax
jne    1200 <main+0xd0>
test   %ebx,%ebx
js     1198 <main+0x68>
mov    $0xffffffff,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11e0 <main+0xb0>
jmp    1198 <main+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
jle    122f <main+0xff>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0xf0>
mov    %r14,%rdi
mov    $0x2a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebx
add    $0x2,%r15d
jmp    1198 <main+0x68>
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 = [4 x i8] c"%d\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"%c\0A\00"
@.str.4 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %4
store i8 42, i8* %6
store i8 35, i8* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 2
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 2
%13 = mul nsw i32 %10, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %79, %0
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %82
18: ; preds = %15
store i32 0, i32* %5
br label %19
19: ; preds = %25, %18
%20 = load i32, i32* %5
%21 = load i32, i32* %2
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %19
28: ; preds = %19
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %79
39: ; preds = %28
%40 = load i32, i32* %2
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %55
42: ; preds = %39
store i32 0, i32* %5
br label %43
43: ; preds = %51, %42
%44 = load i32, i32* %5
%45 = load i32, i32* %4
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %54
47: ; preds = %43
%48 = load i8, i8* %6
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %47
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %43
54: ; preds = %43
br label %78
55: ; preds = %39
%56 = load i8, i8* %6
%57 = sext i8 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %57)
store i32 0, i32* %5
br label %59
59: ; preds = %67, %55
%60 = load i32, i32* %5
%61 = load i32, i32* %3
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %70
63: ; preds = %59
%64 = load i8, i8* %7
%65 = sext i8 %64 to i32
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %63
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %59
70: ; preds = %59
%71 = load i8, i8* %6
%72 = sext i8 %71 to i32
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %4
%75 = add nsw i32 %74, 2
store i32 %75, i32* %4
%76 = load i32, i32* %3
%77 = add nsw i32 %76, 2
store i32 %77, i32* %3
br label %78
78: ; preds = %70, %54
br label %79
79: ; preds = %78, %31
%80 = load i32, i32* %2
%81 = add nsw i32 %80, -1
store i32 %81, i32* %2
br label %15
82: ; preds = %15
ret i32 0
}

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