#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 m, r = 0, s, x;
  scanf("%d", &m);
  s = m - 2;
  printf("%d", s * s);
  s = m;
  while (r <= m) {
    r++;
    s--;
    printf("\n");
    for (x = s; x >= 1; x--)
      printf(" ");
    if (r == 1)
      printf("*");
    else if (r == m) {
      for (x = m * 2 - 1; x >= 1; x--)
        printf("*");
      break;
    } else {
      printf("*");
      r--;
      for (x = r * 2 - 1; x >= 1; x--)
        printf("#");
      r++;
      printf("*");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     128c <main+0x16c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     11c2 <main+0xa2>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    119c <main+0x7c>
cmpl   $0x1,-0xc(%rbp)
jne    11df <main+0xbf>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <main+0x167>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1222 <main+0x102>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     121d <main+0xfd>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11f7 <main+0xd7>
jmp    128c <main+0x16c>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     126b <main+0x14b>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1245 <main+0x125>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <main+0x167>
jmp    116a <main+0x4a>
mov    -0x4(%rbp),%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),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0xfffffffe,%esi
imul   %esi,%esi
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jns    1191 <main+0x61>
jmp    1232 <main+0x102>
nop
mov    $0x1,%r15d
add    $0xffffffff,%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %r15d,%r14d
cmp    0x4(%rsp),%r15d
jg     1232 <main+0x102>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
jl     11c2 <main+0x92>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11b0 <main+0x80>
test   %r14d,%r14d
je     1170 <main+0x40>
lea    0x1(%r14),%r15d
cmp    0x4(%rsp),%r15d
je     1207 <main+0xd7>
mov    $0x2a,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1176 <main+0x46>
lea    (%r14,%r14,1),%ebp
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
jg     11f0 <main+0xc0>
jmp    1176 <main+0x46>
test   %r14d,%r14d
js     1232 <main+0x102>
lea    (%r15,%r15,1),%ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jg     1220 <main+0xf0>
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 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"#\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 2
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %2
store i32 %13, i32* %4
br label %14
14: ; preds = %75, %0
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %76
18: ; preds = %14
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* %4
store i32 %24, i32* %5
br label %25
25: ; preds = %30, %18
%26 = load i32, i32* %5
%27 = icmp sge i32 %26, 1
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %5
%32 = add nsw i32 %31, -1
store i32 %32, i32* %5
br label %25
33: ; preds = %25
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %75
38: ; preds = %33
%39 = load i32, i32* %3
%40 = load i32, i32* %2
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = load i32, i32* %2
%44 = mul nsw i32 %43, 2
%45 = sub nsw i32 %44, 1
store i32 %45, i32* %5
br label %46
46: ; preds = %51, %42
%47 = load i32, i32* %5
%48 = icmp sge i32 %47, 1
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49
%52 = load i32, i32* %5
%53 = add nsw i32 %52, -1
store i32 %53, i32* %5
br label %46
54: ; preds = %46
br label %76
55: ; preds = %38
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = load i32, i32* %3
%58 = add nsw i32 %57, -1
store i32 %58, i32* %3
%59 = load i32, i32* %3
%60 = mul nsw i32 %59, 2
%61 = sub nsw i32 %60, 1
store i32 %61, i32* %5
br label %62
62: ; preds = %67, %55
%63 = load i32, i32* %5
%64 = icmp sge i32 %63, 1
br i1 %64, label %65, label %70
65: ; preds = %62
%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 %62
70: ; preds = %62
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 1
store i32 %72, i32* %3
%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 = %70
br label %75
75: ; preds = %74, %36
br label %14
76: ; preds = %54, %14
%77 = load i32, i32* %1
ret i32 %77
}

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