#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, l;
  printf("Input triangle height: ");
  scanf("%d", &n);
  while (n < 2)
    printf("How do you expect me to create a text triangle with less than 2 "
           "characters height?");
  for (i = 0; i < n; i++) {
    for (l = 0; l <= (n + 1 + i); l++) {
      if (l == (n + 1) && i == 0)
        printf(".\n");
      else if (l == (n + 1 - i))
        printf("/");
      else if (l == (n + 1 + i))
        printf("\\\n");
      else if (i == n - 1 && l > (n + 1 - i) && l < (n + 1 + i))
        printf("_");
      else
        printf(" ");
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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>
cmpl   $0x2,-0x8(%rbp)
jge    1166 <main+0x46>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
jmp    114b <main+0x2b>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1295 <main+0x175>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1282 <main+0x162>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11c0 <main+0xa0>
cmpl   $0x0,-0xc(%rbp)
jne    11c0 <main+0xa0>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    126f <main+0x14f>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    11e5 <main+0xc5>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x14a>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    120a <main+0xea>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    1265 <main+0x145>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1254 <main+0x134>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jle    1254 <main+0x134>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1254 <main+0x134>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
jmp    1260 <main+0x140>
lea    0xdbb(%rip),%rdi
call   1030 <printf@plt>
jmp    1265 <main+0x145>
jmp    126a <main+0x14a>
jmp    126f <main+0x14f>
jmp    1274 <main+0x154>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1180 <main+0x60>
jmp    1287 <main+0x167>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116d <main+0x4d>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jg     1191 <main+0x51>
lea    0xea7(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jl     1180 <main+0x40>
xor    %ebx,%ebx
lea    0xed6(%rip),%r15
lea    0xecd(%rip),%r14
jmp    11b7 <main+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
cmp    %eax,%ebx
jge    1236 <main+0xf6>
lea    0x1(%rax),%edx
mov    %edx,%ecx
add    %ebx,%ecx
js     11b0 <main+0x70>
mov    $0xffffffff,%ebp
jmp    11e9 <main+0xa9>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
lea    0x1(%rax),%edx
lea    (%rax,%rbx,1),%ecx
add    $0x1,%ecx
cmp    %ecx,%ebp
jge    11b0 <main+0x70>
add    $0x1,%ebp
cmp    %edx,%ebp
jne    11f4 <main+0xb4>
test   %ebx,%ebx
je     11d0 <main+0x90>
sub    %ebx,%edx
cmp    %edx,%ebp
jne    1210 <main+0xd0>
mov    $0x2f,%edi
call   1030 <putchar@plt>
jmp    11d8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
cmp    %ecx,%ebp
jne    1219 <main+0xd9>
mov    %r14,%rdi
jmp    11d3 <main+0x93>
add    $0xffffffff,%eax
cmp    %eax,%ebx
jne    122f <main+0xef>
cmp    %edx,%ebp
jle    122f <main+0xef>
cmp    %ecx,%ebp
jge    122f <main+0xef>
mov    $0x5f,%edi
jmp    11ff <main+0xbf>
mov    $0x20,%edi
jmp    11ff <main+0xbf>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Input triangle height: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [83 x i8] c"How do you expect me to create a text triangle with less than 2 characters height?\00"
@.str.3 = [3 x i8] c".\0A\00"
@.str.4 = [2 x i8] c"/\00"
@.str.5 = [3 x i8] c"\\\0A\00"
@.str.6 = [2 x i8] c"_\00"
@.str.7 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 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 = %10, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
br label %7
12: ; preds = %7
store i32 0, i32* %3
br label %13
13: ; preds = %84, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %87
17: ; preds = %13
store i32 0, i32* %4
br label %18
18: ; preds = %80, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
%24 = icmp sle i32 %19, %23
br i1 %24, label %25, label %83
25: ; preds = %18
%26 = load i32, i32* %4
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
%29 = icmp eq i32 %26, %28
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %79
35: ; preds = %30, %25
%36 = load i32, i32* %4
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %3
%40 = sub nsw i32 %38, %39
%41 = icmp eq i32 %36, %40
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %78
44: ; preds = %35
%45 = load i32, i32* %4
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %3
%49 = add nsw i32 %47, %48
%50 = icmp eq i32 %45, %49
br i1 %50, label %51, label %53
51: ; preds = %44
%52 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %77
53: ; preds = %44
%54 = load i32, i32* %3
%55 = load i32, i32* %2
%56 = sub nsw i32 %55, 1
%57 = icmp eq i32 %54, %56
br i1 %57, label %58, label %74
58: ; preds = %53
%59 = load i32, i32* %4
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
%62 = load i32, i32* %3
%63 = sub nsw i32 %61, %62
%64 = icmp sgt i32 %59, %63
br i1 %64, label %65, label %74
65: ; preds = %58
%66 = load i32, i32* %4
%67 = load i32, i32* %2
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %3
%70 = add nsw i32 %68, %69
%71 = icmp slt i32 %66, %70
br i1 %71, label %72, label %74
72: ; preds = %65
%73 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %76
74: ; preds = %65, %58, %53
%75 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %76
76: ; preds = %74, %72
br label %77
77: ; preds = %76, %51
br label %78
78: ; preds = %77, %42
br label %79
79: ; preds = %78, %33
br label %80
80: ; preds = %79
%81 = load i32, i32* %4
%82 = add nsw i32 %81, 1
store i32 %82, i32* %4
br label %18
83: ; preds = %18
br label %84
84: ; preds = %83
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
store i32 %86, i32* %3
br label %13
87: ; preds = %13
ret i32 1
}

LLVM IR (-O2):
@.str = [24 x i8] c"Input triangle height: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [83 x i8] c"How do you expect me to create a text triangle with less than 2 characters height?\00"
@str = [2 x i8] c"\\\00"
@str.8 = [2 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 ([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, 2
br i1 %6, label %7, label %11
7: ; preds = %0, %7
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 2
br i1 %10, label %7, label %11
11: ; preds = %7, %0
%12 = phi i32 [ %5, %0 ], [ %9, %7 ]
br label %13
13: ; preds = %11, %56
%14 = phi i32 [ %57, %56 ], [ %12, %11 ]
%15 = phi i32 [ %58, %56 ], [ 0, %11 ]
%16 = add nsw i32 %14, 1
%17 = add nsw i32 %16, %15
%18 = icmp slt i32 %17, 0
br i1 %18, label %56, label %19
19: ; preds = %13
%20 = icmp eq i32 %15, 0
br label %21
21: ; preds = %19, %50
%22 = phi i32 [ %17, %19 ], [ %54, %50 ]
%23 = phi i32 [ %16, %19 ], [ %53, %50 ]
%24 = phi i32 [ %14, %19 ], [ %52, %50 ]
%25 = phi i32 [ 0, %19 ], [ %51, %50 ]
%26 = icmp eq i32 %25, %23
%27 = select i1 %26, i1 %20, i1 false
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
br label %50
30: ; preds = %21
%31 = sub nsw i32 %23, %15
%32 = icmp eq i32 %25, %31
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @putchar(i32 47)
br label %50
35: ; preds = %30
%36 = icmp eq i32 %25, %22
br i1 %36, label %37, label %39
37: ; preds = %35
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %50
39: ; preds = %35
%40 = add nsw i32 %24, -1
%41 = icmp eq i32 %15, %40
%42 = icmp sgt i32 %25, %31
%43 = select i1 %41, i1 %42, i1 false
%44 = icmp slt i32 %25, %22
%45 = select i1 %43, i1 %44, i1 false
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = call i32 @putchar(i32 95)
br label %50
48: ; preds = %39
%49 = call i32 @putchar(i32 32)
br label %50
50: ; preds = %28, %37, %48, %46, %33
%51 = add nuw nsw i32 %25, 1
%52 = load i32, i32* %1
%53 = add nsw i32 %52, 1
%54 = add nsw i32 %53, %15
%55 = icmp slt i32 %25, %54
br i1 %55, label %21, label %56
56: ; preds = %50, %13
%57 = phi i32 [ %14, %13 ], [ %52, %50 ]
%58 = add nuw nsw i32 %15, 1
%59 = icmp slt i32 %58, %57
br i1 %59, label %13, label %60
60: ; preds = %56
ret i32 1
}