#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*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ refresh();
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();
  }
  refresh();
  getch();
  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   10a0 <clear@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%eax
jge    1230 <main+0xa0>
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   1090 <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>
jmp    1222 <main+0x92>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bb <main+0x2b>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <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   10a0 <clear@plt>
mov    0x2e3c(%rip),%r15
cmpl   $0x0,(%r15)
jle    11f9 <main+0x69>
lea    0xe47(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11d3 <main+0x43>
nop
mov    %r14,%rdi
call   1090 <addstr@plt>
add    $0x1,%ebx
add    $0x2,%ebp
cmp    (%r15),%ebx
jge    11f9 <main+0x69>
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   1090 <addstr@plt>
xor    %eax,%eax
call   1030 <standend@plt>
jmp    11c8 <main+0x38>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
call   1080 <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 = %32, %2
%10 = load i32, i32* %6
%11 = load i32, i32* @LINES
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %35
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
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %9
35: ; preds = %9
%36 = call i32 (...) @refresh()
%37 = call i32 (...) @getch()
%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 %23
7: ; preds = %2, %19
%8 = phi i32 [ %20, %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 = add nuw nsw i32 %8, 1
%21 = load i32, i32* @LINES
%22 = icmp slt i32 %20, %21
br i1 %22, label %7, label %23
23: ; preds = %19, %2
%24 = tail call i32 (...) @refresh()
%25 = tail call i32 (...) @getch()
%26 = tail call i32 (...) @endwin()
ret i32 0
}