#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, n, k, p, z, h;
  scanf("%d", &n);
  z = 1;
  h = 1;
  for (i = 0; i < n; i++) {
    for (p = 0; p < n - z; p++) {
      printf(" ");
    }
    for (k = 0; k < 2 * h - 1; k++) {
      printf("^");
    }
    h++;
    z++;
    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
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f3 <main+0xd3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x18(%rbp),%ecx
cmp    %ecx,%eax
jge    1192 <main+0x72>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1167 <main+0x47>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c7 <main+0xa7>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1199 <main+0x79>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
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    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ce <main+0xae>
xor    %r14d,%r14d
mov    $0x1,%r15d
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
cmp    $0x2,%r15d
mov    $0x1,%ebp
cmovge %r15d,%ebp
cmp    %r12d,%eax
jle    11a0 <main+0x80>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
sub    %r12d,%eax
cmp    %eax,%ebx
jl     1180 <main+0x60>
nopl   0x0(%rax,%rax,1)
mov    $0x5e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x80>
add    $0x1,%r12d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0xc(%rsp),%eax
add    $0x2,%r15d
cmp    %eax,%r14d
jl     1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"^\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %6
store i32 1, i32* %7
store i32 0, i32* %2
br label %9
9: ; preds = %43, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %46
13: ; preds = %9
store i32 0, i32* %5
br label %14
14: ; preds = %22, %13
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = load i32, i32* %6
%18 = sub nsw i32 %16, %17
%19 = icmp slt i32 %15, %18
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %14
25: ; preds = %14
store i32 0, i32* %4
br label %26
26: ; preds = %34, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %7
%29 = mul nsw i32 2, %28
%30 = sub nsw i32 %29, 1
%31 = icmp slt i32 %27, %30
br i1 %31, label %32, label %37
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %26
37: ; preds = %26
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %37
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %9
46: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %33
6: ; preds = %0, %26
%7 = phi i32 [ %30, %26 ], [ %4, %0 ]
%8 = phi i32 [ %32, %26 ], [ 1, %0 ]
%9 = phi i32 [ %27, %26 ], [ 1, %0 ]
%10 = phi i32 [ %29, %26 ], [ 0, %0 ]
%11 = call i32 @llvm.smax.i32(i32 %8, i32 1)
%12 = icmp sgt i32 %7, %9
br i1 %12, label %13, label %20
13: ; preds = %6, %13
%14 = phi i32 [ %16, %13 ], [ 0, %6 ]
%15 = call i32 @putchar(i32 32)
%16 = add nuw nsw i32 %14, 1
%17 = load i32, i32* %1
%18 = sub nsw i32 %17, %9
%19 = icmp slt i32 %16, %18
br i1 %19, label %13, label %20
20: ; preds = %13, %6
br label %21
21: ; preds = %20, %21
%22 = phi i32 [ %24, %21 ], [ 0, %20 ]
%23 = call i32 @putchar(i32 94)
%24 = add nuw nsw i32 %22, 1
%25 = icmp eq i32 %24, %11
br i1 %25, label %26, label %21
26: ; preds = %21
%27 = add nuw nsw i32 %9, 1
%28 = call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %10, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
%32 = add nuw i32 %8, 2
br i1 %31, label %6, label %33
33: ; preds = %26, %0
ret i32 0
}