#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, space, counter1, counter2, arrows = 1;
  do {
    printf("n=");
    scanf("%d", &n);
    if (n < 2)
      printf("n must be >1!\n");
  } while (n < 2);
  space = n;
  for (counter1 = 0; counter1 <= n; counter1++) {
    for (counter2 = 0; counter2 != space; counter2++)
      printf(" ");
    arrows = counter1 * 2 - 1;
    for (counter2 = 0; counter2 < arrows; counter2++)
      printf("^");
    space--;
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1168 <main+0x48>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    116d <main+0x4d>
cmpl   $0x2,-0x8(%rbp)
jl     1136 <main+0x16>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1219 <main+0xf9>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11bd <main+0x9d>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <main+0x77>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11f6 <main+0xd6>
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d0 <main+0xb0>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
lea    0xe0d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1184 <main+0x64>
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    0xead(%rip),%r14
lea    0xea9(%rip),%r15
lea    0xc(%rsp),%rbp
lea    0xea0(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0x1,%ebx
jg     119d <main+0x5d>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ebx
cmp    $0x2,%ebx
jl     1170 <main+0x30>
xor    %r15d,%r15d
mov    $0xffffffff,%r12d
mov    %ebx,%r14d
jmp    11cf <main+0x8f>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
add    $0x2,%r12d
mov    %r14d,%ebx
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jge    1221 <main+0xe1>
cmp    $0x2,%r12d
mov    $0x1,%ebp
cmovge %r12d,%ebp
sub    $0x1,%r14d
jb     11ff <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xb0>
test   %r15d,%r15d
je     11b0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x5e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0xd0>
jmp    11b0 <main+0x70>
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"n=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"n must be >1!\0A\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"^\00"
@.str.5 = [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
store i32 0, i32* %1
store i32 1, i32* %6
br label %7
7: ; preds = %15, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 2
br i1 %17, label %7, label %18
18: ; preds = %15
%19 = load i32, i32* %2
store i32 %19, i32* %3
store i32 0, i32* %4
br label %20
20: ; preds = %51, %18
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %54
24: ; preds = %20
store i32 0, i32* %5
br label %25
25: ; preds = %31, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %25
34: ; preds = %25
%35 = load i32, i32* %4
%36 = mul nsw i32 %35, 2
%37 = sub nsw i32 %36, 1
store i32 %37, i32* %6
store i32 0, i32* %5
br label %38
38: ; preds = %44, %34
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %38
47: ; preds = %38
%48 = load i32, i32* %3
%49 = add nsw i32 %48, -1
store i32 %49, i32* %3
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %51
51: ; preds = %47
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %20
54: ; preds = %20
ret i32 0
}

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