#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, space, rows, m;
  m = 0;
  printf("Enter the number of rows that the tree will have : ");
  scanf("%d", &rows);
  printf("\n");
  for (i = 1; i <= rows; ++i) {
    for (space = 1; space <= rows - i; ++space) {
      printf("  ");
    }
    while (m != 2 * i - 1) {
      printf("* ");
      ++m;
    }
    m = 0;
    printf("\n");
  }
  int d = (rows * 2) - 1;
  for (int i = 0; i < d; i++) {
    if (i == d / 2) {
      printf("*");
    } else {
      printf("  ");
    }
  }
  printf("\nPress ENTER to Exit ");
  getchar();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1207 <main+0xd7>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     11b3 <main+0x83>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <main+0x58>
jmp    11b8 <main+0x88>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11e6 <main+0xb6>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b8 <main+0x88>
movl   $0x0,-0x14(%rbp)
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x45>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1274 <main+0x144>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jne    1255 <main+0x125>
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
jmp    1261 <main+0x131>
lea    0xddd(%rip),%rdi
call   1030 <printf@plt>
jmp    1266 <main+0x136>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    121a <main+0xea>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@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    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1250 <main+0x110>
mov    $0x1,%r15d
lea    0xeab(%rip),%r14
lea    0xea7(%rip),%r12
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebx
cmp    %ebp,%eax
jle    11d0 <main+0x90>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     11b0 <main+0x70>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ecx
mov    0xc(%rsp),%eax
add    $0x2,%r15d
cmp    %eax,%ebp
mov    %ecx,%ebp
jl     11a0 <main+0x60>
test   %eax,%eax
jle    1250 <main+0x110>
add    %eax,%eax
add    $0xffffffff,%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
cmp    $0x2,%eax
mov    $0x1,%r15d
cmovge %eax,%r15d
xor    %ebx,%ebx
lea    0xe17(%rip),%r14
jmp    1240 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
je     1250 <main+0x110>
cmp    %ebx,%ebp
jne    1230 <main+0xf0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    1238 <main+0xf8>
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Enter the number of rows that the tree will have : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c" \00"
@.str.4 = [3 x i8] c"* \00"
@.str.5 = [2 x i8] c"*\00"
@.str.6 = [22 x i8] c"\0APress ENTER to Exit \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
store i32 0, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %11
11: ; preds = %40, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %43
15: ; preds = %11
store i32 1, i32* %3
br label %16
16: ; preds = %24, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = sub nsw i32 %18, %19
%21 = icmp sle i32 %17, %20
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %16
27: ; preds = %16
br label %28
28: ; preds = %34, %27
%29 = load i32, i32* %5
%30 = load i32, i32* %2
%31 = mul nsw i32 2, %30
%32 = sub nsw i32 %31, 1
%33 = icmp ne i32 %29, %32
br i1 %33, label %34, label %38
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %28
38: ; preds = %28
store i32 0, i32* %5
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %11
43: ; preds = %11
%44 = load i32, i32* %4
%45 = mul nsw i32 %44, 2
%46 = sub nsw i32 %45, 1
store i32 %46, i32* %6
store i32 0, i32* %7
br label %47
47: ; preds = %61, %43
%48 = load i32, i32* %7
%49 = load i32, i32* %6
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %64
51: ; preds = %47
%52 = load i32, i32* %7
%53 = load i32, i32* %6
%54 = sdiv i32 %53, 2
%55 = icmp eq i32 %52, %54
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
58: ; preds = %51
%59 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %58, %56
br label %61
61: ; preds = %60
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %47
64: ; preds = %47
%65 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%66 = call i32 (...) @getchar()
%67 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [52 x i8] c"Enter the number of rows that the tree will have : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c" \00"
@.str.4 = [3 x i8] c"* \00"
@.str.6 = [22 x i8] c"\0APress ENTER to Exit \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @putchar(i32 10)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %39, label %8
8: ; preds = %0, %27
%9 = phi i32 [ %30, %27 ], [ %6, %0 ]
%10 = phi i32 [ %29, %27 ], [ 1, %0 ]
%11 = icmp sgt i32 %9, %10
br i1 %11, label %15, label %12
12: ; preds = %15, %8
%13 = shl nuw nsw i32 %10, 1
%14 = add nsw i32 %13, -1
br label %22
15: ; preds = %8, %15
%16 = phi i32 [ %18, %15 ], [ 1, %8 ]
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%18 = add nuw nsw i32 %16, 1
%19 = load i32, i32* %1
%20 = sub nsw i32 %19, %10
%21 = icmp slt i32 %16, %20
br i1 %21, label %15, label %12
22: ; preds = %12, %22
%23 = phi i32 [ 0, %12 ], [ %25, %22 ]
%24 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %14
br i1 %26, label %27, label %22
27: ; preds = %22
%28 = call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %10, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %10, %30
br i1 %31, label %8, label %32
32: ; preds = %27
%33 = shl nsw i32 %30, 1
%34 = add i32 %33, -1
%35 = icmp sgt i32 %30, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = sdiv i32 %34, 2
%38 = call i32 @llvm.smax.i32(i32 %34, i32 1)
br label %43
39: ; preds = %50, %0, %32
%40 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 (...) @getchar()
%42 = call i32 (...) @getchar()
ret i32 0
43: ; preds = %36, %50
%44 = phi i32 [ 0, %36 ], [ %51, %50 ]
%45 = icmp eq i32 %44, %37
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @putchar(i32 42)
br label %50
48: ; preds = %43
%49 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %46, %48
%51 = add nuw nsw i32 %44, 1
%52 = icmp eq i32 %51, %38
br i1 %52, label %39, label %43
}