#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 printRow(int numStars, int width) {
  int i = 0, numSpaces = (width - numStars) / 2;
  for (i = 0; i < numSpaces; i++) {
    printf(" ");
  }
  for (i = 0; i < numStars; i++) {
    printf("*");
  }
  printf("\n");
  ;
}


x86 assembly (clang, -O0):
<printRow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1163 <printRow+0x53>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <printRow+0x2d>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1190 <printRow+0x80>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <printRow+0x5a>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printRow>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
sub    %edi,%esi
cmp    $0x2,%esi
jl     113f <printRow+0x2f>
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <printRow+0x20>
test   %ebx,%ebx
jle    115f <printRow+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1150 <printRow+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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 @printRow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = sdiv i32 %9, 2
store i32 %10, i32* %6
store i32 0, i32* %5
br label %11
11: ; preds = %17, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%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* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %11
20: ; preds = %11
store i32 0, i32* %5
br label %21
21: ; preds = %27, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %21
%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
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %21
30: ; preds = %21
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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