#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 *);
int /*<<< orphan*/ printpaddedline(char *, int, int, char *);
void printtriangle(char *ch, int height) {
  char c = *ch;
  char pad = ' ';
  int base = 2 * height - 1;
  int i = 1;
  int j = 1;
  for (i = 1; i <= height; i++) {
    printpaddedline(ch, base, i, &pad);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printtriangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movb   $0x20,-0xe(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1196 <printtriangle+0x76>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0xe(%rbp),%rcx
call   1040 <printpaddedline@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <printtriangle+0x3d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printtriangle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movb   $0x20,0xf(%rsp)
test   %esi,%esi
jle    117c <printtriangle+0x5c>
mov    %esi,%ebx
mov    %rdi,%r14
lea    (%rbx,%rbx,1),%r12d
add    $0xffffffff,%r12d
neg    %ebx
mov    $0x1,%ebp
lea    0xf(%rsp),%r15
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printpaddedline@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1150 <printtriangle+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @printtriangle(i8* %0, i32 %1) {
%3 = alloca i8
store i8 32, i8* %3
%4 = shl nsw i32 %1, 1
%5 = add nsw i32 %4, -1
%6 = icmp slt i32 %1, 1
br i1 %6, label %13, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %11, %7 ], [ 1, %2 ]
%9 = call i32 @printpaddedline(i8* %0, i32 %5, i32 %8, i8* %3)
%10 = call i32 @putchar(i32 10)
%11 = add nuw i32 %8, 1
%12 = icmp eq i32 %8, %1
br i1 %12, label %13, label %7
13: ; preds = %7, %2
ret void
}