#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 n, i = 1, s = 0, p = 0;
  printf("Enter n:");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (s = 1; s <= n - i; s++)
      printf("  ");
    for (p = 0; p != 2 * i - 1;) {
      printf("* ");
      p++;
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f4 <main+0xd4>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     11a5 <main+0x85>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <main+0x5a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11da <main+0xba>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ac <main+0x8c>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <main+0x47>
mov    -0x4(%rbp),%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    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11d8 <main+0xa8>
mov    $0x1,%r15d
lea    0xe9e(%rip),%r14
lea    0xe9a(%rip),%r12
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%ebx
cmp    %ebp,%eax
jle    11b0 <main+0x80>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     1190 <main+0x60>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ecx
mov    0xc(%rsp),%eax
add    $0x2,%r15d
cmp    %eax,%ebp
mov    %ecx,%ebp
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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