#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ getyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ scrollok(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ wprintw(int /*<<< orphan*/ *, char *, char);
void tx_wcoloreol(WINDOW *win) {
  int y, x;
  int cury, curx;
  char sp_buf[10];
  getyx(win, cury, curx);
  getmaxyx(win, y, x);
  sprintf(sp_buf, "%%%dc", x - curx - 1);
  scrollok(win, 0);
  wprintw(win, sp_buf, ' ');
}


x86 assembly (clang, -O0):
<tx_wcoloreol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <getyx@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <getmaxyx@plt>
lea    -0x22(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    -0x18(%rbp),%edx
sub    $0x1,%edx
lea    0xe72(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1060 <scrollok@plt>
mov    -0x8(%rbp),%rdi
lea    -0x22(%rbp),%rsi
mov    $0x20,%edx
call   1050 <wprintw@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tx_wcoloreol>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
call   1030 <getyx@plt>
mov    %rbx,%rdi
call   1040 <getmaxyx@plt>
lea    0xe92(%rip),%rsi
lea    0xe(%rsp),%r14
mov    %r14,%rdi
call   1070 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <scrollok@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x20,%edx
call   1050 <wprintw@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%%%dc\00"
define void @tx_wcoloreol(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i8]
store i32* %0, i32** %2
%8 = load i32*, i32** %2
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @getyx(i32* %8, i32 %9, i32 %10)
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @getmaxyx(i32* %12, i32 %13, i32 %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = sub nsw i32 %17, %18
%20 = sub nsw i32 %19, 1
%21 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %2
%23 = call i32 @scrollok(i32* %22, i32 0)
%24 = load i32*, i32** %2
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%26 = call i32 @wprintw(i32* %24, i8* %25, i8 signext 32)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%%%dc\00"
define void @tx_wcoloreol(i32* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @getyx(i32* %0, i32 undef, i32 undef)
%5 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 undef)
%7 = tail call i32 @scrollok(i32* %0, i32 0)
%8 = call i32 @wprintw(i32* %0, i8* %3, i8 signext 32)
ret void
}