#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 /*<<< orphan*/ system(char *);
void main() {
  int i, j, k, x;
  printf("Enter X: ");
  scanf_s("%d", &x);
  for (i = 0; i < x; i++) {
    for (k = x - i - 1; k > 0; k--) {
      printf(" ");
    }
    for (j = 0; j < i + 1; j++) {
      printf("*");
    }
    printf("\n");
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf_s@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e3 <main+0xb3>
mov    -0x10(%rbp),%eax
sub    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1197 <main+0x67>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <main+0x43>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c9 <main+0x99>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119e <main+0x6e>
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <main+0x2b>
lea    0xe27(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf_s@plt>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jle    11dc <main+0x9c>
mov    $0x1,%r15d
xor    %r14d,%r14d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
not    %eax
add    %ebx,%eax
test   %eax,%eax
jle    11a2 <main+0x62>
add    %r14d,%ebx
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1190 <main+0x50>
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x70>
add    $0x1,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebx
add    $0x1,%r15d
add    $0xffffffff,%r14d
cmp    %ebp,%ebx
jg     1180 <main+0x40>
lea    0xe2a(%rip),%rdi
call   1040 <system@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter X: \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"
@.str.5 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 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* %4)
store i32 0, i32* %1
br label %7
7: ; preds = %37, %0
%8 = load i32, i32* %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %40
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %1
%14 = sub nsw i32 %12, %13
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %21, %11
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%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* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %16
24: ; preds = %16
store i32 0, i32* %2
br label %25
25: ; preds = %32, %24
%26 = load i32, i32* %2
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %25
35: ; preds = %25
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %1
%39 = add nsw i32 %38, 1
store i32 %39, i32* %1
br label %7
40: ; preds = %7
%41 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter X: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 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 sgt i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %0, %25
%8 = phi i32 [ %30, %25 ], [ 1, %0 ]
%9 = phi i32 [ %28, %25 ], [ %5, %0 ]
%10 = phi i32 [ %26, %25 ], [ 0, %0 ]
%11 = xor i32 %10, -1
%12 = add i32 %9, %11
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %7, %14
%15 = phi i32 [ %17, %14 ], [ %12, %7 ]
%16 = call i32 @putchar(i32 32)
%17 = add nsw i32 %15, -1
%18 = icmp ugt i32 %15, 1
br i1 %18, label %14, label %19
19: ; preds = %14, %7
br label %20
20: ; preds = %19, %20
%21 = phi i32 [ %23, %20 ], [ 0, %19 ]
%22 = call i32 @putchar(i32 42)
%23 = add nuw i32 %21, 1
%24 = icmp eq i32 %23, %8
br i1 %24, label %25, label %20
25: ; preds = %20
%26 = add nuw nsw i32 %10, 1
%27 = call i32 @putchar(i32 10)
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, %26
%30 = add nuw i32 %8, 1
br i1 %29, label %7, label %31
31: ; preds = %25, %0
%32 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}