#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 n, s, i, a, k = 2, j, c, t;
  printf(" ");
  scanf("%d", &n);
  j = n + n - 1;
  t = j;
  s = (n - 2) * (n - 2);
  printf(" %d\n", s);
  for (i = 0; i < j; i++) {
    printf(" ");
    j = j - 1;
  }
  printf("*\n");
  for (i = 2; i < n; i++) {
    for (c = 0; c < j; c++) {
      printf(" ");
    }
    for (a = 0; a <= k; a++) {
      if (a == 0 || a == k) {
        printf("*");
      } else {
        printf("#");
      }
    }
    printf("\n");
    k = k + 2;
    j = j - 1;
  }
  printf(" ");
  for (i = 0; i < t; i++) {
    printf("*");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x18(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c1 <main+0xa1>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1190 <main+0x70>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129c <main+0x17c>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1211 <main+0xf1>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e9 <main+0xc9>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     126e <main+0x14e>
cmpl   $0x0,-0x14(%rbp)
je     123a <main+0x11a>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    124d <main+0x12d>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1260 <main+0x140>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1218 <main+0xf8>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d6 <main+0xb6>
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12d9 <main+0x1b9>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12b1 <main+0x191>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xea1(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%r15d
lea    (%r15,%r15,1),%r14d
add    $0xffffffff,%r14d
lea    -0x2(%r15),%esi
imul   %esi,%esi
lea    0xe7f(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%ebp
test   %r15d,%r15d
jle    11bb <main+0x7b>
lea    (%r15,%r15,1),%ebp
add    $0xfffffffe,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
lea    -0x1(%rbp),%eax
cmp    %ebp,%ebx
mov    %eax,%ebp
jl     11a0 <main+0x60>
mov    %r14d,%ebp
sub    %ebx,%ebp
mov    %r15,0x10(%rsp)
mov    %r14d,0xc(%rsp)
lea    0xe3c(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x3,0x8(%rsp)
jl     1274 <main+0x134>
mov    %ebp,%r15d
mov    $0x2,%r13d
mov    $0x3,%ebp
mov    $0x2a,%r12d
mov    $0x2,%r14d
cs nopw 0x0(%rax,%rax,1)
test   %r15d,%r15d
jle    121f <main+0xdf>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1210 <main+0xd0>
mov    %r15d,%ebx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r15d,%r14d
mov    $0x23,%edi
cmove  %r12d,%edi
test   %r15d,%r15d
cmove  %r12d,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    %r15d,%ebp
jne    1230 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r14d
mov    %ebx,%r15d
add    $0xffffffff,%r15d
add    $0x1,%r13d
add    $0x2,%ebp
cmp    0x8(%rsp),%r13d
jl     1200 <main+0xc0>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x10(%rsp)
jle    12af <main+0x16f>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    12a0 <main+0x160>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c" %d\0A\00"
@str = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @putchar(i32 32)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
%7 = add i32 %6, -1
%8 = add nsw i32 %5, -2
%9 = mul nsw i32 %8, %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = icmp sgt i32 %5, 0
br i1 %11, label %12, label %19
12: ; preds = %0, %12
%13 = phi i32 [ %17, %12 ], [ 0, %0 ]
%14 = phi i32 [ %16, %12 ], [ %7, %0 ]
%15 = call i32 @putchar(i32 32)
%16 = add nsw i32 %14, -1
%17 = add nuw nsw i32 %13, 1
%18 = icmp slt i32 %17, %16
br i1 %18, label %12, label %19
19: ; preds = %12, %0
%20 = phi i32 [ %7, %0 ], [ %16, %12 ]
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %53
24: ; preds = %19, %45
%25 = phi i32 [ %52, %45 ], [ 3, %19 ]
%26 = phi i32 [ %49, %45 ], [ 2, %19 ]
%27 = phi i32 [ %48, %45 ], [ %20, %19 ]
%28 = phi i32 [ %47, %45 ], [ 2, %19 ]
%29 = icmp sgt i32 %27, 0
br i1 %29, label %30, label %35
30: ; preds = %24, %30
%31 = phi i32 [ %33, %30 ], [ 0, %24 ]
%32 = call i32 @putchar(i32 32)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %33, %27
br i1 %34, label %35, label %30
35: ; preds = %30, %24
br label %36
36: ; preds = %35, %36
%37 = phi i32 [ %43, %36 ], [ 0, %35 ]
%38 = icmp eq i32 %37, 0
%39 = icmp eq i32 %37, %28
%40 = select i1 %38, i1 true, i1 %39
%41 = select i1 %40, i32 42, i32 35
%42 = call i32 @putchar(i32 %41)
%43 = add nuw i32 %37, 1
%44 = icmp eq i32 %43, %25
br i1 %44, label %45, label %36
45: ; preds = %36
%46 = call i32 @putchar(i32 10)
%47 = add nuw nsw i32 %28, 2
%48 = add nsw i32 %27, -1
%49 = add nuw nsw i32 %26, 1
%50 = load i32, i32* %1
%51 = icmp slt i32 %49, %50
%52 = add nuw i32 %25, 2
br i1 %51, label %24, label %53
53: ; preds = %45, %19
%54 = call i32 @putchar(i32 32)
br i1 %11, label %55, label %62
55: ; preds = %53
%56 = call i32 @llvm.smax.i32(i32 %7, i32 1)
br label %57
57: ; preds = %55, %57
%58 = phi i32 [ %60, %57 ], [ 0, %55 ]
%59 = call i32 @putchar(i32 42)
%60 = add nuw nsw i32 %58, 1
%61 = icmp eq i32 %60, %56
br i1 %61, label %62, label %57
62: ; preds = %57, %53
%63 = call i32 @putchar(i32 10)
ret i32 0
}