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


x86 assembly (clang, -O0):
<fun01>:
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    117a <fun01+0x6a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1160 <fun01+0x50>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <fun01+0x25>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <fun01+0x12>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun01>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1153 <fun01+0x43>
mov    %edi,%r14d
mov    $0x1,%ebx
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <fun01+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1120 <fun01+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 @fun01(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %25
9: ; preds = %5
store i32 0, i32* %4
br label %10
10: ; preds = %17, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %10
20: ; preds = %10
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %5
25: ; preds = %5
ret i32 0
}

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