#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, c, s, i, j;
  scanf("%d", &n);
  int br = 0;
  br = (n - 2) * (n - 2);
  printf("%d\n", br);
  for (c = 1; c < n; c++) {
    s = n - c;
    i = 0;
    do {
      printf(" ");
      if (c == 1) {
        printf("*");
        printf("\n");
      } else {
        printf("*");
        printf("#");
        j = 2;
        do {
          printf("#");
          printf("#");
          j++;
        } while (j < c);
        printf("*");
        printf("\n");
      }
      i++;
    } while (i < s);
    for (i = 0; i < (n * 2) - 1; i++)
      printf("*");
  }
  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   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1294 <main+0x174>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    11c5 <main+0xa5>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x18(%rbp)
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11e8 <main+0xc8>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     118c <main+0x6c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1281 <main+0x161>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1251 <main+0x131>
jmp    1286 <main+0x166>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x50>
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    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0xfffffffe,%esi
imul   %esi,%esi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebx
cmp    $0x2,%ebx
jl     1260 <main+0x130>
mov    $0xffffffff,%r15d
mov    $0x1,%r13d
jmp    1191 <main+0x61>
nop
add    $0x1,%r13d
add    $0xffffffff,%r15d
cmp    %r13d,%ebx
jle    1260 <main+0x130>
cmp    $0x4,%r13d
mov    $0x3,%r14d
cmovae %r13d,%r14d
add    $0xfffffffe,%r14d
add    %r15d,%ebx
cmp    $0x2,%ebx
mov    $0x1,%eax
cmovl  %eax,%ebx
xor    %ebp,%ebp
jmp    11d1 <main+0xa1>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebx,%ebp
je     1230 <main+0x100>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r13d
je     11c0 <main+0x90>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    %r14d,%r12d
nopl   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r12d
jne    1200 <main+0xd0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jle    1180 <main+0x50>
xor    %ebp,%ebp
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%ebx
lea    (%rbx,%rbx,1),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jl     1240 <main+0x110>
jmp    1180 <main+0x50>
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 = [4 x i8] c"%d\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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %7
%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
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store i32 1, i32* %3
br label %16
16: ; preds = %66, %0
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %69
20: ; preds = %16
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %4
store i32 0, i32* %5
br label %24
24: ; preds = %49, %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %46
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %6
br label %34
34: ; preds = %39, %31
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %39
39: ; preds = %34
%40 = load i32, i32* %6
%41 = load i32, i32* %3
%42 = icmp slt i32 %40, %41
br i1 %42, label %34, label %43
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %46
46: ; preds = %43, %28
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %49
49: ; preds = %46
%50 = load i32, i32* %5
%51 = load i32, i32* %4
%52 = icmp slt i32 %50, %51
br i1 %52, label %24, label %53
53: ; preds = %49
store i32 0, i32* %5
br label %54
54: ; preds = %62, %53
%55 = load i32, i32* %5
%56 = load i32, i32* %2
%57 = mul nsw i32 %56, 2
%58 = sub nsw i32 %57, 1
%59 = icmp slt i32 %55, %58
br i1 %59, label %60, label %65
60: ; preds = %54
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %60
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %54
65: ; preds = %54
br label %66
66: ; preds = %65
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
br label %16
69: ; preds = %16
ret i32 0
}

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