#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 NumOfRows, row, colSpace, i, broi, diez;
  scanf("%d", &NumOfRows);
  broi = (NumOfRows - 2) * (NumOfRows - 2);
  printf("%d\n", broi);
  for (row = 1; row <= NumOfRows; row++) {
    for (colSpace = NumOfRows - row; colSpace >= 1; colSpace--) {
      printf(" ");
    }
    printf("*");
    if (row >= 2) {
      if (row == NumOfRows)
        for (i = 0, diez = (2 * row) - 3; i < diez; i++) {
          printf("*");
        }
      else if (row >= 2)
        for (i = 0, diez = (2 * row) - 3; i < diez; i++) {
          printf("#");
        }
      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
sub    $0x2,%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
imul   %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1281 <main+0x161>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     11a4 <main+0x84>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    117e <main+0x5e>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0xc(%rbp)
jl     1265 <main+0x145>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1208 <main+0xe8>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1203 <main+0xe3>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11db <main+0xbb>
jmp    1257 <main+0x137>
cmpl   $0x2,-0xc(%rbp)
jl     1252 <main+0x132>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    124d <main+0x12d>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1225 <main+0x105>
jmp    1252 <main+0x132>
jmp    1257 <main+0x137>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <main+0x49>
xor    %eax,%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),%ebp
test   %ebp,%ebp
jle    1244 <main+0x114>
mov    $0x1,%r15d
mov    $0xffffffff,%r12d
jmp    11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
mov    0xc(%rsp),%ebp
add    $0x2,%r12d
add    $0xffffffff,%r14d
cmp    %r15d,%ebp
mov    %eax,%r15d
jle    1244 <main+0x114>
cmp    $0x2,%r12d
mov    $0x1,%ebx
cmovge %r12d,%ebx
cmp    %r15d,%ebp
jle    11f2 <main+0xc2>
add    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11e0 <main+0xb0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    $0x2,%r15d
jb     119a <main+0x6a>
cmp    0xc(%rsp),%r15d
jne    1230 <main+0x100>
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1210 <main+0xe0>
jmp    1190 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1230 <main+0x100>
jmp    1190 <main+0x60>
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 = [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
%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)
%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* %6
%14 = load i32, i32* %6
%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 = %76, %0
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %79
20: ; preds = %16
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %4
br label %24
24: ; preds = %29, %20
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 1
br i1 %26, label %27, label %32
27: ; preds = %24
%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* %4
%31 = add nsw i32 %30, -1
store i32 %31, i32* %4
br label %24
32: ; preds = %24
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* %3
%35 = icmp sge i32 %34, 2
br i1 %35, label %36, label %74
36: ; preds = %32
%37 = load i32, i32* %3
%38 = load i32, i32* %2
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %54
40: ; preds = %36
store i32 0, i32* %5
%41 = load i32, i32* %3
%42 = mul nsw i32 2, %41
%43 = sub nsw i32 %42, 3
store i32 %43, i32* %7
br label %44
44: ; preds = %50, %40
%45 = load i32, i32* %5
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %44
53: ; preds = %44
br label %72
54: ; preds = %36
%55 = load i32, i32* %3
%56 = icmp sge i32 %55, 2
br i1 %56, label %57, label %71
57: ; preds = %54
store i32 0, i32* %5
%58 = load i32, i32* %3
%59 = mul nsw i32 2, %58
%60 = sub nsw i32 %59, 3
store i32 %60, i32* %7
br label %61
61: ; preds = %67, %57
%62 = load i32, i32* %5
%63 = load i32, i32* %7
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %70
65: ; preds = %61
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %67
67: ; preds = %65
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %61
70: ; preds = %61
br label %71
71: ; preds = %70, %54
br label %72
72: ; preds = %71, %53
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %74
74: ; preds = %72, %32
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74
%77 = load i32, i32* %3
%78 = add nsw i32 %77, 1
store i32 %78, i32* %3
br label %16
79: ; 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 slt i32 %8, 1
br i1 %9, label %46, label %10
10: ; preds = %0, %40
%11 = phi i32 [ %45, %40 ], [ -1, %0 ]
%12 = phi i32 [ %43, %40 ], [ %8, %0 ]
%13 = phi i32 [ %42, %40 ], [ 1, %0 ]
%14 = call i32 @llvm.smax.i32(i32 %11, i32 1)
%15 = sub nsw i32 %12, %13
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %10, %17
%18 = phi i32 [ %20, %17 ], [ %15, %10 ]
%19 = call i32 @putchar(i32 32)
%20 = add nsw i32 %18, -1
%21 = icmp ugt i32 %18, 1
br i1 %21, label %17, label %22
22: ; preds = %17, %10
%23 = call i32 @putchar(i32 42)
%24 = icmp ugt i32 %13, 1
br i1 %24, label %25, label %40
25: ; preds = %22
%26 = load i32, i32* %1
%27 = icmp eq i32 %13, %26
br i1 %27, label %28, label %33
28: ; preds = %25, %28
%29 = phi i32 [ %31, %28 ], [ 0, %25 ]
%30 = call i32 @putchar(i32 42)
%31 = add nuw nsw i32 %29, 1
%32 = icmp eq i32 %31, %14
br i1 %32, label %38, label %28
33: ; preds = %25, %33
%34 = phi i32 [ %36, %33 ], [ 0, %25 ]
%35 = call i32 @putchar(i32 35)
%36 = add nuw nsw i32 %34, 1
%37 = icmp eq i32 %36, %14
br i1 %37, label %38, label %33
38: ; preds = %33, %28
%39 = call i32 @putchar(i32 42)
br label %40
40: ; preds = %38, %22
%41 = call i32 @putchar(i32 10)
%42 = add nuw nsw i32 %13, 1
%43 = load i32, i32* %1
%44 = icmp sgt i32 %43, %13
%45 = add i32 %11, 2
br i1 %44, label %10, label %46
46: ; preds = %40, %0
ret i32 0
}