#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 r, n, i, p, s, g;
  scanf("%d", &n);
  p = 1;
  for (i = 0; i < n - p; i++)
    printf(" ");
  printf("*\n");
  s = 1;
  for (i = 2; i < n; i++) {
    r = 1;
    p++;
    for (g = 0; g < n - p; g++)
      printf(" ");
    printf("*");
    while (r <= s) {
      printf(" ");
      r++;
    }
    printf("*\n");
    s += 2;
  }
  if (i == n)
    for (i = 1; i <= (2 * n - 1); i++)
      printf("*");
  printf("\n\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    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1178 <main+0x58>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x2d>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1235 <main+0x115>
movl   $0x1,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    11e0 <main+0xc0>
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b5 <main+0x95>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1212 <main+0xf2>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ec <main+0xcc>
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1192 <main+0x72>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    127b <main+0x15b>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1276 <main+0x156>
lea    0xda5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1248 <main+0x128>
jmp    127b <main+0x15b>
lea    0xd88(%rip),%rdi
call   1030 <printf@plt>
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>
cmpl   $0x2,0xc(%rsp)
jl     1178 <main+0x48>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1160 <main+0x30>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%eax
mov    $0x2,%r15d
cmp    $0x3,%eax
jl     1218 <main+0xe8>
mov    $0x2,%r15d
mov    $0x1,%r12d
lea    0xe5b(%rip),%r14
mov    $0x1,%ebp
nop
add    $0x1,%ebp
cmp    %ebp,%eax
jle    11d7 <main+0xa7>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
sub    %ebp,%eax
cmp    %eax,%ebx
jl     11c0 <main+0x90>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xc0>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x1,%r15d
mov    0xc(%rsp),%eax
add    $0x2,%r12d
cmp    %eax,%r15d
jl     11b0 <main+0x80>
cmp    %eax,%r15d
jne    1247 <main+0x117>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
add    %eax,%eax
cmp    %eax,%ebx
jl     1230 <main+0x100>
lea    0xdb5(%rip),%rdi
call   1040 <puts@plt>
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" \00"
@.str.2 = [3 x i8] c"*\0A\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [3 x i8] c"\0A\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* %3)
store i32 1, i32* %5
store i32 0, i32* %4
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = sub nsw i32 %11, %12
%14 = icmp slt i32 %10, %13
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %9
20: ; preds = %9
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %6
store i32 2, i32* %4
br label %22
22: ; preds = %54, %20
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %57
26: ; preds = %22
store i32 1, i32* %2
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
store i32 0, i32* %7
br label %29
29: ; preds = %37, %26
%30 = load i32, i32* %7
%31 = load i32, i32* %3
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
%34 = icmp slt i32 %30, %33
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %29
40: ; preds = %29
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %46, %40
%43 = load i32, i32* %2
%44 = load i32, i32* %6
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %42
50: ; preds = %42
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 2
store i32 %53, i32* %6
br label %54
54: ; preds = %50
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %22
57: ; preds = %22
%58 = load i32, i32* %4
%59 = load i32, i32* %3
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %74
61: ; preds = %57
store i32 1, i32* %4
br label %62
62: ; preds = %70, %61
%63 = load i32, i32* %4
%64 = load i32, i32* %3
%65 = mul nsw i32 2, %64
%66 = sub nsw i32 %65, 1
%67 = icmp sle i32 %63, %66
br i1 %67, label %68, label %73
68: ; preds = %62
%69 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %70
70: ; preds = %68
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
br label %62
73: ; preds = %62
br label %74
74: ; preds = %73, %57
%75 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

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