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


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

x86 assembly (clang, -O2):
<patternOne>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11e4 <patternOne+0xb4>
mov    $0x1,%r13d
lea    0xea0(%rip),%r14
mov    %r15d,%r12d
xor    %ebx,%ebx
jmp    118a <patternOne+0x5a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
add    $0x1,%ebx
add    $0xffffffff,%r12d
cmp    %r15d,%ebx
je     11e4 <patternOne+0xb4>
cmp    $0x2,%r13d
jb     11af <patternOne+0x7f>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <patternOne+0x70>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13d,%r15d
jle    1170 <patternOne+0x40>
mov    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11d0 <patternOne+0xa0>
jmp    1170 <patternOne+0x40>
lea    0xe18(%rip),%rdi
add    $0x8,%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 @patternOne(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 = %35, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %39
10: ; preds = %6
store i32 0, i32* %4
br label %11
11: ; preds = %18, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %11
21: ; preds = %11
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = sub nsw i32 %24, %25
store i32 %26, i32* %4
br label %27
27: ; preds = %32, %21
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %4
%34 = add nsw i32 %33, -1
store i32 %34, i32* %4
br label %27
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %6
39: ; preds = %6
%40 = 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 @patternOne(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 %27, label %4
4: ; preds = %1, %22
%5 = phi i32 [ %25, %22 ], [ 0, %1 ]
%6 = phi i32 [ %24, %22 ], [ 1, %1 ]
%7 = icmp ugt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ 0, %4 ]
%10 = tail call i32 @putchar(i32 36)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, %5
br i1 %12, label %13, label %8
13: ; preds = %8, %4
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%15 = sub nsw i32 %0, %6
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13, %17
%18 = phi i32 [ %20, %17 ], [ %15, %13 ]
%19 = tail call i32 @putchar(i32 36)
%20 = add nsw i32 %18, -1
%21 = icmp ugt i32 %18, 1
br i1 %21, label %17, label %22
22: ; preds = %17, %13
%23 = tail call i32 @putchar(i32 10)
%24 = add nuw nsw i32 %6, 1
%25 = add nuw nsw i32 %5, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %4
27: ; preds = %22, %1
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret void
}