#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 i, j, k, n;
  printf("Enter Number : ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (j <= (n + 1 - i)) {
        if (i == 1 || j == 1 || j == (n + 1 - i))
          printf("* ");
        else
          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    0xece(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11fc <main+0xdc>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11e2 <main+0xc2>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     11cf <main+0xaf>
cmpl   $0x1,-0x8(%rbp)
je     11ad <main+0x8d>
cmpl   $0x1,-0xc(%rbp)
je     11ad <main+0x8d>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    11be <main+0x9e>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <main+0xaf>
jmp    11d4 <main+0xb4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11e0 <main+0xb0>
mov    $0x1,%r12d
lea    0xea5(%rip),%r14
lea    0xea1(%rip),%r15
jmp    119b <main+0x6b>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%r12d
mov    %ecx,%r12d
jge    11e0 <main+0xb0>
test   %eax,%eax
jle    1180 <main+0x50>
mov    $0x1,%ebp
sub    %r12d,%ebp
xor    %ecx,%ecx
jmp    11cd <main+0x9d>
nopl   0x0(%rax,%rax,1)
test   %ecx,%ecx
cmove  %r14,%rdi
cmp    $0x1,%r12d
cmove  %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
mov    %ebx,%ecx
cmp    %eax,%ebx
jge    1180 <main+0x50>
add    %ebp,%eax
lea    0x1(%rcx),%ebx
cmp    %eax,%ebx
jg     11c3 <main+0x93>
mov    %r14,%rdi
je     11b0 <main+0x80>
mov    %r15,%rdi
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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