#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_s(char *, int *);
int main() {
  int n, c, k;
  printf("Enter number of rows\n");
  scanf_s("%d", &n);
  for (c = 1; c <= n; c++) {
    for (k = 1; k <= n - c; k++)
      printf(" ");
    for (k = 1; k < c; k++)
      printf("*A");
    printf("*\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf_s@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d7 <main+0xb7>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1190 <main+0x70>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1165 <main+0x45>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bd <main+0x9d>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1197 <main+0x77>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
lea    0xea1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf_s@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11df <main+0x9f>
mov    $0x1,%ebp
xor    %r15d,%r15d
lea    0xe83(%rip),%r12
lea    0xe94(%rip),%r14
jmp    11a9 <main+0x69>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x1(%rbp),%ecx
mov    0xc(%rsp),%eax
add    $0x1,%r15d
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    11df <main+0x9f>
cmp    %ebp,%eax
jle    11c7 <main+0x87>
xor    %ebx,%ebx
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     11b0 <main+0x70>
mov    %r15d,%ebx
cmp    $0x2,%ebp
jb     1190 <main+0x50>
nop
mov    %r12,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x90>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter number of rows\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"*A\00"
@.str.4 = [3 x i8] c"*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %7
7: ; preds = %35, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %38
11: ; preds = %7
store i32 1, i32* %4
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = icmp sle i32 %13, %16
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %12
23: ; preds = %12
store i32 1, i32* %4
br label %24
24: ; preds = %30, %23
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %24
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %7
38: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"*A\00"
@str = [21 x i8] c"Enter number of rows\00"
@str.5 = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %30, label %7
7: ; preds = %0, %25
%8 = phi i32 [ %28, %25 ], [ %5, %0 ]
%9 = phi i32 [ %27, %25 ], [ 1, %0 ]
%10 = icmp sgt i32 %8, %9
br i1 %10, label %13, label %11
11: ; preds = %13, %7
%12 = icmp ugt i32 %9, 1
br i1 %12, label %20, label %25
13: ; preds = %7, %13
%14 = phi i32 [ %16, %13 ], [ 1, %7 ]
%15 = call i32 @putchar(i32 32)
%16 = add nuw nsw i32 %14, 1
%17 = load i32, i32* %1
%18 = sub nsw i32 %17, %9
%19 = icmp slt i32 %14, %18
br i1 %19, label %13, label %11
20: ; preds = %11, %20
%21 = phi i32 [ %23, %20 ], [ 1, %11 ]
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %23, %9
br i1 %24, label %25, label %20
25: ; preds = %20, %11
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%27 = add nuw nsw i32 %9, 1
%28 = load i32, i32* %1
%29 = icmp slt i32 %9, %28
br i1 %29, label %7, label %30
30: ; preds = %25, %0
ret i32 0
}