#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 char chtype;
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_GREEN;
char COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
int ERR;
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
char mvwinch(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ napms(int);
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int rand();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ ungetch(int);
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wbkgd(int /*<<< orphan*/ *, char);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int BouncingBalls(WINDOW *win) {
  chtype c1, c2, c3, ball1, ball2, ball3;
  int w, h, x1, y1, xd1, yd1, x2, y2, xd2, yd2, x3, y3, xd3, yd3, c;
  curs_set(0);
  wbkgd(win, COLOR_PAIR(1));
  wrefresh(win);
  wattrset(win, 0);
  init_pair(11, COLOR_RED, COLOR_GREEN);
  init_pair(12, COLOR_BLUE, COLOR_RED);
  init_pair(13, COLOR_YELLOW, COLOR_WHITE);
  ball1 = 'O' | COLOR_PAIR(11);
  ball2 = '*' | COLOR_PAIR(12);
  ball3 = '@' | COLOR_PAIR(13);
  getmaxyx(win, h, w);
  x1 = 2 + rand() % (w - 4);
  y1 = 2 + rand() % (h - 4);
  x2 = 2 + rand() % (w - 4);
  y2 = 2 + rand() % (h - 4);
  x3 = 2 + rand() % (w - 4);
  y3 = 2 + rand() % (h - 4);
  xd1 = 1;
  yd1 = 1;
  xd2 = 1;
  yd2 = -1;
  xd3 = -1;
  yd3 = 1;
  nodelay(stdscr, TRUE);
  while ((c = getch()) == ERR) {
    x1 += xd1;
    if (x1 <= 1 || x1 >= w - 2)
      xd1 *= -1;
    y1 += yd1;
    if (y1 <= 1 || y1 >= h - 2)
      yd1 *= -1;
    x2 += xd2;
    if (x2 <= 1 || x2 >= w - 2)
      xd2 *= -1;
    y2 += yd2;
    if (y2 <= 1 || y2 >= h - 2)
      yd2 *= -1;
    x3 += xd3;
    if (x3 <= 1 || x3 >= w - 2)
      xd3 *= -1;
    y3 += yd3;
    if (y3 <= 1 || y3 >= h - 2)
      yd3 *= -1;
    c1 = mvwinch(win, y1, x1);
    c2 = mvwinch(win, y2, x2);
    c3 = mvwinch(win, y3, x3);
    mvwaddch(win, y1, x1, ball1);
    mvwaddch(win, y2, x2, ball2);
    mvwaddch(win, y3, x3, ball3);
    wmove(win, 0, 0);
    wrefresh(win);
    mvwaddch(win, y1, x1, c1);
    mvwaddch(win, y2, x2, c2);
    mvwaddch(win, y3, x3, c3);
    napms(150);
  }
  nodelay(stdscr, FALSE);
  ungetch(c);
  return 0;
}


x86 assembly (clang, -O0):
<BouncingBalls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1100 <curs_set@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    -0x58(%rbp),%rdi
movsbl %al,%esi
call   1050 <wbkgd@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wrefresh@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <wattrset@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
mov    0x2d8b(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%edi
call   1040 <init_pair@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%esi
mov    0x2d3f(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%edi
call   1040 <init_pair@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
mov    0x2d43(%rip),%rax
mov    (%rax),%edx
mov    $0xd,%edi
call   1040 <init_pair@plt>
mov    $0xb,%edi
call   1090 <COLOR_PAIR@plt>
movsbl %al,%eax
or     $0x4f,%eax
mov    %al,-0xc(%rbp)
mov    $0xc,%edi
call   1090 <COLOR_PAIR@plt>
movsbl %al,%eax
or     $0x2a,%eax
mov    %al,-0xd(%rbp)
mov    $0xd,%edi
call   1090 <COLOR_PAIR@plt>
movsbl %al,%eax
or     $0x40,%eax
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1070 <getmaxyx@plt>
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x14(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x18(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x20(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x14(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x2c(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x18(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x30(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x14(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x3c(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x18(%rbp),%ecx
sub    $0x4,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x40(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movl   $0xffffffff,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
mov    0x2c5a(%rip),%rax
mov    (%rax),%edi
mov    0x2c49(%rip),%rax
mov    (%rax),%esi
call   10a0 <nodelay@plt>
mov    $0x0,%al
call   10c0 <getch@plt>
mov    %eax,-0x4c(%rbp)
mov    0x2c41(%rip),%rcx
cmp    (%rcx),%eax
jne    157e <BouncingBalls+0x38e>
mov    -0x24(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jle    13d3 <BouncingBalls+0x1e3>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     13da <BouncingBalls+0x1ea>
imul   $0xffffffff,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jle    13fe <BouncingBalls+0x20e>
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     1405 <BouncingBalls+0x215>
imul   $0xffffffff,-0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jle    1429 <BouncingBalls+0x239>
mov    -0x2c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     1430 <BouncingBalls+0x240>
imul   $0xffffffff,-0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jle    1454 <BouncingBalls+0x264>
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     145b <BouncingBalls+0x26b>
imul   $0xffffffff,-0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jle    147f <BouncingBalls+0x28f>
mov    -0x3c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     1486 <BouncingBalls+0x296>
imul   $0xffffffff,-0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x1,-0x40(%rbp)
jle    14aa <BouncingBalls+0x2ba>
mov    -0x40(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jl     14b1 <BouncingBalls+0x2c1>
imul   $0xffffffff,-0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1080 <mvwinch@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1080 <mvwinch@plt>
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
call   1080 <mvwinch@plt>
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
movsbl -0xc(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
movsbl -0xd(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
movsbl -0xe(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10e0 <wmove@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wrefresh@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
movsbl -0x9(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
movsbl -0xa(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
movsbl -0xb(%rbp),%ecx
call   10d0 <mvwaddch@plt>
mov    $0x96,%edi
call   10f0 <napms@plt>
jmp    1396 <BouncingBalls+0x1a6>
mov    0x2a5b(%rip),%rax
mov    (%rax),%edi
mov    0x2a1a(%rip),%rax
mov    (%rax),%esi
call   10a0 <nodelay@plt>
mov    -0x4c(%rbp),%edi
call   10b0 <ungetch@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BouncingBalls>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r12
xor    %edi,%edi
call   1100 <curs_set@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
movsbl %al,%esi
mov    %r12,%rdi
call   1050 <wbkgd@plt>
mov    %r12,%rdi
call   1060 <wrefresh@plt>
mov    %r12,%rdi
xor    %esi,%esi
call   1030 <wattrset@plt>
mov    0x2d6a(%rip),%rbx
mov    (%rbx),%esi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%edi
call   1040 <init_pair@plt>
mov    0x2d5e(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0xc,%edi
call   1040 <init_pair@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
mov    0x2d50(%rip),%rax
mov    (%rax),%edx
mov    $0xd,%edi
call   1040 <init_pair@plt>
mov    $0xb,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%r15d
mov    $0xc,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%r14d
mov    $0xd,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1070 <getmaxyx@plt>
xor    %eax,%eax
call   1110 <rand@plt>
xor    %eax,%eax
call   1110 <rand@plt>
xor    %eax,%eax
call   1110 <rand@plt>
xor    %eax,%eax
call   1110 <rand@plt>
xor    %eax,%eax
call   1110 <rand@plt>
xor    %eax,%eax
call   1110 <rand@plt>
mov    0x2d04(%rip),%rbx
mov    (%rbx),%edi
mov    0x2cf3(%rip),%rax
mov    (%rax),%esi
call   10a0 <nodelay@plt>
xor    %eax,%eax
call   10c0 <getch@plt>
mov    %eax,%ebp
mov    0x2cec(%rip),%rax
cmp    (%rax),%ebp
jne    14b8 <BouncingBalls+0x2c8>
or     $0x4f,%r15b
or     $0x2a,%r14b
or     $0x40,%r13b
mov    $0xffffffff,%eax
movsbl %r15b,%ecx
mov    %ecx,0x24(%rsp)
movsbl %r14b,%ecx
mov    %ecx,0x20(%rsp)
movsbl %r13b,%ecx
mov    %ecx,0x1c(%rsp)
mov    $0xffffffff,%r8d
mov    $0x1,%ecx
mov    $0x1,%esi
mov    $0x1,%edi
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
add    %edi,%r13d
mov    %r13d,%edx
mov    %r13d,0x18(%rsp)
neg    %edi
mov    %edi,0x34(%rsp)
mov    0x30(%rsp),%r13d
add    %esi,%r13d
neg    %esi
mov    %esi,0x38(%rsp)
add    %ecx,%r15d
mov    %r15d,0x28(%rsp)
neg    %ecx
mov    %ecx,0x3c(%rsp)
mov    0xc(%rsp),%r15d
add    %r8d,%r15d
neg    %r8d
mov    %r8d,0x40(%rsp)
mov    0x10(%rsp),%r14d
add    %eax,%r14d
neg    %eax
mov    %eax,0x44(%rsp)
mov    0x14(%rsp),%ebp
add    %ebx,%ebp
neg    %ebx
mov    %ebx,0x2c(%rsp)
mov    %r12,%rdi
mov    %r13d,%esi
call   1080 <mvwinch@plt>
mov    %al,0xc(%rsp)
mov    %r12,%rdi
mov    %r15d,%esi
mov    0x28(%rsp),%ebx
mov    %ebx,%edx
call   1080 <mvwinch@plt>
mov    %al,0x10(%rsp)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1080 <mvwinch@plt>
mov    %al,0x14(%rsp)
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x18(%rsp),%edx
mov    0x24(%rsp),%ecx
call   10d0 <mvwaddch@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    0x20(%rsp),%ecx
call   10d0 <mvwaddch@plt>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    0x1c(%rsp),%ecx
call   10d0 <mvwaddch@plt>
mov    %r12,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <wmove@plt>
mov    %r12,%rdi
call   1060 <wrefresh@plt>
movsbl 0xc(%rsp),%ecx
mov    %r12,%rdi
mov    %r13d,0x30(%rsp)
mov    %r13d,%esi
mov    0x18(%rsp),%edx
mov    %edx,%r13d
call   10d0 <mvwaddch@plt>
movsbl 0x10(%rsp),%ecx
mov    %r12,%rdi
mov    %r15d,0xc(%rsp)
mov    %r15d,%esi
mov    %ebx,%edx
mov    %ebx,%r15d
call   10d0 <mvwaddch@plt>
movsbl 0x14(%rsp),%ecx
mov    %r12,%rdi
mov    %ebp,0x14(%rsp)
mov    %ebp,%esi
mov    %r14d,0x10(%rsp)
mov    %r14d,%edx
call   10d0 <mvwaddch@plt>
mov    $0x96,%edi
call   10f0 <napms@plt>
xor    %eax,%eax
call   10c0 <getch@plt>
mov    0x2c(%rsp),%ebx
mov    0x34(%rsp),%edi
mov    0x38(%rsp),%esi
mov    0x3c(%rsp),%ecx
mov    0x40(%rsp),%r8d
mov    %eax,%ebp
mov    0x2b43(%rip),%rax
cmp    (%rax),%ebp
mov    0x44(%rsp),%eax
je     1350 <BouncingBalls+0x160>
mov    0x2b28(%rip),%rbx
mov    (%rbx),%edi
mov    0x2ae7(%rip),%rax
mov    (%rax),%esi
call   10a0 <nodelay@plt>
mov    %ebp,%edi
call   10b0 <ungetch@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
@stdscr = global i32 0
@TRUE = global i32 0
@ERR = global i32 0
@FALSE = global i32 0
define i32 @BouncingBalls(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32* %0, i32** %2
%24 = call i32 @curs_set(i32 0)
%25 = load i32*, i32** %2
%26 = call signext i8 @COLOR_PAIR(i32 1)
%27 = call i32 @wbkgd(i32* %25, i8 signext %26)
%28 = load i32*, i32** %2
%29 = call i32 @wrefresh(i32* %28)
%30 = load i32*, i32** %2
%31 = call i32 @wattrset(i32* %30, i32 0)
%32 = load i32, i32* @COLOR_RED
%33 = load i32, i32* @COLOR_GREEN
%34 = call i32 @init_pair(i32 11, i32 %32, i32 %33)
%35 = load i32, i32* @COLOR_BLUE
%36 = load i32, i32* @COLOR_RED
%37 = call i32 @init_pair(i32 12, i32 %35, i32 %36)
%38 = load i32, i32* @COLOR_YELLOW
%39 = load i32, i32* @COLOR_WHITE
%40 = call i32 @init_pair(i32 13, i32 %38, i32 %39)
%41 = call signext i8 @COLOR_PAIR(i32 11)
%42 = sext i8 %41 to i32
%43 = or i32 79, %42
%44 = trunc i32 %43 to i8
store i8 %44, i8* %6
%45 = call signext i8 @COLOR_PAIR(i32 12)
%46 = sext i8 %45 to i32
%47 = or i32 42, %46
%48 = trunc i32 %47 to i8
store i8 %48, i8* %7
%49 = call signext i8 @COLOR_PAIR(i32 13)
%50 = sext i8 %49 to i32
%51 = or i32 64, %50
%52 = trunc i32 %51 to i8
store i8 %52, i8* %8
%53 = load i32*, i32** %2
%54 = load i32, i32* %10
%55 = load i32, i32* %9
%56 = call i32 @getmaxyx(i32* %53, i32 %54, i32 %55)
%57 = call i32 (...) @rand()
%58 = load i32, i32* %9
%59 = sub nsw i32 %58, 4
%60 = srem i32 %57, %59
%61 = add nsw i32 2, %60
store i32 %61, i32* %11
%62 = call i32 (...) @rand()
%63 = load i32, i32* %10
%64 = sub nsw i32 %63, 4
%65 = srem i32 %62, %64
%66 = add nsw i32 2, %65
store i32 %66, i32* %12
%67 = call i32 (...) @rand()
%68 = load i32, i32* %9
%69 = sub nsw i32 %68, 4
%70 = srem i32 %67, %69
%71 = add nsw i32 2, %70
store i32 %71, i32* %15
%72 = call i32 (...) @rand()
%73 = load i32, i32* %10
%74 = sub nsw i32 %73, 4
%75 = srem i32 %72, %74
%76 = add nsw i32 2, %75
store i32 %76, i32* %16
%77 = call i32 (...) @rand()
%78 = load i32, i32* %9
%79 = sub nsw i32 %78, 4
%80 = srem i32 %77, %79
%81 = add nsw i32 2, %80
store i32 %81, i32* %19
%82 = call i32 (...) @rand()
%83 = load i32, i32* %10
%84 = sub nsw i32 %83, 4
%85 = srem i32 %82, %84
%86 = add nsw i32 2, %85
store i32 %86, i32* %20
store i32 1, i32* %13
store i32 1, i32* %14
store i32 1, i32* %17
store i32 -1, i32* %18
store i32 -1, i32* %21
store i32 1, i32* %22
%87 = load i32, i32* @stdscr
%88 = load i32, i32* @TRUE
%89 = call i32 @nodelay(i32 %87, i32 %88)
br label %90
90: ; preds = %178, %1
%91 = call i32 (...) @getch()
store i32 %91, i32* %23
%92 = load i32, i32* @ERR
%93 = icmp eq i32 %91, %92
br i1 %93, label %94, label %226
94: ; preds = %90
%95 = load i32, i32* %13
%96 = load i32, i32* %11
%97 = add nsw i32 %96, %95
store i32 %97, i32* %11
%98 = load i32, i32* %11
%99 = icmp sle i32 %98, 1
br i1 %99, label %105, label %100
100: ; preds = %94
%101 = load i32, i32* %11
%102 = load i32, i32* %9
%103 = sub nsw i32 %102, 2
%104 = icmp sge i32 %101, %103
br i1 %104, label %105, label %108
105: ; preds = %100, %94
%106 = load i32, i32* %13
%107 = mul nsw i32 %106, -1
store i32 %107, i32* %13
br label %108
108: ; preds = %105, %100
%109 = load i32, i32* %14
%110 = load i32, i32* %12
%111 = add nsw i32 %110, %109
store i32 %111, i32* %12
%112 = load i32, i32* %12
%113 = icmp sle i32 %112, 1
br i1 %113, label %119, label %114
114: ; preds = %108
%115 = load i32, i32* %12
%116 = load i32, i32* %10
%117 = sub nsw i32 %116, 2
%118 = icmp sge i32 %115, %117
br i1 %118, label %119, label %122
119: ; preds = %114, %108
%120 = load i32, i32* %14
%121 = mul nsw i32 %120, -1
store i32 %121, i32* %14
br label %122
122: ; preds = %119, %114
%123 = load i32, i32* %17
%124 = load i32, i32* %15
%125 = add nsw i32 %124, %123
store i32 %125, i32* %15
%126 = load i32, i32* %15
%127 = icmp sle i32 %126, 1
br i1 %127, label %133, label %128
128: ; preds = %122
%129 = load i32, i32* %15
%130 = load i32, i32* %9
%131 = sub nsw i32 %130, 2
%132 = icmp sge i32 %129, %131
br i1 %132, label %133, label %136
133: ; preds = %128, %122
%134 = load i32, i32* %17
%135 = mul nsw i32 %134, -1
store i32 %135, i32* %17
br label %136
136: ; preds = %133, %128
%137 = load i32, i32* %18
%138 = load i32, i32* %16
%139 = add nsw i32 %138, %137
store i32 %139, i32* %16
%140 = load i32, i32* %16
%141 = icmp sle i32 %140, 1
br i1 %141, label %147, label %142
142: ; preds = %136
%143 = load i32, i32* %16
%144 = load i32, i32* %10
%145 = sub nsw i32 %144, 2
%146 = icmp sge i32 %143, %145
br i1 %146, label %147, label %150
147: ; preds = %142, %136
%148 = load i32, i32* %18
%149 = mul nsw i32 %148, -1
store i32 %149, i32* %18
br label %150
150: ; preds = %147, %142
%151 = load i32, i32* %21
%152 = load i32, i32* %19
%153 = add nsw i32 %152, %151
store i32 %153, i32* %19
%154 = load i32, i32* %19
%155 = icmp sle i32 %154, 1
br i1 %155, label %161, label %156
156: ; preds = %150
%157 = load i32, i32* %19
%158 = load i32, i32* %9
%159 = sub nsw i32 %158, 2
%160 = icmp sge i32 %157, %159
br i1 %160, label %161, label %164
161: ; preds = %156, %150
%162 = load i32, i32* %21
%163 = mul nsw i32 %162, -1
store i32 %163, i32* %21
br label %164
164: ; preds = %161, %156
%165 = load i32, i32* %22
%166 = load i32, i32* %20
%167 = add nsw i32 %166, %165
store i32 %167, i32* %20
%168 = load i32, i32* %20
%169 = icmp sle i32 %168, 1
br i1 %169, label %175, label %170
170: ; preds = %164
%171 = load i32, i32* %20
%172 = load i32, i32* %10
%173 = sub nsw i32 %172, 2
%174 = icmp sge i32 %171, %173
br i1 %174, label %175, label %178
175: ; preds = %170, %164
%176 = load i32, i32* %22
%177 = mul nsw i32 %176, -1
store i32 %177, i32* %22
br label %178
178: ; preds = %175, %170
%179 = load i32*, i32** %2
%180 = load i32, i32* %12
%181 = load i32, i32* %11
%182 = call signext i8 @mvwinch(i32* %179, i32 %180, i32 %181)
store i8 %182, i8* %3
%183 = load i32*, i32** %2
%184 = load i32, i32* %16
%185 = load i32, i32* %15
%186 = call signext i8 @mvwinch(i32* %183, i32 %184, i32 %185)
store i8 %186, i8* %4
%187 = load i32*, i32** %2
%188 = load i32, i32* %20
%189 = load i32, i32* %19
%190 = call signext i8 @mvwinch(i32* %187, i32 %188, i32 %189)
store i8 %190, i8* %5
%191 = load i32*, i32** %2
%192 = load i32, i32* %12
%193 = load i32, i32* %11
%194 = load i8, i8* %6
%195 = call i32 @mvwaddch(i32* %191, i32 %192, i32 %193, i8 signext %194)
%196 = load i32*, i32** %2
%197 = load i32, i32* %16
%198 = load i32, i32* %15
%199 = load i8, i8* %7
%200 = call i32 @mvwaddch(i32* %196, i32 %197, i32 %198, i8 signext %199)
%201 = load i32*, i32** %2
%202 = load i32, i32* %20
%203 = load i32, i32* %19
%204 = load i8, i8* %8
%205 = call i32 @mvwaddch(i32* %201, i32 %202, i32 %203, i8 signext %204)
%206 = load i32*, i32** %2
%207 = call i32 @wmove(i32* %206, i32 0, i32 0)
%208 = load i32*, i32** %2
%209 = call i32 @wrefresh(i32* %208)
%210 = load i32*, i32** %2
%211 = load i32, i32* %12
%212 = load i32, i32* %11
%213 = load i8, i8* %3
%214 = call i32 @mvwaddch(i32* %210, i32 %211, i32 %212, i8 signext %213)
%215 = load i32*, i32** %2
%216 = load i32, i32* %16
%217 = load i32, i32* %15
%218 = load i8, i8* %4
%219 = call i32 @mvwaddch(i32* %215, i32 %216, i32 %217, i8 signext %218)
%220 = load i32*, i32** %2
%221 = load i32, i32* %20
%222 = load i32, i32* %19
%223 = load i8, i8* %5
%224 = call i32 @mvwaddch(i32* %220, i32 %221, i32 %222, i8 signext %223)
%225 = call i32 @napms(i32 150)
br label %90
226: ; preds = %90
%227 = load i32, i32* @stdscr
%228 = load i32, i32* @FALSE
%229 = call i32 @nodelay(i32 %227, i32 %228)
%230 = load i32, i32* %23
%231 = call i32 @ungetch(i32 %230)
ret i32 0
}

LLVM IR (-O2):
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
@stdscr = global i32 0
@TRUE = global i32 0
@ERR = global i32 0
@FALSE = global i32 0
define i32 @BouncingBalls(i32* %0) {
%2 = tail call i32 @curs_set(i32 0)
%3 = tail call signext i8 @COLOR_PAIR(i32 1)
%4 = tail call i32 @wbkgd(i32* %0, i8 signext %3)
%5 = tail call i32 @wrefresh(i32* %0)
%6 = tail call i32 @wattrset(i32* %0, i32 0)
%7 = load i32, i32* @COLOR_RED
%8 = load i32, i32* @COLOR_GREEN
%9 = tail call i32 @init_pair(i32 11, i32 %7, i32 %8)
%10 = load i32, i32* @COLOR_BLUE
%11 = load i32, i32* @COLOR_RED
%12 = tail call i32 @init_pair(i32 12, i32 %10, i32 %11)
%13 = load i32, i32* @COLOR_YELLOW
%14 = load i32, i32* @COLOR_WHITE
%15 = tail call i32 @init_pair(i32 13, i32 %13, i32 %14)
%16 = tail call signext i8 @COLOR_PAIR(i32 11)
%17 = or i8 %16, 79
%18 = tail call signext i8 @COLOR_PAIR(i32 12)
%19 = or i8 %18, 42
%20 = tail call signext i8 @COLOR_PAIR(i32 13)
%21 = or i8 %20, 64
%22 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%23 = tail call i32 (...) @rand()
%24 = tail call i32 (...) @rand()
%25 = tail call i32 (...) @rand()
%26 = tail call i32 (...) @rand()
%27 = tail call i32 (...) @rand()
%28 = tail call i32 (...) @rand()
%29 = load i32, i32* @stdscr
%30 = load i32, i32* @TRUE
%31 = tail call i32 @nodelay(i32 %29, i32 %30)
%32 = tail call i32 (...) @getch()
%33 = load i32, i32* @ERR
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %75
35: ; preds = %1, %35
%36 = phi i32 [ %59, %35 ], [ 1, %1 ]
%37 = phi i32 [ %57, %35 ], [ -1, %1 ]
%38 = phi i32 [ %58, %35 ], [ poison, %1 ]
%39 = phi i32 [ %56, %35 ], [ poison, %1 ]
%40 = phi i32 [ %55, %35 ], [ -1, %1 ]
%41 = phi i32 [ %53, %35 ], [ 1, %1 ]
%42 = phi i32 [ %54, %35 ], [ poison, %1 ]
%43 = phi i32 [ %52, %35 ], [ poison, %1 ]
%44 = phi i32 [ %51, %35 ], [ 1, %1 ]
%45 = phi i32 [ %49, %35 ], [ 1, %1 ]
%46 = phi i32 [ %50, %35 ], [ poison, %1 ]
%47 = phi i32 [ %48, %35 ], [ poison, %1 ]
%48 = add nsw i32 %45, %47
%49 = sub nsw i32 0, %45
%50 = add nsw i32 %44, %46
%51 = sub nsw i32 0, %44
%52 = add nsw i32 %41, %43
%53 = sub nsw i32 0, %41
%54 = add nsw i32 %40, %42
%55 = sub nsw i32 0, %40
%56 = add nsw i32 %37, %39
%57 = sub nsw i32 0, %37
%58 = add nsw i32 %36, %38
%59 = sub nsw i32 0, %36
%60 = tail call signext i8 @mvwinch(i32* %0, i32 %50, i32 %48)
%61 = tail call signext i8 @mvwinch(i32* %0, i32 %54, i32 %52)
%62 = tail call signext i8 @mvwinch(i32* %0, i32 %58, i32 %56)
%63 = tail call i32 @mvwaddch(i32* %0, i32 %50, i32 %48, i8 signext %17)
%64 = tail call i32 @mvwaddch(i32* %0, i32 %54, i32 %52, i8 signext %19)
%65 = tail call i32 @mvwaddch(i32* %0, i32 %58, i32 %56, i8 signext %21)
%66 = tail call i32 @wmove(i32* %0, i32 0, i32 0)
%67 = tail call i32 @wrefresh(i32* %0)
%68 = tail call i32 @mvwaddch(i32* %0, i32 %50, i32 %48, i8 signext %60)
%69 = tail call i32 @mvwaddch(i32* %0, i32 %54, i32 %52, i8 signext %61)
%70 = tail call i32 @mvwaddch(i32* %0, i32 %58, i32 %56, i8 signext %62)
%71 = tail call i32 @napms(i32 150)
%72 = tail call i32 (...) @getch()
%73 = load i32, i32* @ERR
%74 = icmp eq i32 %72, %73
br i1 %74, label %35, label %75
75: ; preds = %35, %1
%76 = phi i32 [ %32, %1 ], [ %72, %35 ]
%77 = load i32, i32* @stdscr
%78 = load i32, i32* @FALSE
%79 = tail call i32 @nodelay(i32 %77, i32 %78)
%80 = tail call i32 @ungetch(i32 %76)
ret i32 0
}