#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 = (2 * 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
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <printLine+0x4f>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <printLine+0x29>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118c <printLine+0x7c>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <printLine+0x56>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLine>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x3,%edi
jg     1143 <printLine+0x33>
mov    $0x4,%eax
sub    %ebx,%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <printLine+0x20>
test   %ebx,%ebx
jle    116f <printLine+0x5f>
lea    (%rbx,%rbx,1),%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <printLine+0x50>
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 = mul nsw i32 2, %9
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %18, %1
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%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
store i32 0, i32* %6
br label %22
22: ; preds = %28, %21
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%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* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %22
31: ; preds = %22
ret void
}

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