#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 LINES;
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ standend();
int /*<<< orphan*/ standout();
int main(int argc, char *argv[]) {
  int i;
  initscr();
  clear();
  for (i = 0; i < LINES; ++i) {
    move(i, i + i);
    if (i % 2 == 1)
      standout();
    addstr("Hello, world");
    if (i % 2 == 1)
      standend();
    sleep(1);
    refresh();
  }
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1090 <clear@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%eax
jge    123c <main+0xac>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
add    -0x14(%rbp),%esi
call   10b0 <move@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11f6 <main+0x66>
mov    $0x0,%al
call   1050 <standout@plt>
lea    0xe03(%rip),%rdi
call   1080 <addstr@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    121d <main+0x8d>
mov    $0x0,%al
call   1030 <standend@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bb <main+0x2b>
mov    $0x0,%al
call   1070 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1090 <clear@plt>
mov    0x2e3c(%rip),%r15
cmpl   $0x0,(%r15)
jle    120a <main+0x7a>
lea    0xe47(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11e4 <main+0x54>
nop
mov    %r14,%rdi
call   1080 <addstr@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
add    $0x1,%ebx
add    $0x2,%ebp
cmp    (%r15),%ebx
jge    120a <main+0x7a>
mov    %ebx,%edi
mov    %ebp,%esi
call   10b0 <move@plt>
test   $0x1,%bl
je     11c0 <main+0x30>
xor    %eax,%eax
call   1050 <standout@plt>
mov    %r14,%rdi
call   1080 <addstr@plt>
xor    %eax,%eax
call   1030 <standend@plt>
jmp    11c8 <main+0x38>
xor    %eax,%eax
call   1070 <endwin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LINES = global i32 0
@.str = [13 x i8] c"Hello, world\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @initscr()
%8 = call i32 (...) @clear()
store i32 0, i32* %6
br label %9
9: ; preds = %34, %2
%10 = load i32, i32* %6
%11 = load i32, i32* @LINES
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
%18 = call i32 @move(i32 %14, i32 %17)
%19 = load i32, i32* %6
%20 = srem i32 %19, 2
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 (...) @standout()
br label %24
24: ; preds = %22, %13
%25 = call i32 @addstr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%26 = load i32, i32* %6
%27 = srem i32 %26, 2
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 (...) @standend()
br label %31
31: ; preds = %29, %24
%32 = call i32 @sleep(i32 1)
%33 = call i32 (...) @refresh()
br label %34
34: ; preds = %31
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %9
37: ; preds = %9
%38 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@LINES = global i32 0
@.str = [13 x i8] c"Hello, world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 (...) @clear()
%5 = load i32, i32* @LINES
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %2, %19
%8 = phi i32 [ %22, %19 ], [ 0, %2 ]
%9 = shl nuw nsw i32 %8, 1
%10 = tail call i32 @move(i32 %8, i32 %9)
%11 = and i32 %8, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %7
%14 = tail call i32 (...) @standout()
%15 = tail call i32 @addstr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 (...) @standend()
br label %19
17: ; preds = %7
%18 = tail call i32 @addstr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 (...) @refresh()
%22 = add nuw nsw i32 %8, 1
%23 = load i32, i32* @LINES
%24 = icmp slt i32 %22, %23
br i1 %24, label %7, label %25
25: ; preds = %19, %2
%26 = tail call i32 (...) @endwin()
ret i32 0
}