#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 *, int *);
int main() {
  int j, row, n;
  printf("Enter the number of rows ");
  scanf("%d", &n);
  for (row = 1; row <= n; row++) {
    for (j = 1; j <= n - row; j++) {
      printf(" ");
    }
    if (row == 1) {
      printf("*");
    } else {
      for (j = 1; j <= row - 1; j++) {
        printf("*A");
      }
      printf("*");
    }
    for (j = 1; j <= n - row; j++) {
      printf(" ");
    }
    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    0xed8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1235 <main+0x115>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1190 <main+0x70>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x45>
cmpl   $0x1,-0xc(%rbp)
jne    11ab <main+0x8b>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <main+0xc9>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11dd <main+0xbd>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b2 <main+0x92>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     121b <main+0xfb>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f0 <main+0xd0>
lea    0xe00(%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   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    120c <main+0xdc>
mov    $0x1,%ebp
xor    %r14d,%r14d
lea    0xeae(%rip),%r15
jmp    119b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ecx
mov    0x4(%rsp),%eax
add    $0x1,%r14d
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    120c <main+0xdc>
cmp    %ebp,%eax
jle    11c7 <main+0x97>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     11b0 <main+0x80>
cmp    $0x1,%ebp
je     11dd <main+0xad>
mov    %r14d,%ebx
nop
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0xa0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmp    %ebp,0x4(%rsp)
jle    1180 <main+0x50>
xor    %ebx,%ebx
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     11f0 <main+0xc0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Enter the number of rows \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [3 x i8] c"*A\00"
@.str.5 = [2 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 ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 1, i32* %3
br label %7
7: ; preds = %55, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %58
11: ; preds = %7
store i32 1, i32* %2
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%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* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %12
23: ; preds = %12
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %41
28: ; preds = %23
store i32 1, i32* %2
br label %29
29: ; preds = %36, %28
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = sub nsw i32 %31, 1
%33 = icmp sle i32 %30, %32
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %29
39: ; preds = %29
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %26
store i32 1, i32* %2
br label %42
42: ; preds = %50, %41
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = load i32, i32* %3
%46 = sub nsw i32 %44, %45
%47 = icmp sle i32 %43, %46
br i1 %47, label %48, label %53
48: ; preds = %42
%49 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %42
53: ; preds = %42
%54 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %55
55: ; preds = %53
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %7
58: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Enter the number of rows \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"*A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(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 %41, label %7
7: ; preds = %0, %36
%8 = phi i32 [ %39, %36 ], [ %5, %0 ]
%9 = phi i32 [ %38, %36 ], [ 1, %0 ]
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %7, %11
%12 = phi i32 [ %14, %11 ], [ 1, %7 ]
%13 = call i32 @putchar(i32 32)
%14 = add nuw nsw i32 %12, 1
%15 = load i32, i32* %1
%16 = sub nsw i32 %15, %9
%17 = icmp slt i32 %12, %16
br i1 %17, label %11, label %18
18: ; preds = %11, %7
%19 = icmp eq i32 %9, 1
br i1 %19, label %25, label %20
20: ; preds = %18, %20
%21 = phi i32 [ %23, %20 ], [ 1, %18 ]
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, 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, %18
%26 = call i32 @putchar(i32 42)
%27 = load i32, i32* %1
%28 = icmp sgt i32 %27, %9
br i1 %28, label %29, label %36
29: ; preds = %25, %29
%30 = phi i32 [ %32, %29 ], [ 1, %25 ]
%31 = call i32 @putchar(i32 32)
%32 = add nuw nsw i32 %30, 1
%33 = load i32, i32* %1
%34 = sub nsw i32 %33, %9
%35 = icmp slt i32 %30, %34
br i1 %35, label %29, label %36
36: ; preds = %29, %25
%37 = call i32 @putchar(i32 10)
%38 = add nuw nsw i32 %9, 1
%39 = load i32, i32* %1
%40 = icmp slt i32 %9, %39
br i1 %40, label %7, label %41
41: ; preds = %36, %0
ret i32 0
}