#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 height) {
  int i, j, stars, k, space;
  stars = 1;
  space = height;
  for (i = 1; i <= height; i++) {
    for (k = space - 1; k > 0; k = k - 1) {
      printf(" ");
    }
    for (j = 1; j <= stars; j++) {
      printf("*");
    }
    stars = stars + 2;
    space = space - 1;
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<christmastree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11c1 <christmastree+0xb1>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1168 <christmastree+0x58>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <christmastree+0x34>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1195 <christmastree+0x85>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116f <christmastree+0x5f>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <christmastree+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<christmastree>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1189 <christmastree+0x79>
mov    %edi,%r14d
mov    $0x1,%ebp
mov    %edi,%r15d
mov    $0x1,%r12d
nopl   (%rax)
cmp    $0x2,%r15d
jl     1152 <christmastree+0x42>
mov    %r15d,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1140 <christmastree+0x30>
add    $0xffffffff,%r15d
mov    %ebp,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <christmastree+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
add    $0x2,%ebp
cmp    %r14d,%r12d
mov    %eax,%r12d
jne    1130 <christmastree+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [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* %5
%8 = load i32, i32* %2
store i32 %8, i32* %7
store i32 1, i32* %3
br label %9
9: ; preds = %40, %1
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %43
13: ; preds = %9
%14 = load i32, i32* %7
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %6
br label %16
16: ; preds = %21, %13
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %6
br label %16
24: ; preds = %16
store i32 1, i32* %4
br label %25
25: ; preds = %31, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %25
34: ; preds = %25
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 2
store i32 %36, i32* %5
%37 = load i32, i32* %7
%38 = sub nsw i32 %37, 1
store i32 %38, i32* %7
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %34
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %9
43: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @christmastree(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %25, label %3
3: ; preds = %1, %20
%4 = phi i32 [ %23, %20 ], [ 2, %1 ]
%5 = phi i32 [ %7, %20 ], [ %0, %1 ]
%6 = phi i32 [ %22, %20 ], [ 1, %1 ]
%7 = add nsw i32 %5, -1
%8 = icmp sgt i32 %5, 1
br i1 %8, label %9, label %14
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ %7, %3 ]
%11 = tail call i32 @putchar(i32 32)
%12 = add nsw i32 %10, -1
%13 = icmp ugt i32 %10, 1
br i1 %13, label %9, label %14
14: ; preds = %9, %3
br label %15
15: ; preds = %14, %15
%16 = phi i32 [ %18, %15 ], [ 1, %14 ]
%17 = tail call i32 @putchar(i32 42)
%18 = add nuw i32 %16, 1
%19 = icmp eq i32 %18, %4
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = tail call i32 @putchar(i32 10)
%22 = add nuw i32 %6, 1
%23 = add i32 %4, 2
%24 = icmp eq i32 %6, %0
br i1 %24, label %25, label %3
25: ; preds = %20, %1
ret void
}