#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 LINES;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ sit_down(int, int, int);
int /*<<< orphan*/ stand(int, int, int);
int walk_right(int, int, int);
int main(int argc, char const *argv[]) {
  initscr();
  curs_set(0);
  int x = -11;
  int y = LINES / 2 - 4 / 2;
  int walk_len = COLS / 2 - 11 / 2 - x;
  x = walk_right(x, y, walk_len / 4);
  stand(x, y, 1);
  while (1) {
    sit_down(x, y, 5);
  }
  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>
xor    %edi,%edi
call   1070 <curs_set@plt>
movl   $0xfffffff5,-0x14(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x5,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1050 <walk_right@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x1,%edx
call   1060 <stand@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x5,%edx
call   1030 <sit_down@plt>
jmp    11d7 <main+0x87>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %edi,%edi
call   1070 <curs_set@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
add    $0xfffffffe,%ebx
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
lea    0x6(%rdx),%eax
add    $0x9,%edx
test   %eax,%eax
cmovns %eax,%edx
sar    $0x2,%edx
mov    $0xfffffff5,%edi
mov    %ebx,%esi
call   1050 <walk_right@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1060 <stand@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x5,%edx
call   1030 <sit_down@plt>
jmp    11c0 <main+0x70>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @initscr()
%10 = call i32 @curs_set(i32 0)
store i32 -11, i32* %6
%11 = load i32, i32* @LINES
%12 = sdiv i32 %11, 2
%13 = sub nsw i32 %12, 2
store i32 %13, i32* %7
%14 = load i32, i32* @COLS
%15 = sdiv i32 %14, 2
%16 = sub nsw i32 %15, 5
%17 = load i32, i32* %6
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %8
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = sdiv i32 %21, 4
%23 = call i32 @walk_right(i32 %19, i32 %20, i32 %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @stand(i32 %24, i32 %25, i32 1)
br label %27
27: ; preds = %2, %27
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 @sit_down(i32 %28, i32 %29, i32 5)
br label %27
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 @curs_set(i32 0)
%5 = load i32, i32* @LINES
%6 = sdiv i32 %5, 2
%7 = add nsw i32 %6, -2
%8 = load i32, i32* @COLS
%9 = sdiv i32 %8, 2
%10 = add nsw i32 %9, 6
%11 = sdiv i32 %10, 4
%12 = tail call i32 @walk_right(i32 -11, i32 %7, i32 %11)
%13 = tail call i32 @stand(i32 %12, i32 %7, i32 1)
br label %14
14: ; preds = %14, %2
%15 = tail call i32 @sit_down(i32 %12, i32 %7, i32 5)
br label %14
}