#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 /*<<< orphan*/ system(char *);
void main() {
  int i, j, k, n;
  printf("Enter the number if rows upto which pattern is to be printed.\n");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < n - i; j++) {
      printf(" ");
    }
    for (k = 0; k < i; k++) {
      system("COLOR 08");
      printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11ec <main+0xbc>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    1199 <main+0x69>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x3e>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d2 <main+0xa2>
lea    0xe91(%rip),%rdi
call   1030 <system@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a0 <main+0x70>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <main+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11de <main+0x9e>
mov    $0x1,%ebx
lea    0xe8a(%rip),%r14
nopl   0x0(%rax)
cmp    %ebx,%eax
jle    11a7 <main+0x67>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0xc(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,%ebp
jl     1190 <main+0x50>
mov    %ebx,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <system@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
mov    %ecx,%ebx
jl     1180 <main+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [63 x i8] c"Enter the number if rows upto which pattern is to be printed.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [9 x i8] c"COLOR 08\00"
@.str.4 = [2 x i8] c"*\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 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* %1
br label %7
7: ; preds = %36, %0
%8 = load i32, i32* %1
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %39
11: ; preds = %7
store i32 0, i32* %2
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = load i32, i32* %1
%16 = sub nsw i32 %14, %15
%17 = icmp slt 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
store i32 0, i32* %3
br label %24
24: ; preds = %31, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %1
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %28
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %24
34: ; preds = %24
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %7
39: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [9 x i8] c"COLOR 08\00"
@str = [62 x i8] c"Enter the number if rows upto which pattern is to be printed.\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 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 %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 %11, label %18
11: ; preds = %7, %11
%12 = phi i32 [ %14, %11 ], [ 0, %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 %14, %16
br i1 %17, label %11, label %18
18: ; preds = %11, %7
br label %19
19: ; preds = %18, %19
%20 = phi i32 [ %23, %19 ], [ 0, %18 ]
%21 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @putchar(i32 42)
%23 = add nuw nsw i32 %20, 1
%24 = icmp eq i32 %23, %9
br i1 %24, label %25, label %19
25: ; preds = %19
%26 = call i32 @putchar(i32 10)
%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 void
}