#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 EXIT_SUCCESS;
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(void) {
  initscr();
  clear();
  for (int i = 0; i < LINES; ++i) {
    move(i, i + i);
    if (i % 2 == 1)
      standout();
    addstr("Hello, world");
    if (i % 2 == 1)
      standend();
    refresh();
    sleep(1);
    move(i, i + i);
    addstr("            ");
  }
  endwin();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1090 <clear@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e2a(%rip),%rcx
cmp    (%rcx),%eax
jge    124f <main+0xbf>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x8(%rbp),%esi
call   10b0 <move@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11ef <main+0x5f>
mov    $0x0,%al
call   1050 <standout@plt>
lea    0xe0a(%rip),%rdi
call   1080 <addstr@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1216 <main+0x86>
mov    $0x0,%al
call   1030 <standend@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x8(%rbp),%esi
call   10b0 <move@plt>
lea    0xdd1(%rip),%rdi
call   1080 <addstr@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b4 <main+0x24>
mov    $0x0,%al
call   1070 <endwin@plt>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1090 <clear@plt>
mov    0x2e3b(%rip),%r12
cmpl   $0x0,(%r12)
jle    122c <main+0x9c>
lea    0xe45(%rip),%r14
lea    0xe4b(%rip),%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1206 <main+0x76>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1080 <addstr@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   10b0 <move@plt>
mov    %r15,%rdi
call   1080 <addstr@plt>
add    $0x1,%ebx
add    $0x2,%ebp
cmp    (%r12),%ebx
jge    122c <main+0x9c>
mov    %ebx,%edi
mov    %ebp,%esi
call   10b0 <move@plt>
test   $0x1,%bl
je     11d0 <main+0x40>
xor    %eax,%eax
call   1050 <standout@plt>
mov    %r14,%rdi
call   1080 <addstr@plt>
xor    %eax,%eax
call   1030 <standend@plt>
jmp    11d8 <main+0x48>
xor    %eax,%eax
call   1070 <endwin@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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