#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*/ printRowOfAsterisks(int);
int /*<<< orphan*/ printf(char *);
void printPattern(int rows) {
  int numAsterisks;
  printf("\n\n");
  for (numAsterisks = 1; numAsterisks <= rows; numAsterisks += 2)
    printRowOfAsterisks(numAsterisks);
  if (rows % 2)
    numAsterisks -= 4;
  else
    numAsterisks -= 2;
  for (; numAsterisks > 0; numAsterisks -= 2)
    printRowOfAsterisks(numAsterisks);
  printf("\n\n");
  return;
}


x86 assembly (clang, -O0):
<printPattern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1160 <printPattern+0x40>
mov    -0x8(%rbp),%edi
call   1040 <printRowOfAsterisks@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <printPattern+0x1e>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1182 <printPattern+0x62>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <printPattern+0x6b>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <printPattern+0x70>
cmpl   $0x0,-0x8(%rbp)
jle    11b0 <printPattern+0x90>
mov    -0x8(%rbp),%edi
call   1040 <printRowOfAsterisks@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <printPattern+0x70>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPattern>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
test   %ebp,%ebp
jle    114e <printPattern+0x2e>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <printRowOfAsterisks@plt>
add    $0x2,%ebx
cmp    %ebp,%ebx
jle    1140 <printPattern+0x20>
xor    %eax,%eax
test   $0x1,%bpl
sete   %al
lea    (%rbx,%rax,2),%ebx
add    $0xfffffffc,%ebx
test   %ebx,%ebx
jle    1181 <printPattern+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <printRowOfAsterisks@plt>
lea    -0x2(%rbx),%eax
cmp    $0x2,%ebx
mov    %eax,%ebx
ja     1170 <printPattern+0x50>
lea    0xe78(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str.1 = [2 x i8] c"\0A\00"
define void @printPattern(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.1, i64 0, i64 0))
%3 = icmp slt i32 %0, 1
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 1, %1 ]
%6 = tail call i32 @printRowOfAsterisks(i32 %5)
%7 = add nuw nsw i32 %5, 2
%8 = icmp sgt i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
%10 = phi i32 [ 1, %1 ], [ %7, %4 ]
%11 = and i32 %0, 1
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 -2, i32 -4
%14 = add nsw i32 %10, %13
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %9, %16
%17 = phi i32 [ %19, %16 ], [ %14, %9 ]
%18 = tail call i32 @printRowOfAsterisks(i32 %17)
%19 = add nsw i32 %17, -2
%20 = icmp ugt i32 %17, 2
br i1 %20, label %16, label %21
21: ; preds = %16, %9
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.1, i64 0, i64 0))
ret void
}