#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 print_star(int n) {
  int row, col;
  for (row = 0; row < n; row++) {
    for (col = 0; col < n + row; col++) {
      if (col < n - row - 1)
        printf(" ");
      else
        printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_star>:
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    11a4 <print_star+0x94>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    118a <print_star+0x7a>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    116b <print_star+0x5b>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <print_star+0x67>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <print_star+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <print_star+0x25>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_star+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_star>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    117a <print_star+0x6a>
mov    %edi,%r14d
xor    %r15d,%r15d
mov    $0x20,%r12d
mov    %edi,%r13d
jmp    1147 <print_star+0x37>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
add    $0x1,%r13d
cmp    %r14d,%r15d
je     117a <print_star+0x6a>
mov    %r15d,%eax
add    %r14d,%eax
jle    1130 <print_star+0x20>
mov    %r15d,%ebx
not    %ebx
add    %r14d,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
cmp    %ebx,%ebp
mov    $0x2a,%edi
cmovl  %r12d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    1160 <print_star+0x50>
jmp    1130 <print_star+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 @print_star(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 = %33, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %36
9: ; preds = %5
store i32 0, i32* %4
br label %10
10: ; preds = %28, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
%15 = icmp slt i32 %11, %14
br i1 %15, label %16, label %31
16: ; preds = %10
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = sub nsw i32 %18, %19
%21 = sub nsw i32 %20, 1
%22 = icmp slt i32 %17, %21
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %27
25: ; preds = %16
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %10
31: ; preds = %10
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %5
36: ; preds = %5
ret void
}

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