#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*/ scanf(char *, char *);
int main() {
  int i, j;
  char input, temp = 'A';
  printf("Enter uppercase character you want in triangle at last row: ");
  scanf("%c", &input);
  for (i = 1; i <= (input - 'A' + 1); ++i) {
    for (j = 1; j <= i; ++j)
      printf("%c", temp);
    ++temp;
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0xe(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0xd(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0xd(%rbp),%ecx
sub    $0x41,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     11c4 <main+0xa4>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a0 <main+0x80>
movsbl -0xe(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x54>
mov    -0xe(%rbp),%al
add    $0x1,%al
mov    %al,-0xe(%rbp)
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x38>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
cmpb   $0x41,0xf(%rsp)
jl     11ad <main+0x7d>
mov    $0x1,%r14d
mov    $0x41,%ebx
nopl   0x0(%rax)
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x50>
add    $0x1,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r14),%eax
movsbl 0xf(%rsp),%ecx
add    $0xffffffc0,%ecx
cmp    %ecx,%r14d
mov    %eax,%r14d
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Enter uppercase character you want in triangle at last row: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i32 0, i32* %1
store i8 65, i8* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
store i32 1, i32* %2
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %2
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 65
%13 = add nsw i32 %12, 1
%14 = icmp sle i32 %9, %13
br i1 %14, label %15, label %34
15: ; preds = %8
store i32 1, i32* %3
br label %16
16: ; preds = %24, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %16
27: ; preds = %16
%28 = load i8, i8* %5
%29 = add i8 %28, 1
store i8 %29, i8* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %27
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %8
34: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [61 x i8] c"Enter uppercase character you want in triangle at last row: \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp slt i8 %4, 65
br i1 %5, label %24, label %6
6: ; preds = %0, %15
%7 = phi i32 [ %16, %15 ], [ 65, %0 ]
%8 = phi i32 [ %23, %15 ], [ 2, %0 ]
%9 = phi i32 [ %18, %15 ], [ 1, %0 ]
br label %10
10: ; preds = %6, %10
%11 = phi i32 [ 1, %6 ], [ %13, %10 ]
%12 = call i32 @putchar(i32 %7)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %8
br i1 %14, label %15, label %10
15: ; preds = %10
%16 = add nuw nsw i32 %7, 1
%17 = call i32 @putchar(i32 10)
%18 = add nuw nsw i32 %9, 1
%19 = load i8, i8* %1
%20 = sext i8 %19 to i32
%21 = add nsw i32 %20, -64
%22 = icmp slt i32 %9, %21
%23 = add nuw nsw i32 %8, 1
br i1 %22, label %6, label %24
24: ; preds = %15, %0
ret i32 0
}