#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*/ printRow(int, int);
void printDiamond(int numStars) {
  int i = 0;
  if (numStars < 1) {
    return;
  }
  for (i = 1; i <= numStars; i += 2) {
    printRow(i, numStars);
  }
  for (i = numStars - 2; i >= 1; i -= 2) {
    printRow(i, numStars);
  }
}


x86 assembly (clang, -O0):
<printDiamond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    1131 <printDiamond+0x21>
jmp    1189 <printDiamond+0x79>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     115d <printDiamond+0x4d>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <printRow@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <printDiamond+0x28>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1189 <printDiamond+0x79>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <printRow@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <printDiamond+0x56>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDiamond>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1152 <printDiamond+0x42>
mov    %edi,%ebx
mov    $0x1,%ebp
xchg   %ax,%ax
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <printRow@plt>
add    $0x2,%ebp
cmp    %ebx,%ebp
jle    1120 <printDiamond+0x10>
cmp    $0x3,%ebx
jl     1152 <printDiamond+0x42>
lea    0x2(%rbx),%ebp
nopl   0x0(%rax,%rax,1)
lea    -0x4(%rbp),%edi
mov    %ebx,%esi
call   1030 <printRow@plt>
add    $0xfffffffe,%ebp
cmp    $0x4,%ebp
ja     1140 <printDiamond+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @printDiamond(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
br label %32
7: ; preds = %1
store i32 1, i32* %3
br label %8
8: ; preds = %16, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @printRow(i32 %13, i32 %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 2
store i32 %18, i32* %3
br label %8
19: ; preds = %8
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 2
store i32 %21, i32* %3
br label %22
22: ; preds = %29, %19
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 1
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = call i32 @printRow(i32 %26, i32 %27)
br label %29
29: ; preds = %25
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 2
store i32 %31, i32* %3
br label %22
32: ; preds = %6, %22
ret void
}

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