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


x86 assembly (clang, -O0):
<printTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c7 <printTree+0xb7>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    116e <printTree+0x5e>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <printTree+0x33>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119b <printTree+0x8b>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1175 <printTree+0x65>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1130 <printTree+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTree>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1187 <printTree+0x77>
mov    %edi,%r14d
mov    $0x1,%r15d
mov    $0x1,%ebx
nopl   0x0(%rax)
cmp    %r14d,%ebx
jge    1151 <printTree+0x41>
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1140 <printTree+0x30>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1160 <printTree+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
add    $0x2,%r15d
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1130 <printTree+0x20>
add    $0x8,%rsp
pop    %rbx
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 @printTree(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
store i32 1, i32* %5
store i32 0, i32* %4
br label %7
7: ; preds = %39, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %42
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = icmp slt i32 %13, %16
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %12
23: ; preds = %12
store i32 0, i32* %6
br label %24
24: ; preds = %30, %23
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %24
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 2
store i32 %38, i32* %5
br label %39
39: ; preds = %33
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %7
42: ; preds = %7
ret void
}

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