#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 printLine(int row) {
  int blanks = 4 - row;
  int stars = row + (row - 1);
  for (int j = 0; j < blanks; j++) {
    printf(" ");
  }
  for (int k = 0; k < stars; k++) {
    printf("*");
  }
}


x86 assembly (clang, -O0):
<printLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1161 <printLine+0x51>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <printLine+0x2b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118e <printLine+0x7e>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <printLine+0x58>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLine>:
push   %rbp
push   %rbx
push   %rax
lea    (%rdi,%rdi,1),%ebx
add    $0xffffffff,%ebx
cmp    $0x3,%edi
jg     113f <printLine+0x2f>
mov    $0x4,%eax
sub    %edi,%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <printLine+0x20>
test   %ebx,%ebx
jle    115f <printLine+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1150 <printLine+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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