#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 a, b, c = 1, g, j, t, n = 1, l, p = 0;
  scanf("%d", &l);
  if (a < 3) {
    n = 0;
  } else {
    for (b = 1; b <= a - 2; b++) {
      l = n;
      while (l > 0) {
        p++;
        l--;
      }
      n = n + 2;
    }
  }
  printf("%d\n", p);
  j = a - 1;
  for (b = 1; b <= a; b++) {
    g = c;
    t = j;
    while (t > 0) {
      printf(" ");
      t--;
    }
    while (g > 0) {
      if (b != a) {
        if (g == c || g == 1) {
          printf("*");
        } else {
          printf("#");
        }
      } else {
        printf("*");
      }
      g--;
    }
    printf("\n");
    j--;
    c = c + 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x3,-0x8(%rbp)
jge    116a <main+0x4a>
movl   $0x0,-0x20(%rbp)
jmp    11c5 <main+0xa5>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11c0 <main+0xa0>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11a9 <main+0x89>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1188 <main+0x68>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <main+0x51>
jmp    11c5 <main+0xa5>
mov    -0x28(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12c5 <main+0x1a5>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1224 <main+0x104>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11fe <main+0xde>
jmp    1229 <main+0x109>
cmpl   $0x0,-0x14(%rbp)
jle    1297 <main+0x177>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     127b <main+0x15b>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1255 <main+0x135>
cmpl   $0x1,-0x14(%rbp)
jne    1268 <main+0x148>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1276 <main+0x156>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1289 <main+0x169>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1229 <main+0x109>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e6 <main+0xc6>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>

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
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
store i32 1, i32* %8
store i32 0, i32* %10
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %15
14: ; preds = %0
store i32 0, i32* %8
br label %38
15: ; preds = %0
store i32 1, i32* %3
br label %16
16: ; preds = %34, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 2
%20 = icmp sle i32 %17, %19
br i1 %20, label %21, label %37
21: ; preds = %16
%22 = load i32, i32* %8
store i32 %22, i32* %9
br label %23
23: ; preds = %26, %21
%24 = load i32, i32* %9
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %10
%28 = add nsw i32 %27, 1
store i32 %28, i32* %10
%29 = load i32, i32* %9
%30 = add nsw i32 %29, -1
store i32 %30, i32* %9
br label %23
31: ; preds = %23
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 2
store i32 %33, i32* %8
br label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %16
37: ; preds = %16
br label %38
38: ; preds = %37, %14
%39 = load i32, i32* %10
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %2
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %6
store i32 1, i32* %3
br label %43
43: ; preds = %88, %38
%44 = load i32, i32* %3
%45 = load i32, i32* %2
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %91
47: ; preds = %43
%48 = load i32, i32* %4
store i32 %48, i32* %5
%49 = load i32, i32* %6
store i32 %49, i32* %7
br label %50
50: ; preds = %53, %47
%51 = load i32, i32* %7
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* %7
%56 = add nsw i32 %55, -1
store i32 %56, i32* %7
br label %50
57: ; preds = %50
br label %58
58: ; preds = %79, %57
%59 = load i32, i32* %5
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %82
61: ; preds = %58
%62 = load i32, i32* %3
%63 = load i32, i32* %2
%64 = icmp ne i32 %62, %63
br i1 %64, label %65, label %77
65: ; preds = %61
%66 = load i32, i32* %5
%67 = load i32, i32* %4
%68 = icmp eq i32 %66, %67
br i1 %68, label %72, label %69
69: ; preds = %65
%70 = load i32, i32* %5
%71 = icmp eq i32 %70, 1
br i1 %71, label %72, label %74
72: ; preds = %69, %65
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %76
74: ; preds = %69
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %76
76: ; preds = %74, %72
br label %79
77: ; preds = %61
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %79
79: ; preds = %77, %76
%80 = load i32, i32* %5
%81 = add nsw i32 %80, -1
store i32 %81, i32* %5
br label %58
82: ; preds = %58
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%84 = load i32, i32* %6
%85 = add nsw i32 %84, -1
store i32 %85, i32* %6
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 2
store i32 %87, i32* %4
br label %88
88: ; preds = %82
%89 = load i32, i32* %3
%90 = add nsw i32 %89, 1
store i32 %90, i32* %3
br label %43
91: ; preds = %43
ret i32 0
}

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)
unreachable
}