#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 rows, ht, sumht, b, row, k, j;
  scanf("%d", &rows);
  ht = 1;
  sumht = 1;
  k = 1;
  int z;
  z = rows - 2;
  if (rows != 3) {
    while (z > 1) {
      ht = ht + 2;
      sumht = sumht + ht;
      z--;
    }
  }
  printf("%d", sumht);
  printf("\n");
  b = rows - 1;
  while (b > 0) {
    printf(" ");
    b--;
  }
  printf("*");
  printf("\n");
  if (rows != 1) {
    for (row = 0; row < rows - 2; row++) {
      b = rows - 2 - row;
      while (b > 0) {
        printf(" ");
        b--;
      }
      printf("*");
      b = row + k;
      j = k;
      k = k + 2;
      while (j > 0) {
        printf("#");
        j--;
      }
      printf("*");
      printf("\n");
    }
    int i = 0;
    int c = 2;
    while (c > 1) {
      c = (rows * 2) - (1 + i);
      printf("*");
      i++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     119b <main+0x7b>
jmp    116c <main+0x4c>
cmpl   $0x1,-0x24(%rbp)
jle    1196 <main+0x76>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    116c <main+0x4c>
jmp    119b <main+0x7b>
mov    -0x10(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11e9 <main+0xc9>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <main+0xa3>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
je     1319 <main+0x1f9>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    12cf <main+0x1af>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1259 <main+0x139>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1233 <main+0x113>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    12a5 <main+0x185>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    127f <main+0x15f>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1216 <main+0xf6>
movl   $0x0,-0x28(%rbp)
movl   $0x2,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jle    1314 <main+0x1f4>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12dd <main+0x1bd>
jmp    1319 <main+0x1f9>
xor    %eax,%eax
add    $0x30,%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),%eax
mov    $0x1,%esi
cmp    $0x4,%eax
jl     1185 <main+0x55>
lea    -0x2(%rax),%ecx
lea    (%rax,%rax,4),%edx
cmp    $0x2,%ecx
mov    $0x2,%esi
cmovb  %ecx,%esi
sub    %esi,%ecx
sub    %esi,%eax
add    $0xfffffffd,%eax
imul   %ecx,%eax
and    $0xfffffffe,%eax
add    %edx,%eax
lea    (%rsi,%rsi,4),%ecx
sub    %ecx,%eax
add    $0xfffffffa,%eax
mov    %eax,%esi
lea    0xe74(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ebx
cmp    $0x2,%ebx
jl     11c2 <main+0x92>
add    $0x1,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
ja     11b0 <main+0x80>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%r15d
cmp    $0x1,%r15d
je     12c0 <main+0x190>
cmp    $0x3,%r15d
jl     127e <main+0x14e>
add    $0xfffffffe,%r15d
xor    %ebx,%ebx
mov    $0x1,%r14d
mov    $0x2,%r12d
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %ebx,%ebp
jle    1232 <main+0x102>
add    %r14d,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1220 <main+0xf0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %r12d,%ebp
nop
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1240 <main+0x110>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%r15d
lea    -0x2(%r15),%ebp
add    $0xffffffff,%r14d
add    $0x2,%r12d
cmp    %ebx,%ebp
jg     1210 <main+0xe0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    $0x2,%r15d
jl     12c0 <main+0x190>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp),%ebp
mov    $0x2a,%edi
call   1030 <putchar@plt>
lea    (%rbx,%rbp,2),%eax
add    $0xffffffff,%eax
mov    %ebx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jg     12a0 <main+0x170>
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 = [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
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %7
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 2
store i32 %14, i32* %9
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %30
17: ; preds = %0
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %9
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 2
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
store i32 %26, i32* %4
%27 = load i32, i32* %9
%28 = add nsw i32 %27, -1
store i32 %28, i32* %9
br label %18
29: ; preds = %18
br label %30
30: ; preds = %29, %0
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %5
br label %36
36: ; preds = %39, %30
%37 = load i32, i32* %5
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* %5
%42 = add nsw i32 %41, -1
store i32 %42, i32* %5
br label %36
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%46 = load i32, i32* %2
%47 = icmp ne i32 %46, 1
br i1 %47, label %48, label %101
48: ; preds = %43
store i32 0, i32* %6
br label %49
49: ; preds = %84, %48
%50 = load i32, i32* %6
%51 = load i32, i32* %2
%52 = sub nsw i32 %51, 2
%53 = icmp slt i32 %50, %52
br i1 %53, label %54, label %87
54: ; preds = %49
%55 = load i32, i32* %2
%56 = sub nsw i32 %55, 2
%57 = load i32, i32* %6
%58 = sub nsw i32 %56, %57
store i32 %58, i32* %5
br label %59
59: ; preds = %62, %54
%60 = load i32, i32* %5
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%64 = load i32, i32* %5
%65 = add nsw i32 %64, -1
store i32 %65, i32* %5
br label %59
66: ; preds = %59
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%68 = load i32, i32* %6
%69 = load i32, i32* %7
%70 = add nsw i32 %68, %69
store i32 %70, i32* %5
%71 = load i32, i32* %7
store i32 %71, i32* %8
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 2
store i32 %73, i32* %7
br label %74
74: ; preds = %77, %66
%75 = load i32, i32* %8
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%79 = load i32, i32* %8
%80 = add nsw i32 %79, -1
store i32 %80, i32* %8
br label %74
81: ; preds = %74
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %84
84: ; preds = %81
%85 = load i32, i32* %6
%86 = add nsw i32 %85, 1
store i32 %86, i32* %6
br label %49
87: ; preds = %49
store i32 0, i32* %10
store i32 2, i32* %11
br label %88
88: ; preds = %91, %87
%89 = load i32, i32* %11
%90 = icmp sgt i32 %89, 1
br i1 %90, label %91, label %100
91: ; preds = %88
%92 = load i32, i32* %2
%93 = mul nsw i32 %92, 2
%94 = load i32, i32* %10
%95 = add nsw i32 1, %94
%96 = sub nsw i32 %93, %95
store i32 %96, i32* %11
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%98 = load i32, i32* %10
%99 = add nsw i32 %98, 1
store i32 %99, i32* %10
br label %88
100: ; preds = %88
br label %101
101: ; preds = %100, %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)
%4 = load i32, i32* %1
%5 = add i32 %4, -2
%6 = icmp sgt i32 %4, 3
br i1 %6, label %7, label %19
7: ; preds = %0
%8 = mul i32 %4, 5
%9 = call i32 @llvm.umin.i32(i32 %5, i32 2)
%10 = sub nuw nsw i32 %5, %9
%11 = add nsw i32 %4, -3
%12 = sub nsw i32 %11, %9
%13 = mul i32 %10, %12
%14 = and i32 %13, -2
%15 = add i32 %8, %14
%16 = mul nsw i32 %9, -5
%17 = add i32 %15, -6
%18 = add i32 %16, %17
br label %19
19: ; preds = %7, %0
%20 = phi i32 [ 1, %0 ], [ %18, %7 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i32 @putchar(i32 10)
%23 = load i32, i32* %1
%24 = icmp sgt i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %19, %25
%26 = phi i32 [ %27, %25 ], [ %23, %19 ]
%27 = add nsw i32 %26, -1
%28 = call i32 @putchar(i32 32)
%29 = icmp ugt i32 %26, 2
br i1 %29, label %25, label %30
30: ; preds = %25, %19
%31 = call i32 @putchar(i32 42)
%32 = call i32 @putchar(i32 10)
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, 1
br i1 %34, label %77, label %35
35: ; preds = %30
%36 = icmp sgt i32 %33, 2
br i1 %36, label %37, label %39
37: ; preds = %35
%38 = add nsw i32 %33, -2
br label %43
39: ; preds = %61, %35
%40 = phi i32 [ %33, %35 ], [ %66, %61 ]
%41 = call i32 @putchar(i32 42)
%42 = icmp sgt i32 %40, 1
br i1 %42, label %69, label %77
43: ; preds = %37, %61
%44 = phi i32 [ %67, %61 ], [ %38, %37 ]
%45 = phi i32 [ %62, %61 ], [ 1, %37 ]
%46 = phi i32 [ %65, %61 ], [ 0, %37 ]
%47 = sub nsw i32 %44, %46
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %43, %49
%50 = phi i32 [ %52, %49 ], [ %47, %43 ]
%51 = call i32 @putchar(i32 32)
%52 = add nsw i32 %50, -1
%53 = icmp ugt i32 %50, 1
br i1 %53, label %49, label %54
54: ; preds = %49, %43
%55 = call i32 @putchar(i32 42)
br label %56
56: ; preds = %54, %56
%57 = phi i32 [ %45, %54 ], [ %59, %56 ]
%58 = call i32 @putchar(i32 35)
%59 = add nsw i32 %57, -1
%60 = icmp sgt i32 %57, 1
br i1 %60, label %56, label %61
61: ; preds = %56
%62 = add nuw nsw i32 %45, 2
%63 = call i32 @putchar(i32 42)
%64 = call i32 @putchar(i32 10)
%65 = add nuw nsw i32 %46, 1
%66 = load i32, i32* %1
%67 = add nsw i32 %66, -2
%68 = icmp sgt i32 %67, %65
br i1 %68, label %43, label %39
69: ; preds = %39, %69
%70 = phi i32 [ %73, %69 ], [ 1, %39 ]
%71 = load i32, i32* %1
%72 = shl nsw i32 %71, 1
%73 = add nuw nsw i32 %70, 1
%74 = sub nsw i32 %72, %73
%75 = call i32 @putchar(i32 42)
%76 = icmp sgt i32 %74, 1
br i1 %76, label %69, label %77
77: ; preds = %69, %39, %30
ret i32 0
}