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


x86 assembly (clang, -O0):
<patternFour>:
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     11e2 <patternFour+0xd2>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1173 <patternFour+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 <patternFour+0x33>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jge    11a5 <patternFour+0x95>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11b5 <patternFour+0xa5>
jmp    11d4 <patternFour+0xc4>
mov    -0x4(%rbp),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <patternFour+0x78>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <patternFour+0x20>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patternFour>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
test   %r13d,%r13d
jle    11c6 <patternFour+0x96>
lea    0x1(%r13),%r15d
mov    $0x1,%ebp
lea    0xea1(%rip),%r14
mov    %r13d,%r12d
jmp    117e <patternFour+0x4e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rbp),%eax
add    $0xffffffff,%r12d
cmp    %r13d,%ebp
mov    %eax,%ebp
je     11c6 <patternFour+0x96>
mov    %r15d,%eax
sub    %ebp,%eax
test   %eax,%eax
jle    119f <patternFour+0x6f>
mov    %r12d,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1190 <patternFour+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r13d,%ebp
je     1170 <patternFour+0x40>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebp,%ebx
jb     11b0 <patternFour+0x80>
jmp    1170 <patternFour+0x40>
lea    0xe36(%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 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"%d\00"
define void @patternFour(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 = %41, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %44
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
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %25
25: ; preds = %38, %23
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp ne i32 %30, %31
br label %33
33: ; preds = %29, %25
%34 = phi i1 [ false, %25 ], [ %32, %29 ]
br i1 %34, label %35, label %41
35: ; preds = %33
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %25
41: ; preds = %33
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %6
44: ; preds = %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

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