#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ A_NORMAL;
int COLS;
scalar_t__ ERR;
int LINES;
int /*<<< orphan*/ TRUE;
int abs(int);
int /*<<< orphan*/ attrset(int /*<<< orphan*/);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
scalar_t__ getch();
scalar_t__ has_colors();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvprintw(int, int, char *);
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int rand();
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int time(int /*<<< orphan*/ *);
int main() {
  int start, end, row, diff, flag, direction, seed;
  int myrefresh();
  void explode();
  initscr();
  nodelay(stdscr, TRUE);
  noecho();
  if (has_colors())
    start_color();
  seed = time((time_t *)0);
  srand(seed);
  while (getch() == ERR) {
    do {
      start = rand() % (COLS - 3);
      end = rand() % (COLS - 3);
      start = (start < 2) ? 2 : start;
      end = (end < 2) ? 2 : end;
      direction = (start > end) ? -1 : 1;
      diff = abs(start - end);
    } while (diff < 2 || diff >= LINES - 2);
    attrset(A_NORMAL);
    for (row = 0; row < diff; row++) {
      mvprintw(LINES - row, start + (row * direction),
               (direction < 0) ? "\\" : "/");
      if (flag++) {
        myrefresh();
        clear();
        flag = 0;
      }
    }
    if (flag++) {
      myrefresh();
      flag = 0;
    }
    seed = time((time_t *)0);
    srand(seed);
    explode(LINES - row, start + (diff * direction));
    clear();
    myrefresh();
  }
  endwin();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <initscr@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
call   10a0 <nodelay@plt>
mov    $0x0,%al
call   10e0 <noecho@plt>
mov    $0x0,%al
call   1030 <has_colors@plt>
cmp    $0x0,%rax
je     124c <main+0x4c>
mov    $0x0,%al
call   1060 <start_color@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1080 <srand@plt>
mov    $0x0,%al
call   10b0 <getch@plt>
mov    0x2d72(%rip),%rcx
cmp    (%rcx),%rax
jne    1445 <main+0x245>
jmp    127c <main+0x7c>
mov    $0x0,%al
call   1110 <rand@plt>
mov    0x2d36(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    0x2d1d(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    12c5 <main+0xc5>
mov    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    12cb <main+0xcb>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    12e8 <main+0xe8>
mov    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    12ee <main+0xee>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%esi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovg  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1040 <abs@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%al
cmpl   $0x2,-0x14(%rbp)
mov    %al,-0x29(%rbp)
jl     1340 <main+0x140>
mov    -0x14(%rbp),%eax
mov    0x2ca5(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
setge  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    127c <main+0x7c>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
call   10d0 <attrset@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13dd <main+0x1dd>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
sub    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%eax
imul   -0x1c(%rbp),%eax
add    %eax,%esi
mov    -0x1c(%rbp),%ecx
lea    0xc74(%rip),%rdx
lea    0xc6b(%rip),%rax
cmp    $0x0,%ecx
cmovl  %rax,%rdx
call   1100 <mvprintw@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     13ca <main+0x1ca>
mov    $0x0,%al
call   1120 <myrefresh@plt>
mov    $0x0,%al
call   10f0 <clear@plt>
movl   $0x0,-0x18(%rbp)
jmp    13cf <main+0x1cf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1360 <main+0x160>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     13ff <main+0x1ff>
mov    $0x0,%al
call   1120 <myrefresh@plt>
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1080 <srand@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
sub    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%eax
imul   -0x1c(%rbp),%eax
add    %eax,%esi
mov    $0x0,%al
call   1070 <explode@plt>
mov    $0x0,%al
call   10f0 <clear@plt>
mov    $0x0,%al
call   1120 <myrefresh@plt>
jmp    1260 <main+0x60>
mov    $0x0,%al
call   10c0 <endwin@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
call   1090 <nodelay@plt>
xor    %eax,%eax
call   10d0 <noecho@plt>
xor    %eax,%eax
call   1030 <has_colors@plt>
test   %rax,%rax
je     1233 <main+0x43>
xor    %eax,%eax
call   1050 <start_color@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
mov    0x2d91(%rip),%rcx
cmp    (%rcx),%rax
jne    13ae <main+0x1be>
mov    0x2d61(%rip),%r13
jmp    12c0 <main+0xd0>
mov    $0x1,%r15d
mov    0x2d52(%rip),%r13
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
sub    %r12d,%edi
imul   %r12d,%r14d
add    %ebx,%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <explode@plt>
xor    %eax,%eax
call   10e0 <clear@plt>
xor    %eax,%eax
call   1110 <myrefresh@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
mov    0x2d2b(%rip),%rcx
cmp    (%rcx),%rax
jne    13ae <main+0x1be>
xchg   %ax,%ax
xor    %eax,%eax
call   1100 <rand@plt>
mov    0x0(%r13),%ecx
add    $0xfffffffd,%ecx
cltd
idiv   %ecx
mov    %edx,%ebx
xor    %eax,%eax
call   1100 <rand@plt>
mov    0x0(%r13),%ecx
add    $0xfffffffd,%ecx
cltd
idiv   %ecx
mov    %edx,%ebp
cmp    $0x3,%ebx
jge    12f0 <main+0x100>
mov    $0x2,%ebx
cmp    $0x3,%ebp
jge    12fa <main+0x10a>
mov    $0x2,%ebp
mov    %ebx,%eax
sub    %ebp,%eax
mov    %eax,%r12d
neg    %r12d
cmovs  %eax,%r12d
mov    0x2cc9(%rip),%rax
mov    (%rax),%eax
add    $0xfffffffe,%eax
cmp    $0x2,%r12d
jb     12c0 <main+0xd0>
cmp    %eax,%r12d
jge    12c0 <main+0xd0>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10c0 <attrset@plt>
xor    %eax,%eax
cmp    %ebp,%ebx
setbe  %al
lea    -0x1(%rax,%rax,1),%r14d
lea    0xcc2(%rip),%rbp
lea    0xcb9(%rip),%rax
cmova  %rax,%rbp
xor    %r13d,%r13d
jmp    136e <main+0x17e>
xor    %r15d,%r15d
xor    %eax,%eax
call   1110 <myrefresh@plt>
xor    %eax,%eax
call   10e0 <clear@plt>
add    $0x1,%r13d
cmp    %r12d,%r13d
je     1261 <main+0x71>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
sub    %r13d,%edi
mov    %r13d,%esi
imul   %r14d,%esi
add    %ebx,%esi
mov    %rbp,%rdx
call   10f0 <mvprintw@plt>
test   %r15d,%r15d
jne    1350 <main+0x160>
add    $0x1,%r13d
mov    $0x1,%r15d
cmp    %r12d,%r13d
jne    136e <main+0x17e>
xor    %r15d,%r15d
xor    %eax,%eax
call   1110 <myrefresh@plt>
jmp    1267 <main+0x77>
xor    %eax,%eax
call   10b0 <endwin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@ERR = global i64 0
@COLS = global i32 0
@LINES = global i32 0
@A_NORMAL = global i32 0
@.str = [2 x i8] c"\\\00"
@.str.1 = [2 x i8] c"/\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
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (...) @initscr()
%10 = load i32, i32* @stdscr
%11 = load i32, i32* @TRUE
%12 = call i32 @nodelay(i32 %10, i32 %11)
%13 = call i32 (...) @noecho()
%14 = call i64 (...) @has_colors()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (...) @start_color()
br label %18
18: ; preds = %16, %0
%19 = call i32 @time(i32* null)
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = call i32 @srand(i32 %20)
br label %22
22: ; preds = %106, %18
%23 = call i64 (...) @getch()
%24 = load i64, i64* @ERR
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %120
26: ; preds = %22
br label %27
27: ; preds = %67, %26
%28 = call i32 (...) @rand()
%29 = load i32, i32* @COLS
%30 = sub nsw i32 %29, 3
%31 = srem i32 %28, %30
store i32 %31, i32* %2
%32 = call i32 (...) @rand()
%33 = load i32, i32* @COLS
%34 = sub nsw i32 %33, 3
%35 = srem i32 %32, %34
store i32 %35, i32* %3
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 2
br i1 %37, label %38, label %39
38: ; preds = %27
br label %41
39: ; preds = %27
%40 = load i32, i32* %2
br label %41
41: ; preds = %39, %38
%42 = phi i32 [ 2, %38 ], [ %40, %39 ]
store i32 %42, i32* %2
%43 = load i32, i32* %3
%44 = icmp slt i32 %43, 2
br i1 %44, label %45, label %46
45: ; preds = %41
br label %48
46: ; preds = %41
%47 = load i32, i32* %3
br label %48
48: ; preds = %46, %45
%49 = phi i32 [ 2, %45 ], [ %47, %46 ]
store i32 %49, i32* %3
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = icmp sgt i32 %50, %51
%53 = zext i1 %52 to i64
%54 = select i1 %52, i32 -1, i32 1
store i32 %54, i32* %7
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = sub nsw i32 %55, %56
%58 = call i32 @abs(i32 %57)
store i32 %58, i32* %5
br label %59
59: ; preds = %48
%60 = load i32, i32* %5
%61 = icmp slt i32 %60, 2
br i1 %61, label %67, label %62
62: ; preds = %59
%63 = load i32, i32* %5
%64 = load i32, i32* @LINES
%65 = sub nsw i32 %64, 2
%66 = icmp sge i32 %63, %65
br label %67
67: ; preds = %62, %59
%68 = phi i1 [ true, %59 ], [ %66, %62 ]
br i1 %68, label %27, label %69
69: ; preds = %67
%70 = load i32, i32* @A_NORMAL
%71 = call i32 @attrset(i32 %70)
store i32 0, i32* %4
br label %72
72: ; preds = %97, %69
%73 = load i32, i32* %4
%74 = load i32, i32* %5
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %100
76: ; preds = %72
%77 = load i32, i32* @LINES
%78 = load i32, i32* %4
%79 = sub nsw i32 %77, %78
%80 = load i32, i32* %2
%81 = load i32, i32* %4
%82 = load i32, i32* %7
%83 = mul nsw i32 %81, %82
%84 = add nsw i32 %80, %83
%85 = load i32, i32* %7
%86 = icmp slt i32 %85, 0
%87 = zext i1 %86 to i64
%88 = select i1 %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%89 = call i32 @mvprintw(i32 %79, i32 %84, i8* %88)
%90 = load i32, i32* %6
%91 = add nsw i32 %90, 1
store i32 %91, i32* %6
%92 = icmp ne i32 %90, 0
br i1 %92, label %93, label %96
93: ; preds = %76
%94 = call i32 (...) @myrefresh()
%95 = call i32 (...) @clear()
store i32 0, i32* %6
br label %96
96: ; preds = %93, %76
br label %97
97: ; preds = %96
%98 = load i32, i32* %4
%99 = add nsw i32 %98, 1
store i32 %99, i32* %4
br label %72
100: ; preds = %72
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
store i32 %102, i32* %6
%103 = icmp ne i32 %101, 0
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = call i32 (...) @myrefresh()
store i32 0, i32* %6
br label %106
106: ; preds = %104, %100
%107 = call i32 @time(i32* null)
store i32 %107, i32* %8
%108 = load i32, i32* %8
%109 = call i32 @srand(i32 %108)
%110 = load i32, i32* @LINES
%111 = load i32, i32* %4
%112 = sub nsw i32 %110, %111
%113 = load i32, i32* %2
%114 = load i32, i32* %5
%115 = load i32, i32* %7
%116 = mul nsw i32 %114, %115
%117 = add nsw i32 %113, %116
%118 = call i32 (...) @clear()
%119 = call i32 (...) @myrefresh()
br label %22
120: ; preds = %22
%121 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@ERR = global i64 0
@COLS = global i32 0
@LINES = global i32 0
@A_NORMAL = global i32 0
@.str = [2 x i8] c"\\\00"
@.str.1 = [2 x i8] c"/\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = load i32, i32* @stdscr
%3 = load i32, i32* @TRUE
%4 = tail call i32 @nodelay(i32 %2, i32 %3)
%5 = tail call i32 (...) @noecho()
%6 = tail call i64 (...) @has_colors()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = tail call i32 (...) @start_color()
br label %10
10: ; preds = %8, %0
%11 = tail call i32 @time(i32* null)
%12 = tail call i32 @srand(i32 %11)
%13 = tail call i64 (...) @getch()
%14 = load i64, i64* @ERR
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %79
16: ; preds = %10, %66
%17 = phi i32 [ %67, %66 ], [ undef, %10 ]
br label %18
18: ; preds = %16, %18
%19 = tail call i32 (...) @rand()
%20 = load i32, i32* @COLS
%21 = add nsw i32 %20, -3
%22 = srem i32 %19, %21
%23 = tail call i32 (...) @rand()
%24 = load i32, i32* @COLS
%25 = add nsw i32 %24, -3
%26 = srem i32 %23, %25
%27 = icmp sgt i32 %22, 2
%28 = select i1 %27, i32 %22, i32 2
%29 = icmp sgt i32 %26, 2
%30 = select i1 %29, i32 %26, i32 2
%31 = sub nsw i32 %28, %30
%32 = tail call i32 @llvm.abs.i32(i32 %31, i1 true)
%33 = icmp ult i32 %32, 2
%34 = load i32, i32* @LINES
%35 = add nsw i32 %34, -2
%36 = icmp sge i32 %32, %35
%37 = select i1 %33, i1 true, i1 %36
br i1 %37, label %18, label %38
38: ; preds = %18
%39 = icmp ugt i32 %28, %30
%40 = select i1 %39, i32 -1, i32 1
%41 = load i32, i32* @A_NORMAL
%42 = tail call i32 @attrset(i32 %41)
%43 = select i1 %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
br label %44
44: ; preds = %58, %38
%45 = phi i32 [ %17, %38 ], [ %59, %58 ]
%46 = phi i32 [ 0, %38 ], [ %60, %58 ]
%47 = load i32, i32* @LINES
%48 = sub nsw i32 %47, %46
%49 = mul nsw i32 %46, %40
%50 = add nsw i32 %49, %28
%51 = tail call i32 @mvprintw(i32 %48, i32 %50, i8* %43)
%52 = icmp eq i32 %45, 0
br i1 %52, label %61, label %53
53: ; preds = %44
%54 = tail call i32 (...) @myrefresh()
%55 = tail call i32 (...) @clear()
%56 = add nuw nsw i32 %46, 1
%57 = icmp eq i32 %56, %32
br i1 %57, label %66, label %58
58: ; preds = %53, %61
%59 = phi i32 [ 0, %53 ], [ 1, %61 ]
%60 = phi i32 [ %56, %53 ], [ %62, %61 ]
br label %44
61: ; preds = %44
%62 = add nuw nsw i32 %46, 1
%63 = icmp eq i32 %62, %32
br i1 %63, label %64, label %58
64: ; preds = %61
%65 = tail call i32 (...) @myrefresh()
br label %66
66: ; preds = %53, %64
%67 = phi i32 [ 0, %64 ], [ 1, %53 ]
%68 = tail call i32 @time(i32* null)
%69 = tail call i32 @srand(i32 %68)
%70 = load i32, i32* @LINES
%71 = sub nsw i32 %70, %32
%72 = mul nsw i32 %32, %40
%73 = add nsw i32 %72, %28
tail call void (i32, i32, ...) bitcast (void (...)* @explode to void (i32, i32, ...)*)(i32 %71, i32 %73)
%74 = tail call i32 (...) @clear()
%75 = tail call i32 (...) @myrefresh()
%76 = tail call i64 (...) @getch()
%77 = load i64, i64* @ERR
%78 = icmp eq i64 %76, %77
br i1 %78, label %16, label %79
79: ; preds = %66, %10
%80 = tail call i32 (...) @endwin()
ret i32 0
}