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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11e3 <main+0xc3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11a2 <main+0x82>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11d2 <main+0xb2>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11ae <main+0x8e>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
je     11c8 <main+0x98>
xor    %ebx,%ebx
mov    $0xffffffff,%r15d
nopl   0x0(%rax)
lea    0x1(%rbx),%r14d
cmp    %r14d,%ebp
je     1191 <main+0x61>
add    $0xffffffff,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1180 <main+0x50>
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebp
add    $0xfffffffe,%r15d
mov    %r14d,%ebx
cmp    %ebp,%r14d
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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