#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, temp, row, n;
  printf("Enter the number of rows ");
  scanf("%d", &n);
  temp = 0;
  for (row = 1; row <= n; row++) {
    for (j = 1; j <= n - row; j++) {
      printf(" ");
    }
    for (j = 1; j <= row + temp; j++) {
      printf("*");
    }
    temp++;
    for (j = 1; j <= n - row; j++) {
      printf(" ");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     121e <main+0xfe>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     1197 <main+0x77>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116c <main+0x4c>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     11c9 <main+0xa9>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119e <main+0x7e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     1204 <main+0xe4>
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d9 <main+0xb9>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11fc <main+0xcc>
mov    $0x1,%r14d
mov    $0x1,%ebx
jmp    118b <main+0x5b>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
add    $0x2,%r14d
cmp    %eax,%ebx
mov    %ecx,%ebx
jge    11fc <main+0xcc>
cmp    %ebx,%eax
jle    11b7 <main+0x87>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
sub    %ebx,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     11a0 <main+0x70>
mov    %r14d,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x90>
cmp    %ebx,0xc(%rsp)
jle    1170 <main+0x40>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
sub    %ebx,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     11e0 <main+0xb0>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
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 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 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), i32* %5)
store i32 0, i32* %3
store i32 1, i32* %4
br label %8
8: ; preds = %52, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %55
12: ; preds = %8
store i32 1, i32* %2
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %2
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = sub nsw i32 %15, %16
%18 = icmp sle i32 %14, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %13
24: ; preds = %13
store i32 1, i32* %2
br label %25
25: ; preds = %33, %24
%26 = load i32, i32* %2
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = add nsw i32 %27, %28
%30 = icmp sle i32 %26, %29
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %25
36: ; preds = %25
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
store i32 1, i32* %2
br label %39
39: ; preds = %47, %36
%40 = load i32, i32* %2
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = sub nsw i32 %41, %42
%44 = icmp sle i32 %40, %43
br i1 %44, label %45, label %50
45: ; preds = %39
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %39
50: ; preds = %39
%51 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
store i32 %54, i32* %4
br label %8
55: ; preds = %8
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"
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, %35
%8 = phi i32 [ %38, %35 ], [ %5, %0 ]
%9 = phi i32 [ %40, %35 ], [ 2, %0 ]
%10 = phi i32 [ %37, %35 ], [ 1, %0 ]
%11 = icmp sgt i32 %8, %10
br i1 %11, label %12, label %19
12: ; preds = %7, %12
%13 = phi i32 [ %15, %12 ], [ 1, %7 ]
%14 = call i32 @putchar(i32 32)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = sub nsw i32 %16, %10
%18 = icmp slt i32 %13, %17
br i1 %18, label %12, label %19
19: ; preds = %12, %7
br label %20
20: ; preds = %19, %20
%21 = phi i32 [ %23, %20 ], [ 1, %19 ]
%22 = call i32 @putchar(i32 42)
%23 = add nuw i32 %21, 1
%24 = icmp eq i32 %23, %9
br i1 %24, label %25, label %20
25: ; preds = %20
%26 = load i32, i32* %1
%27 = icmp sgt i32 %26, %10
br i1 %27, label %28, label %35
28: ; preds = %25, %28
%29 = phi i32 [ %31, %28 ], [ 1, %25 ]
%30 = call i32 @putchar(i32 32)
%31 = add nuw nsw i32 %29, 1
%32 = load i32, i32* %1
%33 = sub nsw i32 %32, %10
%34 = icmp slt i32 %29, %33
br i1 %34, label %28, label %35
35: ; preds = %28, %25
%36 = call i32 @putchar(i32 10)
%37 = add nuw nsw i32 %10, 1
%38 = load i32, i32* %1
%39 = icmp slt i32 %10, %38
%40 = add i32 %9, 2
br i1 %39, label %7, label %41
41: ; preds = %35, %0
ret i32 0
}