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


x86 assembly (clang, -O0):
<christmas>:
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    11b2 <christmas+0xa2>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     115f <christmas+0x4f>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <christmas+0x24>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1198 <christmas+0x88>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <christmas+0x62>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <christmas+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<christmas>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1199 <christmas+0x89>
mov    %edi,%r14d
lea    -0x1(%r14),%r15d
xor    %ebx,%ebx
mov    $0x1,%r13d
mov    %r15d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r15d,%ebx
je     115f <christmas+0x4f>
mov    %r12d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1150 <christmas+0x40>
mov    %r13d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <christmas+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
add    $0x2,%r13d
add    $0xffffffff,%r12d
cmp    %r14d,%ebx
jne    1140 <christmas+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 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @christmas(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %6
6: ; preds = %37, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %40
10: ; preds = %6
%11 = load i32, i32* %3
store i32 %11, i32* %4
br label %12
12: ; preds = %17, %10
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = sub nsw i32 %14, 1
%16 = icmp ne i32 %13, %15
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %12
21: ; preds = %12
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
store i32 0, i32* %4
br label %26
26: ; preds = %32, %21
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %26
35: ; preds = %26
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %6
40: ; preds = %6
ret void
}

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