#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 printPattern(int height, int width) {
  int rowLooper;
  int asteriskLooper;
  printf("\n\n");
  for (rowLooper = 1; rowLooper <= height; rowLooper++) {
    for (asteriskLooper = 1; asteriskLooper <= width; asteriskLooper++) {
      printf("*");
    }
    printf("\n");
  }
  return;
}


x86 assembly (clang, -O0):
<printPattern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1184 <printPattern+0x74>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116a <printPattern+0x5a>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <printPattern+0x34>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <printPattern+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPattern>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    1181 <printPattern+0x61>
mov    $0x1,%ebp
jmp    1164 <printPattern+0x44>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
cmp    %r14d,%ebp
mov    %eax,%ebp
je     1181 <printPattern+0x61>
test   %r15d,%r15d
jle    1150 <printPattern+0x30>
mov    %r15d,%ebx
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <printPattern+0x50>
jmp    1150 <printPattern+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printPattern(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
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
store i32 1, i32* %6
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp sle 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.1, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %13
22: ; preds = %13
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %8
27: ; preds = %8
ret void
}

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