#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 *);
int fun04(int n) {
  int i, j, e;
  int esp = 0;
  for (i = n; i > 0; i--) {
    for (e = 0; e < esp; e++) {
      printf(" ");
    }
    for (j = i; j > 0; j--) {
      printf("*");
    }
    printf("\n");
    esp++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fun04>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11ac <fun04+0x9c>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115f <fun04+0x4f>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <fun04+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1189 <fun04+0x79>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <fun04+0x55>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1128 <fun04+0x18>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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