#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 ChristmasTree(int num) {
  int br, Stars, j, a, Space;
  for (br = 1; br <= num; br++) {
    for (j = 1; j < 2 * num; j++) {
      Stars = br + (br - 1);
      Space = 2 * num - (1 + Stars);
      for (a = 1; a <= 2 * num - 1; a++) {
        if (a <= Space / 2) {
          printf(" ");
        } else {
          if (Stars == 1) {
            printf("\x1b[1m");
            printf("\x1b[33m"
                   "*");
            break;
          } else {
            printf("\x1b[32m"
                   "*");
            if (a - (Space / 2) == Stars) {
              break;
            }
          }
        }
      }
      printf("\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<ChristmasTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1244 <ChristmasTree+0x134>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1231 <ChristmasTree+0x121>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1225 <ChristmasTree+0x115>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11af <ChristmasTree+0x9f>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <ChristmasTree+0x102>
cmpl   $0x1,-0xc(%rbp)
jne    11d6 <ChristmasTree+0xc6>
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    1225 <ChristmasTree+0x115>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
cmp    -0xc(%rbp),%eax
jne    1208 <ChristmasTree+0xf8>
jmp    1225 <ChristmasTree+0x115>
jmp    120d <ChristmasTree+0xfd>
jmp    1212 <ChristmasTree+0x102>
jmp    1217 <ChristmasTree+0x107>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <ChristmasTree+0x5c>
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
jmp    1236 <ChristmasTree+0x126>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <ChristmasTree+0x12>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChristmasTree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rax
mov    %rdi,(%rsp)
test   %edi,%edi
jle    11d4 <ChristmasTree+0xb4>
mov    (%rsp),%rax
lea    (%rax,%rax,1),%ebp
mov    $0x1,%ebx
jmp    117c <ChristmasTree+0x5c>
nopl   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
je     11d4 <ChristmasTree+0xb4>
lea    (%rbx,%rbx,1),%eax
lea    (%rbx,%rbx,1),%r14d
add    $0xffffffff,%r14d
mov    %ebp,%ecx
sub    %eax,%ecx
mov    %ecx,%r15d
shr    $0x1f,%r15d
add    %ecx,%r15d
sar    %r15d
mov    $0x1,%r12d
jmp    11b3 <ChristmasTree+0x93>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %ebp,%r12d
jge    1168 <ChristmasTree+0x48>
mov    %r12d,%r13d
sub    %r15d,%r13d
jle    11a0 <ChristmasTree+0x80>
cmp    $0x1,%r14d
je     1150 <ChristmasTree+0x30>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
cmp    %r14d,%r13d
jne    11aa <ChristmasTree+0x8a>
jmp    1168 <ChristmasTree+0x48>
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 = [5 x i8] c"\1B[1m\00"
@.str.2 = [7 x i8] c"\1B[33m*\00"
@.str.3 = [7 x i8] c"\1B[32m*\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @ChristmasTree(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %8
8: ; preds = %68, %1
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %71
12: ; preds = %8
store i32 1, i32* %5
br label %13
13: ; preds = %64, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = mul nsw i32 2, %15
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %67
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = add nsw i32 %19, %21
store i32 %22, i32* %4
%23 = load i32, i32* %2
%24 = mul nsw i32 2, %23
%25 = load i32, i32* %4
%26 = add nsw i32 1, %25
%27 = sub nsw i32 %24, %26
store i32 %27, i32* %7
store i32 1, i32* %6
br label %28
28: ; preds = %59, %18
%29 = load i32, i32* %6
%30 = load i32, i32* %2
%31 = mul nsw i32 2, %30
%32 = sub nsw i32 %31, 1
%33 = icmp sle i32 %29, %32
br i1 %33, label %34, label %62
34: ; preds = %28
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = sdiv i32 %36, 2
%38 = icmp sle i32 %35, %37
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %58
41: ; preds = %34
%42 = load i32, i32* %4
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %62
47: ; preds = %41
%48 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = sdiv i32 %50, 2
%52 = sub nsw i32 %49, %51
%53 = load i32, i32* %4
%54 = icmp eq i32 %52, %53
br i1 %54, label %55, label %56
55: ; preds = %47
br label %62
56: ; preds = %47
br label %57
57: ; preds = %56
br label %58
58: ; preds = %57, %39
br label %59
59: ; preds = %58
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %28
62: ; preds = %55, %44, %28
%63 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %67
64: ; No predecessors!
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %13
67: ; preds = %62, %13
br label %68
68: ; preds = %67
%69 = load i32, i32* %3
%70 = add nsw i32 %69, 1
store i32 %70, i32* %3
br label %8
71: ; preds = %8
ret void
}

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