#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 /*<<< orphan*/ nc_COLS();
scalar_t__ nc_LINES();
int /*<<< orphan*/ nc_get_yx(int *, int *);
int /*<<< orphan*/ nc_set_yx(int, int);
scalar_t__ tabs_single();
int /*<<< orphan*/ ui_draw_tabs();
int /*<<< orphan*/ ui_draw_windows(int /*<<< orphan*/, int, scalar_t__,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ windows_cur();
void ui_redraw() {
  int save_y, save_x;
  nc_get_yx(&save_y, &save_x);
  int tabspace = tabs_single() ? 0 : 1;
  ui_draw_windows(windows_cur(), tabspace, nc_LINES() - (1 + tabspace),
                  nc_COLS());
  if (tabspace)
    ui_draw_tabs();
  nc_set_yx(save_y, save_x);
}


x86 assembly (clang, -O0):
<ui_redraw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <nc_get_yx@plt>
mov    $0x0,%al
call   10a0 <tabs_single@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <windows_cur@plt>
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <nc_LINES@plt>
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1080 <nc_COLS@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    %eax,%ecx
call   1050 <ui_draw_windows@plt>
cmpl   $0x0,-0xc(%rbp)
je     1200 <ui_redraw+0x80>
mov    $0x0,%al
call   1040 <ui_draw_tabs@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <nc_set_yx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_redraw>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1090 <nc_get_yx@plt>
xor    %eax,%eax
call   10a0 <tabs_single@plt>
mov    %rax,%r14
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
xor    %eax,%eax
call   1030 <windows_cur@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1070 <nc_LINES@plt>
mov    %rbp,%rbx
not    %rbx
add    %rax,%rbx
xor    %eax,%eax
call   1080 <nc_COLS@plt>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1050 <ui_draw_windows@plt>
test   %r14,%r14
jne    11e3 <ui_redraw+0x63>
xor    %eax,%eax
call   1040 <ui_draw_tabs@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1060 <nc_set_yx@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ui_redraw() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @nc_get_yx(i32* %1, i32* %2)
%5 = call i64 (...) @tabs_single()
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 0, i32 1
store i32 %8, i32* %3
%9 = call i32 (...) @windows_cur()
%10 = load i32, i32* %3
%11 = call i64 (...) @nc_LINES()
%12 = load i32, i32* %3
%13 = add nsw i32 1, %12
%14 = sext i32 %13 to i64
%15 = sub nsw i64 %11, %14
%16 = call i32 (...) @nc_COLS()
%17 = call i32 @ui_draw_windows(i32 %9, i32 %10, i64 %15, i32 %16)
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (...) @ui_draw_tabs()
br label %22
22: ; preds = %20, %0
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 @nc_set_yx(i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
define void @ui_redraw() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @nc_get_yx(i32* %1, i32* %2)
%6 = call i64 (...) @tabs_single()
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 (...) @windows_cur()
%10 = call i64 (...) @nc_LINES()
%11 = select i1 %7, i64 -2, i64 -1
%12 = add i64 %11, %10
%13 = call i32 (...) @nc_COLS()
%14 = call i32 @ui_draw_windows(i32 %9, i32 %8, i64 %12, i32 %13)
br i1 %7, label %15, label %17
15: ; preds = %0
%16 = call i32 (...) @ui_draw_tabs()
br label %17
17: ; preds = %15, %0
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 @nc_set_yx(i32 %18, i32 %19)
ret void
}