#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 COLS;
int EXIT_SUCCESS;
int LINES;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ standend();
int /*<<< orphan*/ standout();
int main(void) {
  int r, c;
  int cond = 1;
  initscr();
  while (1) {
    for (r = 0; r < LINES; r++)
      for (c = 0; c < COLS; c++) {
        if (((r + c) & 1) == cond)
          standout();
        move(r, c);
        addch(' ');
        standend();
      }
    refresh();
    cond = !cond;
  }
  endwin();
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
jge    1205 <main+0xa5>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e39(%rip),%rcx
cmp    (%rcx),%eax
jge    11f2 <main+0x92>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    -0x10(%rbp),%eax
jne    11c8 <main+0x68>
mov    $0x0,%al
call   1050 <standout@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <move@plt>
mov    $0x20,%edi
call   1060 <addch@plt>
mov    $0x0,%al
call   1030 <standend@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119d <main+0x3d>
jmp    11f7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1184 <main+0x24>
mov    $0x0,%al
call   1070 <refresh@plt>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    117d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
mov    $0x1,%ebp
mov    0x2e6d(%rip),%r15
mov    0x2e5e(%rip),%r12
jmp    119a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <refresh@plt>
xor    $0x1,%ebp
mov    (%r15),%ecx
test   %ecx,%ecx
jle    1190 <main+0x30>
mov    (%r12),%eax
xor    %r14d,%r14d
jmp    11bc <main+0x5c>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%ecx
add    $0x1,%r14d
cmp    %ecx,%r14d
jge    1190 <main+0x30>
test   %eax,%eax
jle    11b3 <main+0x53>
xor    %ebx,%ebx
jmp    11f6 <main+0x96>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %ebx,%esi
call   1080 <move@plt>
mov    $0x20,%edi
call   1060 <addch@plt>
xor    %eax,%eax
call   1030 <standend@plt>
add    $0x1,%ebx
mov    (%r12),%eax
cmp    %eax,%ebx
jge    11b0 <main+0x50>
lea    (%r14,%rbx,1),%eax
and    $0x1,%eax
cmp    %ebp,%eax
jne    11d0 <main+0x70>
xor    %eax,%eax
call   1050 <standout@plt>
jmp    11d0 <main+0x70>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
%5 = call i32 (...) @initscr()
br label %6
6: ; preds = %0, %38
store i32 0, i32* %2
br label %7
7: ; preds = %35, %6
%8 = load i32, i32* %2
%9 = load i32, i32* @LINES
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %38
11: ; preds = %7
store i32 0, i32* %3
br label %12
12: ; preds = %31, %11
%13 = load i32, i32* %3
%14 = load i32, i32* @COLS
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %34
16: ; preds = %12
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = and i32 %19, 1
%21 = load i32, i32* %4
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = call i32 (...) @standout()
br label %25
25: ; preds = %23, %16
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 @move(i32 %26, i32 %27)
%29 = call i32 @addch(i8 signext 32)
%30 = call i32 (...) @standend()
br label %31
31: ; preds = %25
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %12
34: ; preds = %12
br label %35
35: ; preds = %34
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %7
38: ; preds = %7
%39 = call i32 (...) @refresh()
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = zext i1 %42 to i32
store i32 %43, i32* %4
br label %6
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @initscr()
br label %2
2: ; preds = %34, %0
%3 = phi i32 [ 1, %0 ], [ %36, %34 ]
%4 = load i32, i32* @LINES
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %34
6: ; preds = %2
%7 = load i32, i32* @COLS
br label %8
8: ; preds = %6, %29
%9 = phi i32 [ %30, %29 ], [ %4, %6 ]
%10 = phi i32 [ %31, %29 ], [ %7, %6 ]
%11 = phi i32 [ %32, %29 ], [ 0, %6 ]
%12 = icmp sgt i32 %10, 0
br i1 %12, label %13, label %29
13: ; preds = %8, %20
%14 = phi i32 [ %24, %20 ], [ 0, %8 ]
%15 = add nuw nsw i32 %14, %11
%16 = and i32 %15, 1
%17 = icmp eq i32 %16, %3
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = tail call i32 (...) @standout()
br label %20
20: ; preds = %18, %13
%21 = tail call i32 @move(i32 %11, i32 %14)
%22 = tail call i32 @addch(i8 signext 32)
%23 = tail call i32 (...) @standend()
%24 = add nuw nsw i32 %14, 1
%25 = load i32, i32* @COLS
%26 = icmp slt i32 %24, %25
br i1 %26, label %13, label %27
27: ; preds = %20
%28 = load i32, i32* @LINES
br label %29
29: ; preds = %27, %8
%30 = phi i32 [ %28, %27 ], [ %9, %8 ]
%31 = phi i32 [ %25, %27 ], [ %10, %8 ]
%32 = add nuw nsw i32 %11, 1
%33 = icmp slt i32 %32, %30
br i1 %33, label %8, label %34
34: ; preds = %29, %2
%35 = tail call i32 (...) @refresh()
%36 = xor i32 %3, 1
br label %2
}