#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 rightAngledTriangleLeft(int n, char ch) {
  int row;
  int col;
  for (row = 1; row <= n; row++) {
    for (col = 1; col <= row; col++)
      printf("%c", ch);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<rightAngledTriangleLeft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1183 <rightAngledTriangleLeft+0x73>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1167 <rightAngledTriangleLeft+0x57>
movsbl -0x5(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <rightAngledTriangleLeft+0x2b>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <rightAngledTriangleLeft+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rightAngledTriangleLeft>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1176 <rightAngledTriangleLeft+0x66>
mov    %edi,%r14d
movsbl %sil,%ebp
add    $0x1,%r14d
mov    $0x2,%r15d
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1150 <rightAngledTriangleLeft+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
add    $0x1,%r12d
cmp    %r14d,%r15d
mov    %eax,%r15d
jne    1140 <rightAngledTriangleLeft+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @rightAngledTriangleLeft(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8 %1, i8* %4
store i32 1, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %7
store i32 1, i32* %6
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %16
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %12
23: ; preds = %12
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @rightAngledTriangleLeft(i32 %0, i8 signext %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = sext i8 %1 to i32
%6 = add i32 %0, 1
br label %7
7: ; preds = %4, %14
%8 = phi i32 [ 2, %4 ], [ %16, %14 ]
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ 1, %7 ], [ %12, %9 ]
%11 = tail call i32 @putchar(i32 %5)
%12 = add nuw i32 %10, 1
%13 = icmp eq i32 %12, %8
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = tail call i32 @putchar(i32 10)
%16 = add nuw i32 %8, 1
%17 = icmp eq i32 %8, %6
br i1 %17, label %18, label %7
18: ; preds = %14, %2
ret void
}