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


x86 assembly (clang, -O0):
<patternTwo>:
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     11cc <patternTwo+0xbc>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1170 <patternTwo+0x60>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <patternTwo+0x33>
mov    -0x4(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <patternTwo+0xa0>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <patternTwo+0x78>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <patternTwo+0x20>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patternTwo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r15d
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11c1 <patternTwo+0x91>
mov    $0x1,%ebx
lea    0xea8(%rip),%r14
xor    %r12d,%r12d
jmp    1178 <patternTwo+0x48>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
add    $0x1,%r12d
cmp    %r15d,%ebx
mov    %eax,%ebx
je     11c1 <patternTwo+0x91>
cmp    %r15d,%ebx
jge    1191 <patternTwo+0x61>
mov    %r15d,%ebp
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1180 <patternTwo+0x50>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%ebx
jb     1160 <patternTwo+0x30>
mov    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <patternTwo+0x80>
jmp    1160 <patternTwo+0x30>
lea    0xe3b(%rip),%rdi
pop    %rbx
pop    %r12
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 @patternTwo(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 = %19, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
%16 = icmp slt i32 %12, %15
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = call i32 (i8*, ...) @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* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %11
22: ; preds = %11
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %23)
store i32 1, i32* %4
br label %25
25: ; preds = %31, %22
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %25
34: ; preds = %25
%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 @patternTwo(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 %26, label %4
4: ; preds = %1, %22
%5 = phi i32 [ %7, %22 ], [ %0, %1 ]
%6 = phi i32 [ %24, %22 ], [ 1, %1 ]
%7 = add i32 %5, -1
%8 = icmp slt i32 %6, %0
br i1 %8, label %9, label %14
9: ; preds = %4, %9
%10 = phi i32 [ %12, %9 ], [ 0, %4 ]
%11 = tail call i32 @putchar(i32 36)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %7
br i1 %13, label %14, label %9
14: ; preds = %9, %4
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%16 = icmp ugt i32 %6, 1
br i1 %16, label %17, label %22
17: ; preds = %14, %17
%18 = phi i32 [ %20, %17 ], [ 1, %14 ]
%19 = tail call i32 @putchar(i32 36)
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %6
br i1 %21, label %22, label %17
22: ; preds = %17, %14
%23 = tail call i32 @putchar(i32 10)
%24 = add nuw i32 %6, 1
%25 = icmp eq i32 %6, %0
br i1 %25, label %26, label %4
26: ; preds = %22, %1
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret void
}