#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 *);
main() {
  int i, j, n;
  printf("Enter the number of lines");
  scanf("%d", &n);
  for (i = 1; i <= n; i++, printf("\n")) {
    for (j = n; j <= i; j++) {
      if (j <= (n - i))
        printf(" ");
      else
        printf("* ");
    }
  }
}


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,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d0 <main+0xb0>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b1 <main+0x91>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     1192 <main+0x72>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <main+0x7e>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x83>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x44>
jmp    11b6 <main+0x96>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x32>
mov    -0x4(%rbp),%eax
add    $0x10,%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    11c7 <main+0x97>
mov    $0x1,%ebx
lea    0xeb4(%rip),%r14
jmp    1187 <main+0x57>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
mov    %ebp,%ebx
jge    11c7 <main+0x97>
cmp    %ebx,%eax
jg     1170 <main+0x40>
mov    %eax,%ebp
nopl   (%rax)
sub    %ebx,%eax
cmp    %eax,%ebp
jle    11b0 <main+0x80>
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    %ebp,%ebx
jne    11be <main+0x8e>
jmp    1170 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    %ebp,%ebx
je     1170 <main+0x40>
mov    0xc(%rsp),%eax
add    $0x1,%ebp
jmp    1190 <main+0x60>
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 lines\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 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
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* %2
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %36
11: ; preds = %7
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %28, %11
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
%22 = icmp sle i32 %18, %21
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %27
25: ; preds = %17
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %13
31: ; preds = %13
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %7
36: ; preds = %7
%37 = load i32, i32* %1
ret i32 %37
}

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