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


x86 assembly (clang, -O0):
<fun02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    116f <fun02+0x5f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1155 <fun02+0x45>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <fun02+0x21>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <fun02+0x11>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun02>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    115c <fun02+0x4c>
mov    %edi,%r14d
lea    0x1(%r14),%ebx
nop
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1130 <fun02+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r14),%eax
add    $0xffffffff,%ebx
cmp    $0x1,%r14d
mov    %eax,%r14d
jg     1120 <fun02+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @fun02(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %21, %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %3
store i32 %10, i32* %4
br label %11
11: ; preds = %16, %9
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
br label %11
19: ; preds = %11
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %6
24: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @fun02(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %14
3: ; preds = %1, %10
%4 = phi i32 [ %12, %10 ], [ %0, %1 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ %4, %3 ]
%7 = tail call i32 @putchar(i32 42)
%8 = add nsw i32 %6, -1
%9 = icmp ugt i32 %6, 1
br i1 %9, label %5, label %10
10: ; preds = %5
%11 = tail call i32 @putchar(i32 10)
%12 = add nsw i32 %4, -1
%13 = icmp sgt i32 %4, 1
br i1 %13, label %3, label %14
14: ; preds = %10, %1
ret i32 0
}