#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 *);
void PrintChristmasTree(int height) {
  int i;
  for (i = 0; i < height; ++i) {
    int j;
    for (j = 0; j < height - (i + 1); ++j) {
      printf(" ");
    }
    for (j = 0; j < i * 2 + 1; ++j) {
      if (i == 0) {
        printf("\033[0;30m");
      } else {
        printf("\033[0;32m");
      }
      printf("*");
      printf("\033[0m");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<PrintChristmasTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e7 <PrintChristmasTree+0xd7>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%edx
add    $0x1,%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    1165 <PrintChristmasTree+0x55>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <PrintChristmasTree+0x25>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11cd <PrintChristmasTree+0xbd>
cmpl   $0x0,-0x8(%rbp)
jne    119b <PrintChristmasTree+0x8b>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <PrintChristmasTree+0x97>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116c <PrintChristmasTree+0x5c>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <PrintChristmasTree+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintChristmasTree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11ca <PrintChristmasTree+0xaa>
xor    %r15d,%r15d
mov    $0x1,%r12d
lea    0xecd(%rip),%rbx
mov    %edi,%r14d
mov    %edi,0x4(%rsp)
nopw   0x0(%rax,%rax,1)
lea    0x1(%r15),%r13d
cmp    %edi,%r13d
jge    1172 <PrintChristmasTree+0x52>
mov    $0x1,%ebp
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1160 <PrintChristmasTree+0x40>
add    $0xffffffff,%r14d
test   %r15d,%r15d
lea    0xe88(%rip),%rbp
lea    0xe79(%rip),%rax
cmove  %rax,%rbp
mov    %r12d,%r15d
xchg   %ax,%ax
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%r15d
jne    1190 <PrintChristmasTree+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r12d
mov    %r13d,%r15d
mov    0x4(%rsp),%edi
cmp    %edi,%r13d
jne    1150 <PrintChristmasTree+0x30>
add    $0x8,%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 = [8 x i8] c"\1B[0;30m\00"
@.str.2 = [8 x i8] c"\1B[0;32m\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [5 x i8] c"\1B[0m\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @PrintChristmasTree(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %44, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %47
9: ; preds = %5
store i32 0, i32* %4
br label %10
10: ; preds = %19, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = sub nsw i32 %12, %14
%16 = icmp slt i32 %11, %15
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %10
22: ; preds = %10
store i32 0, i32* %4
br label %23
23: ; preds = %39, %22
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = mul nsw i32 %25, 2
%27 = add nsw i32 %26, 1
%28 = icmp slt i32 %24, %27
br i1 %28, label %29, label %42
29: ; preds = %23
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %36
34: ; preds = %29
%35 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %36
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %23
42: ; preds = %23
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %5
47: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"\1B[0;30m\00"
@.str.2 = [8 x i8] c"\1B[0;32m\00"
@.str.4 = [5 x i8] c"\1B[0m\00"
define void @PrintChristmasTree(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %29
3: ; preds = %1, %25
%4 = phi i32 [ %27, %25 ], [ 1, %1 ]
%5 = phi i32 [ %7, %25 ], [ %0, %1 ]
%6 = phi i32 [ %8, %25 ], [ 0, %1 ]
%7 = add i32 %5, -1
%8 = add nuw nsw i32 %6, 1
%9 = icmp slt i32 %8, %0
br i1 %9, label %13, label %10
10: ; preds = %13, %3
%11 = icmp eq i32 %6, 0
%12 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
br label %18
13: ; preds = %3, %13
%14 = phi i32 [ %16, %13 ], [ 0, %3 ]
%15 = tail call i32 @putchar(i32 32)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %7
br i1 %17, label %10, label %13
18: ; preds = %10, %18
%19 = phi i32 [ 0, %10 ], [ %23, %18 ]
%20 = tail call i32 @printf(i8* dereferenceable(1) %12)
%21 = tail call i32 @putchar(i32 42)
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%23 = add nuw i32 %19, 1
%24 = icmp eq i32 %23, %4
br i1 %24, label %25, label %18
25: ; preds = %18
%26 = tail call i32 @putchar(i32 10)
%27 = add nuw i32 %4, 2
%28 = icmp eq i32 %8, %0
br i1 %28, label %29, label %3
29: ; preds = %25, %1
ret void
}