#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 i, k, t, a, space;
  scanf("%d", &a);
  printf("%d \n", (a - 2) * (a - 2));
  space = a - 1;
  for (i = 0; i < a - 1; i++) {
    for (k = 0; k < space; k++) {
      printf(" ");
    }
    printf("*");
    for (t = 1; t < i * 2; t++) {
      printf("#");
    }
    if (i > 0)
      printf("*");
    space--;
    printf("\n");
  }
  for (int z = 0; z < a * 2 - 1; z++)
    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    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%esi
sub    $0x2,%esi
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
imul   %eax,%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122b <main+0x10b>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ac <main+0x8c>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1184 <main+0x64>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    11ee <main+0xce>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <main+0xa1>
cmpl   $0x0,-0x8(%rbp)
jle    1206 <main+0xe6>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116c <main+0x4c>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1262 <main+0x142>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1232 <main+0x112>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
add    $0xfffffffe,%esi
imul   %esi,%esi
lea    0xea5(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%r12d
cmp    $0x2,%r12d
jl     1217 <main+0xe7>
xor    %r15d,%r15d
jmp    11a2 <main+0x72>
nopl   0x0(%rax)
add    $0xffffffff,%r12d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
add    $0x2,%r14d
cmp    %ecx,%r15d
jge    121a <main+0xea>
cmp    $0x3,%r14d
mov    $0x2,%ebx
cmovae %r14d,%ebx
cmp    $0x2,%r12d
jl     11d2 <main+0xa2>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    11c0 <main+0x90>
mov    $0x2a,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
je     1180 <main+0x50>
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xc0>
test   %r15d,%r15d
je     1180 <main+0x50>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x50>
mov    %r12d,%eax
test   %eax,%eax
jle    123a <main+0x10a>
xor    %ebx,%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
add    %eax,%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1220 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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