#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 patternThree(int size) {
  int row = 1;
  int looper;
  printf("\n\n");
  while (row <= size) {
    for (looper = 0; looper < ((size + 1) - row); looper++)
      printf("$");
    for (looper = 1; looper < row; looper++)
      printf("%d", size);
    printf("\n");
    row++;
  }
  printf("\n\n");
  return;
}


x86 assembly (clang, -O0):
<patternThree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11c1 <patternThree+0xb1>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1173 <patternThree+0x63>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <patternThree+0x33>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a5 <patternThree+0x95>
mov    -0x4(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117a <patternThree+0x6a>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <patternThree+0x20>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patternThree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    11d4 <patternThree+0xa4>
lea    0x1(%rbx),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%ecx
lea    0xe99(%rip),%r14
xor    %r15d,%r15d
mov    %ebx,%r12d
jmp    118b <patternThree+0x5b>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
add    $0xffffffff,%r12d
add    $0x1,%r15d
cmp    %ebx,%ebp
mov    %eax,%ecx
je     11d4 <patternThree+0xa4>
mov    0xc(%rsp),%eax
mov    %rcx,0x10(%rsp)
sub    %ecx,%eax
mov    %r12d,%ebp
test   %eax,%eax
jle    11af <patternThree+0x7f>
nopl   (%rax)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <patternThree+0x70>
mov    %r15d,%r13d
mov    0x10(%rsp),%rbp
cmp    $0x2,%ebp
jb     1170 <patternThree+0x40>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%r13d
jne    11c0 <patternThree+0x90>
jmp    1170 <patternThree+0x40>
lea    0xe28(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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