#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, sp, i, cur, diez;
  scanf("%d", &n);
  printf("%d\n", (n - 2) * (n - 2));
  for (cur = 1; cur <= n; cur++) {
    for (i = 1, sp = n - cur; i <= sp; i++) {
      printf(" ");
    }
    printf("*");
    if (cur >= 2) {
      if (cur == n)
        for (i = 0, diez = 2 * cur - 3; i != diez; i++)
          printf("*");
      else if (cur >= 2)
        for (i = 0, diez = 2 * cur - 3; i != diez; i++)
          printf("#");
      printf("*");
    }
    printf("\n");
  }
}


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),%esi
sub    $0x2,%esi
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
imul   %eax,%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1284 <main+0x164>
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11a7 <main+0x87>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117f <main+0x5f>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jl     1268 <main+0x148>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    120b <main+0xeb>
movl   $0x0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
sub    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1206 <main+0xe6>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11de <main+0xbe>
jmp    125a <main+0x13a>
cmpl   $0x2,-0x14(%rbp)
jl     1255 <main+0x135>
movl   $0x0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
sub    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1250 <main+0x130>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1228 <main+0x108>
jmp    1255 <main+0x135>
jmp    125a <main+0x13a>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <main+0x43>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
add    $0xfffffffe,%esi
imul   %esi,%esi
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    1214 <main+0xe4>
mov    $0x1,%ebx
mov    $0xffffffff,%r14d
jmp    11a5 <main+0x75>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
mov    0xc(%rsp),%ebp
add    $0x2,%r14d
cmp    %ebx,%ebp
mov    %eax,%ebx
jle    1214 <main+0xe4>
cmp    %ebx,%ebp
jle    11c1 <main+0x91>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    11b0 <main+0x80>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
jb     118a <main+0x5a>
mov    %r14d,%ebp
cmp    0xc(%rsp),%ebx
jne    1200 <main+0xd0>
mov    %r14d,%ebp
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0xb0>
jmp    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0xd0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
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"#\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 2
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 2
%12 = mul nsw i32 %9, %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 1, i32* %5
br label %14
14: ; preds = %75, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %78
18: ; preds = %14
store i32 1, i32* %4
%19 = load i32, i32* %2
%20 = load i32, i32* %5
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %3
br label %22
22: ; preds = %28, %18
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %22
31: ; preds = %22
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32, i32* %5
%34 = icmp sge i32 %33, 2
br i1 %34, label %35, label %73
35: ; preds = %31
%36 = load i32, i32* %5
%37 = load i32, i32* %2
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %53
39: ; preds = %35
store i32 0, i32* %4
%40 = load i32, i32* %5
%41 = mul nsw i32 2, %40
%42 = sub nsw i32 %41, 3
store i32 %42, i32* %6
br label %43
43: ; preds = %49, %39
%44 = load i32, i32* %4
%45 = load i32, i32* %6
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %52
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %47
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %43
52: ; preds = %43
br label %71
53: ; preds = %35
%54 = load i32, i32* %5
%55 = icmp sge i32 %54, 2
br i1 %55, label %56, label %70
56: ; preds = %53
store i32 0, i32* %4
%57 = load i32, i32* %5
%58 = mul nsw i32 2, %57
%59 = sub nsw i32 %58, 3
store i32 %59, i32* %6
br label %60
60: ; preds = %66, %56
%61 = load i32, i32* %4
%62 = load i32, i32* %6
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %69
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %64
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %60
69: ; preds = %60
br label %70
70: ; preds = %69, %53
br label %71
71: ; preds = %70, %52
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %73
73: ; preds = %71, %31
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %75
75: ; preds = %73
%76 = load i32, i32* %5
%77 = add nsw i32 %76, 1
store i32 %77, i32* %5
br label %14
78: ; preds = %14
%79 = load i32, i32* %1
ret i32 %79
}

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 slt i32 %8, 1
br i1 %9, label %48, label %10
10: ; preds = %0, %42
%11 = phi i32 [ %47, %42 ], [ 0, %0 ]
%12 = phi i32 [ %45, %42 ], [ %8, %0 ]
%13 = phi i32 [ %44, %42 ], [ 1, %0 ]
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = add i32 %12, %11
br label %17
17: ; preds = %15, %17
%18 = phi i32 [ %20, %17 ], [ 1, %15 ]
%19 = call i32 @putchar(i32 32)
%20 = add nuw i32 %18, 1
%21 = icmp eq i32 %20, %16
br i1 %21, label %22, label %17
22: ; preds = %17, %10
%23 = call i32 @putchar(i32 42)
%24 = icmp ugt i32 %13, 1
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load i32, i32* %1
%27 = icmp eq i32 %13, %26
%28 = shl nuw nsw i32 %13, 1
%29 = add nsw i32 %28, -3
br i1 %27, label %30, label %35
30: ; preds = %25, %30
%31 = phi i32 [ %33, %30 ], [ 0, %25 ]
%32 = call i32 @putchar(i32 42)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %33, %29
br i1 %34, label %40, label %30
35: ; preds = %25, %35
%36 = phi i32 [ %38, %35 ], [ 0, %25 ]
%37 = call i32 @putchar(i32 35)
%38 = add nuw nsw i32 %36, 1
%39 = icmp eq i32 %38, %29
br i1 %39, label %40, label %35
40: ; preds = %35, %30
%41 = call i32 @putchar(i32 42)
br label %42
42: ; preds = %40, %22
%43 = call i32 @putchar(i32 10)
%44 = add nuw nsw i32 %13, 1
%45 = load i32, i32* %1
%46 = icmp sgt i32 %45, %13
%47 = add i32 %11, -1
br i1 %46, label %10, label %48
48: ; preds = %42, %0
ret i32 0
}