#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 PT(int h) {
  int rolls, a, spaces, i;
  a = 1;
  for (rolls = 0; rolls < h; rolls++) {
    for (spaces = 0; spaces < (h - rolls); spaces++) {
      printf(" ");
    };
    for (i = 0; i < a; i++) {
      printf("*");
    };
    printf("\n");
    a = a + 2;
  }
}


x86 assembly (clang, -O0):
<PT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b7 <PT+0xa7>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1167 <PT+0x57>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113c <PT+0x2c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1194 <PT+0x84>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <PT+0x5e>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <PT+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PT>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1189 <PT+0x79>
mov    %edi,%r14d
xor    %ebp,%ebp
mov    $0x1,%r12d
mov    %edi,%r15d
nopw   0x0(%rax,%rax,1)
cmp    %r14d,%ebp
jge    114f <PT+0x3f>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1140 <PT+0x30>
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <PT+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r12d
add    $0x1,%ebp
add    $0xffffffff,%r15d
cmp    %r14d,%ebp
jne    1130 <PT+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 @PT(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* %4
store i32 0, i32* %3
br label %7
7: ; preds = %37, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %40
11: ; preds = %7
store i32 0, i32* %5
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %5
%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* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
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* %4
%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* %4
%36 = add nsw i32 %35, 2
store i32 %36, i32* %4
br label %37
37: ; preds = %33
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %7
40: ; preds = %7
ret void
}

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