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


x86 assembly (clang, -O0):
<printinvertedtriangle>:
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)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    1193 <printinvertedtriangle+0x73>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0xe(%rbp),%rcx
call   1040 <printpaddedline@plt>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <printinvertedtriangle+0x3c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printinvertedtriangle>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movb   $0x20,0x7(%rsp)
test   %esi,%esi
jle    1163 <printinvertedtriangle+0x43>
mov    %esi,%ebx
mov    %rdi,%r14
lea    (%rbx,%rbx,1),%ebp
add    $0xffffffff,%ebp
lea    0x7(%rsp),%r15
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15,%rcx
call   1040 <printpaddedline@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1140 <printinvertedtriangle+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @printinvertedtriangle(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
%15 = load i32, i32* %4
store i32 %15, i32* %8
br label %16
16: ; preds = %25, %2
%17 = load i32, i32* %8
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %16
%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 %16
28: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @printinvertedtriangle(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 sgt i32 %1, 0
br i1 %6, label %7, label %13
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 nsw i32 %8, -1
%12 = icmp ugt i32 %8, 1
br i1 %12, label %7, label %13
13: ; preds = %7, %2
ret void
}