#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*/ printLineOfChars(char *, int);
void printSideWayTriangle(char *ch, int base) {
  int i = 1;
  for (i = 1; i <= base; i++) {
    printLineOfChars(ch, i);
  }
  for (i = base - 1; i >= 1; i--) {
    printLineOfChars(ch, i);
  }
}


x86 assembly (clang, -O0):
<printSideWayTriangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1153 <printSideWayTriangle+0x43>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <printLineOfChars@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <printSideWayTriangle+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     1180 <printSideWayTriangle+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <printLineOfChars@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    115c <printSideWayTriangle+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSideWayTriangle>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1176 <printSideWayTriangle+0x66>
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%r12d
neg    %r12d
mov    $0x1,%ebx
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printLineOfChars@plt>
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1130 <printSideWayTriangle+0x20>
cmp    $0x2,%r15d
jl     1176 <printSideWayTriangle+0x66>
add    $0x1,%r15d
nopw   0x0(%rax,%rax,1)
lea    -0x2(%r15),%esi
mov    %r14,%rdi
call   1030 <printLineOfChars@plt>
add    $0xffffffff,%r15d
cmp    $0x2,%r15d
ja     1160 <printSideWayTriangle+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @printSideWayTriangle(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 1, i32* %5
store i32 1, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = call i32 @printLineOfChars(i8* %11, i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
store i32 %19, i32* %5
br label %20
20: ; preds = %27, %17
%21 = load i32, i32* %5
%22 = icmp sge i32 %21, 1
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = load i32, i32* %5
%26 = call i32 @printLineOfChars(i8* %24, i32 %25)
br label %27
27: ; preds = %23
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -1
store i32 %29, i32* %5
br label %20
30: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @printSideWayTriangle(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %16, label %6
4: ; preds = %6
%5 = icmp sgt i32 %1, 1
br i1 %5, label %11, label %16
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ 1, %2 ]
%8 = tail call i32 @printLineOfChars(i8* %0, i32 %7)
%9 = add nuw i32 %7, 1
%10 = icmp eq i32 %7, %1
br i1 %10, label %4, label %6
11: ; preds = %4, %11
%12 = phi i32 [ %13, %11 ], [ %1, %4 ]
%13 = add nsw i32 %12, -1
%14 = tail call i32 @printLineOfChars(i8* %0, i32 %13)
%15 = icmp ugt i32 %12, 2
br i1 %15, label %11, label %16
16: ; preds = %11, %2, %4
ret void
}