#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*/ A_BOLD;
int /*<<< orphan*/ COLOR_BLACK;
int COLS;
int LINES;
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ attrset(int /*<<< orphan*/);
int /*<<< orphan*/ color_set(int, int /*<<< orphan*/);
int /*<<< orphan*/ init_pair(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ linep(void *, void *, char *);
int /*<<< orphan*/ move(int, int);
void *myran(int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ time(int *);
int /*<<< orphan*/ usleep(int);
int main() {
  int x, y, cl, xa, ya;
  char c[2];
  srandom(time(&x));
  initscr();
  int pole[LINES][COLS];
  start_color();
  attrset(A_BOLD);
  init_pair(1, 1, COLOR_BLACK);
  init_pair(2, 2, COLOR_BLACK);
  init_pair(3, 3, COLOR_BLACK);
  init_pair(4, 4, COLOR_BLACK);
  init_pair(5, 5, COLOR_BLACK);
  init_pair(6, 6, COLOR_BLACK);
  init_pair(7, 7, COLOR_BLACK);
  init_pair(0, 0, COLOR_BLACK);
  xa = LINES;
  ya = COLS;
  linep(myran(0, LINES), myran(0, COLS - 26), "Privet vsem! Eto RANDOM!!!");
  usleep(400000);
  while (1) {
    x = myran(0, xa);
    y = myran(0, ya);
    c[0] = myran(33, 124);
    c[1] = 0;
    cl = myran(0, 8);
    if (pole[x][y] == 0) {
      pole[x][y] = 1;
      move(x, y);
      color_set(cl, 0);
      addstr(c);
      refresh();
    } else {
      pole[x][y] = 0;
      move(x, y);
      addstr(" ");
      refresh();
    }
    usleep(1000);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1050 <initscr@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
mov    0x2dd0(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x48(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1060 <start_color@plt>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
call   10b0 <attrset@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edx
mov    $0x7,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    %esi,%edi
call   1040 <init_pair@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2cce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2cd2(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1070 <myran@plt>
mov    %rax,-0x40(%rbp)
mov    0x2cae(%rip),%rax
mov    (%rax),%esi
sub    $0x1a,%esi
xor    %edi,%edi
call   1070 <myran@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
lea    0xcbc(%rip),%rdx
call   1080 <linep@plt>
mov    $0x61a80,%edi
call   10e0 <usleep@plt>
jmp    1358 <main+0x188>
mov    -0x14(%rbp),%esi
xor    %edi,%edi
call   1070 <myran@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%esi
xor    %edi,%edi
call   1070 <myran@plt>
mov    %eax,-0xc(%rbp)
mov    $0x21,%edi
mov    $0x7c,%esi
call   1070 <myran@plt>
mov    %al,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
xor    %edi,%edi
mov    $0x8,%esi
call   1070 <myran@plt>
mov    -0x50(%rbp),%rdx
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
mov    %ecx,-0x10(%rbp)
movslq -0x8(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    140b <main+0x23b>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
movslq -0x8(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   10f0 <move@plt>
mov    -0x10(%rbp),%edi
xor    %esi,%esi
call   10d0 <color_set@plt>
lea    -0x1a(%rbp),%rdi
call   10c0 <addstr@plt>
mov    $0x0,%al
call   10a0 <refresh@plt>
jmp    144b <main+0x27b>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rdx
movslq -0x8(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   10f0 <move@plt>
lea    0xbdc(%rip),%rdi
call   10c0 <addstr@plt>
mov    $0x0,%al
call   10a0 <refresh@plt>
mov    $0x3e8,%edi
call   10e0 <usleep@plt>
jmp    1353 <main+0x183>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    -0x30(%rbp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1050 <initscr@plt>
mov    0x2de9(%rip),%r14
mov    (%r14),%eax
mov    0x2dcf(%rip),%r15
mov    (%r15),%ecx
mov    %rcx,-0x38(%rbp)
imul   %rcx,%rax
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
xor    %eax,%eax
call   1060 <start_color@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
call   10b0 <attrset@plt>
mov    0x2d9b(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x3,%edi
mov    $0x3,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x4,%edi
mov    $0x4,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x5,%edi
mov    $0x5,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x6,%edi
mov    $0x6,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
mov    $0x7,%edi
mov    $0x7,%esi
call   1040 <init_pair@plt>
mov    (%rbx),%edx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <init_pair@plt>
mov    (%r14),%r14d
mov    (%r15),%r13d
xor    %edi,%edi
mov    %r14d,%esi
call   1070 <myran@plt>
mov    %rax,%rbx
mov    (%r15),%esi
add    $0xffffffe6,%esi
xor    %edi,%edi
call   1070 <myran@plt>
lea    0xd12(%rip),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <linep@plt>
mov    $0x61a80,%edi
jmp    1324 <main+0x154>
movl   $0x0,(%rax,%rsi,4)
call   10f0 <move@plt>
lea    0xd08(%rip),%rdi
call   10c0 <addstr@plt>
xor    %eax,%eax
call   10a0 <refresh@plt>
mov    $0x3e8,%edi
call   10e0 <usleep@plt>
xor    %edi,%edi
mov    %r14d,%esi
call   1070 <myran@plt>
mov    %eax,-0x30(%rbp)
xor    %edi,%edi
mov    %r13d,%esi
call   1070 <myran@plt>
mov    %rax,%r15
mov    $0x21,%edi
mov    $0x7c,%esi
call   1070 <myran@plt>
mov    %al,-0x2a(%rbp)
movb   $0x0,-0x29(%rbp)
xor    %edi,%edi
mov    $0x8,%esi
call   1070 <myran@plt>
mov    %rax,%rbx
movslq -0x30(%rbp),%rdi
mov    %rdi,%rax
imul   -0x38(%rbp),%rax
lea    (%r12,%rax,4),%rax
movslq %r15d,%rsi
cmpl   $0x0,(%rax,%rsi,4)
jne    1300 <main+0x130>
movl   $0x1,(%rax,%rsi,4)
call   10f0 <move@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   10d0 <color_set@plt>
lea    -0x2a(%rbp),%rdi
jmp    1313 <main+0x143>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
@A_BOLD = global i32 0
@COLOR_BLACK = global i32 0
@.str = [27 x i8] c"Privet vsem! Eto RANDOM!!!\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 [2 x i8]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %1
%11 = call i32 @time(i32* %2)
%12 = call i32 @srandom(i32 %11)
%13 = call i32 (...) @initscr()
%14 = load i32, i32* @LINES
%15 = zext i32 %14 to i64
%16 = load i32, i32* @COLS
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %8
%19 = mul nuw i64 %15, %17
%20 = alloca i32, i64 %19
store i64 %15, i64* %9
store i64 %17, i64* %10
%21 = call i32 (...) @start_color()
%22 = load i32, i32* @A_BOLD
%23 = call i32 @attrset(i32 %22)
%24 = load i32, i32* @COLOR_BLACK
%25 = call i32 @init_pair(i32 1, i32 1, i32 %24)
%26 = load i32, i32* @COLOR_BLACK
%27 = call i32 @init_pair(i32 2, i32 2, i32 %26)
%28 = load i32, i32* @COLOR_BLACK
%29 = call i32 @init_pair(i32 3, i32 3, i32 %28)
%30 = load i32, i32* @COLOR_BLACK
%31 = call i32 @init_pair(i32 4, i32 4, i32 %30)
%32 = load i32, i32* @COLOR_BLACK
%33 = call i32 @init_pair(i32 5, i32 5, i32 %32)
%34 = load i32, i32* @COLOR_BLACK
%35 = call i32 @init_pair(i32 6, i32 6, i32 %34)
%36 = load i32, i32* @COLOR_BLACK
%37 = call i32 @init_pair(i32 7, i32 7, i32 %36)
%38 = load i32, i32* @COLOR_BLACK
%39 = call i32 @init_pair(i32 0, i32 0, i32 %38)
%40 = load i32, i32* @LINES
store i32 %40, i32* %5
%41 = load i32, i32* @COLS
store i32 %41, i32* %6
%42 = load i32, i32* @LINES
%43 = call i8* @myran(i32 0, i32 %42)
%44 = load i32, i32* @COLS
%45 = sub nsw i32 %44, 26
%46 = call i8* @myran(i32 0, i32 %45)
%47 = call i32 @linep(i8* %43, i8* %46, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @usleep(i32 400000)
br label %49
49: ; preds = %101, %0
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = call i8* @myran(i32 0, i32 %51)
%53 = ptrtoint i8* %52 to i32
store i32 %53, i32* %2
%54 = load i32, i32* %6
%55 = call i8* @myran(i32 0, i32 %54)
%56 = ptrtoint i8* %55 to i32
store i32 %56, i32* %3
%57 = call i8* @myran(i32 33, i32 124)
%58 = ptrtoint i8* %57 to i8
%59 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %58, i8* %59
%60 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 0, i8* %60
%61 = call i8* @myran(i32 0, i32 8)
%62 = ptrtoint i8* %61 to i32
store i32 %62, i32* %4
%63 = load i32, i32* %2
%64 = sext i32 %63 to i64
%65 = mul nsw i64 %64, %17
%66 = getelementptr inbounds i32, i32* %20, i64 %65
%67 = load i32, i32* %3
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %66, i64 %68
%70 = load i32, i32* %69
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %88
72: ; preds = %50
%73 = load i32, i32* %2
%74 = sext i32 %73 to i64
%75 = mul nsw i64 %74, %17
%76 = getelementptr inbounds i32, i32* %20, i64 %75
%77 = load i32, i32* %3
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
store i32 1, i32* %79
%80 = load i32, i32* %2
%81 = load i32, i32* %3
%82 = call i32 @move(i32 %80, i32 %81)
%83 = load i32, i32* %4
%84 = call i32 @color_set(i32 %83, i32 0)
%85 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%86 = call i32 @addstr(i8* %85)
%87 = call i32 (...) @refresh()
br label %101
88: ; preds = %50
%89 = load i32, i32* %2
%90 = sext i32 %89 to i64
%91 = mul nsw i64 %90, %17
%92 = getelementptr inbounds i32, i32* %20, i64 %91
%93 = load i32, i32* %3
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %92, i64 %94
store i32 0, i32* %95
%96 = load i32, i32* %2
%97 = load i32, i32* %3
%98 = call i32 @move(i32 %96, i32 %97)
%99 = call i32 @addstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%100 = call i32 (...) @refresh()
br label %101
101: ; preds = %88, %72
%102 = call i32 @usleep(i32 1000)
br label %49
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
@A_BOLD = global i32 0
@COLOR_BLACK = global i32 0
@.str = [27 x i8] c"Privet vsem! Eto RANDOM!!!\00"
@.str.1 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%5 = call i32 @time(i32* %1)
%6 = call i32 @srandom(i32 %5)
%7 = call i32 (...) @initscr()
%8 = load i32, i32* @LINES
%9 = zext i32 %8 to i64
%10 = load i32, i32* @COLS
%11 = zext i32 %10 to i64
%12 = mul nuw i64 %11, %9
%13 = alloca i32, i64 %12
%14 = call i32 (...) @start_color()
%15 = load i32, i32* @A_BOLD
%16 = call i32 @attrset(i32 %15)
%17 = load i32, i32* @COLOR_BLACK
%18 = call i32 @init_pair(i32 1, i32 1, i32 %17)
%19 = load i32, i32* @COLOR_BLACK
%20 = call i32 @init_pair(i32 2, i32 2, i32 %19)
%21 = load i32, i32* @COLOR_BLACK
%22 = call i32 @init_pair(i32 3, i32 3, i32 %21)
%23 = load i32, i32* @COLOR_BLACK
%24 = call i32 @init_pair(i32 4, i32 4, i32 %23)
%25 = load i32, i32* @COLOR_BLACK
%26 = call i32 @init_pair(i32 5, i32 5, i32 %25)
%27 = load i32, i32* @COLOR_BLACK
%28 = call i32 @init_pair(i32 6, i32 6, i32 %27)
%29 = load i32, i32* @COLOR_BLACK
%30 = call i32 @init_pair(i32 7, i32 7, i32 %29)
%31 = load i32, i32* @COLOR_BLACK
%32 = call i32 @init_pair(i32 0, i32 0, i32 %31)
%33 = load i32, i32* @LINES
%34 = load i32, i32* @COLS
%35 = call i8* @myran(i32 0, i32 %33)
%36 = load i32, i32* @COLS
%37 = add nsw i32 %36, -26
%38 = call i8* @myran(i32 0, i32 %37)
%39 = call i32 @linep(i8* %35, i8* %38, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @usleep(i32 400000)
%41 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
br label %42
42: ; preds = %71, %0
%43 = call i8* @myran(i32 0, i32 %33)
%44 = ptrtoint i8* %43 to i64
%45 = trunc i64 %44 to i32
store i32 %45, i32* %1
%46 = call i8* @myran(i32 0, i32 %34)
%47 = ptrtoint i8* %46 to i64
%48 = trunc i64 %47 to i32
%49 = call i8* @myran(i32 33, i32 124)
%50 = ptrtoint i8* %49 to i64
%51 = trunc i64 %50 to i8
store i8 %51, i8* %4
store i8 0, i8* %41
%52 = call i8* @myran(i32 0, i32 8)
%53 = load i32, i32* %1
%54 = sext i32 %53 to i64
%55 = mul nsw i64 %54, %11
%56 = getelementptr inbounds i32, i32* %13, i64 %55
%57 = shl i64 %47, 32
%58 = ashr exact i64 %57, 32
%59 = getelementptr inbounds i32, i32* %56, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %68
62: ; preds = %42
%63 = ptrtoint i8* %52 to i64
%64 = trunc i64 %63 to i32
store i32 1, i32* %59
%65 = call i32 @move(i32 %53, i32 %48)
%66 = call i32 @color_set(i32 %64, i32 0)
%67 = call i32 @addstr(i8* %4)
br label %71
68: ; preds = %42
store i32 0, i32* %59
%69 = call i32 @move(i32 %53, i32 %48)
%70 = call i32 @addstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %71
71: ; preds = %68, %62
%72 = call i32 (...) @refresh()
%73 = call i32 @usleep(i32 1000)
br label %42
}