#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 l;
  printf("Enter number of lines: ");
  scanf("%d", &l);
  int a, b, c;
  for (a = 0; a <= l; a++) {
    for (b = l - a; b > 0; b--)
      printf(" ");
    for (c = 0; c < (2 * a) - 1; c++)
      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    0xed6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11da <main+0xba>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    118b <main+0x6b>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1167 <main+0x47>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c0 <main+0xa0>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1192 <main+0x72>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%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    0xec9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
js     11f1 <main+0xc1>
xor    %r15d,%r15d
mov    $0xffffffff,%r12d
mov    $0x1,%r14d
jmp    11a2 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
mov    0xc(%rsp),%ebp
add    $0x2,%r12d
add    $0xffffffff,%r14d
cmp    %r15d,%ebp
mov    %eax,%r15d
jle    11f1 <main+0xc1>
cmp    $0x2,%r12d
mov    $0x1,%ebx
cmovge %r12d,%ebx
cmp    %r15d,%ebp
jle    11d2 <main+0xa2>
add    %r14d,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11c0 <main+0x90>
test   %r15d,%r15d
je     1180 <main+0x50>
nopw   0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11e0 <main+0xb0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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