#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;
scalar_t__ LINES;
int /*<<< orphan*/ addstr(char const *);
int /*<<< orphan*/ clrtoeol();
int /*<<< orphan*/ move(scalar_t__, int);
int /*<<< orphan*/ scrollok(int /*<<< orphan*/, int);
int /*<<< orphan*/ stdscr;
void nc_status(const char *fmt, int right) {
  scrollok(stdscr, 0);
  int x = 0;
  if (right)
    x = COLS / 2;
  move(LINES - 1, x);
  clrtoeol();
  addstr(fmt);
  scrollok(stdscr, 1);
}


x86 assembly (clang, -O0):
<nc_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <scrollok@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1184 <nc_status+0x44>
mov    0x2e61(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
mov    -0x10(%rbp),%esi
call   1060 <move@plt>
mov    $0x0,%al
call   1040 <clrtoeol@plt>
mov    -0x8(%rbp),%rdi
call   1050 <addstr@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1030 <scrollok@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc_status>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    0x2e8d(%rip),%r15
mov    (%r15),%edi
xor    %ebp,%ebp
xor    %esi,%esi
call   1030 <scrollok@plt>
test   %ebx,%ebx
je     1175 <nc_status+0x35>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
mov    0x2e6c(%rip),%rax
mov    (%rax),%rdi
add    $0xffffffffffffffff,%rdi
mov    %ebp,%esi
call   1060 <move@plt>
xor    %eax,%eax
call   1040 <clrtoeol@plt>
mov    %r14,%rdi
call   1050 <addstr@plt>
mov    (%r15),%edi
mov    $0x1,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <scrollok@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@COLS = global i32 0
@LINES = global i64 0
define void @nc_status(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* @stdscr
%7 = call i32 @scrollok(i32 %6, i32 0)
store i32 0, i32* %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @COLS
%12 = sdiv i32 %11, 2
store i32 %12, i32* %5
br label %13
13: ; preds = %10, %2
%14 = load i64, i64* @LINES
%15 = sub nsw i64 %14, 1
%16 = load i32, i32* %5
%17 = call i32 @move(i64 %15, i32 %16)
%18 = call i32 (...) @clrtoeol()
%19 = load i8*, i8** %3
%20 = call i32 @addstr(i8* %19)
%21 = load i32, i32* @stdscr
%22 = call i32 @scrollok(i32 %21, i32 1)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@COLS = global i32 0
@LINES = global i64 0
define void @nc_status(i8* %0, i32 %1) {
%3 = load i32, i32* @stdscr
%4 = tail call i32 @scrollok(i32 %3, i32 0)
%5 = icmp eq i32 %1, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @COLS
%8 = sdiv i32 %7, 2
br label %9
9: ; preds = %6, %2
%10 = phi i32 [ %8, %6 ], [ 0, %2 ]
%11 = load i64, i64* @LINES
%12 = add nsw i64 %11, -1
%13 = tail call i32 @move(i64 %12, i32 %10)
%14 = tail call i32 (...) @clrtoeol()
%15 = tail call i32 @addstr(i8* %0)
%16 = load i32, i32* @stdscr
%17 = tail call i32 @scrollok(i32 %16, i32 1)
ret void
}