#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 /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void coloreol() {
  char *blankpad;
  int y, x;
  int i;
  blankpad = (char *)malloc(sizeof(char) * (COLS + 1));
  strcpy(blankpad, "");
  getyx(stdscr, y, x);
  for (i = x; i <= COLS - 1; i++)
    strcat(blankpad, " ");
  printw(blankpad);
  free(blankpad);
}


x86 assembly (clang, -O0):
<coloreol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1040 <strcpy@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <getyx@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e27(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11e4 <coloreol+0x84>
mov    -0x8(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <coloreol+0x4f>
mov    -0x8(%rbp),%rdi
call   1060 <printw@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coloreol>:
push   %rbx
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <getyx@plt>
mov    %rbx,%rdi
call   1060 <printw@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@COLS = global i32 0
@.str = [1 x i8] zeroinitializer
@stdscr = global i32 0
@.str.1 = [2 x i8] c" \00"
define void @coloreol() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = load i32, i32* @COLS
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 1, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %1
%12 = load i8*, i8** %1
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stdscr
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @getyx(i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %3
store i32 %18, i32* %4
br label %19
19: ; preds = %27, %0
%20 = load i32, i32* %4
%21 = load i32, i32* @COLS
%22 = sub nsw i32 %21, 1
%23 = icmp sle i32 %20, %22
br i1 %23, label %24, label %30
24: ; preds = %19
%25 = load i8*, i8** %1
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %24
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %19
30: ; preds = %19
%31 = load i8*, i8** %1
%32 = call i32 @printw(i8* %31)
%33 = load i8*, i8** %1
%34 = call i32 @free(i8* %33)
ret void
}

LLVM IR (-O2):
@COLS = global i32 0
@.str = [1 x i8] zeroinitializer
@stdscr = global i32 0
define void @coloreol() {
%1 = load i32, i32* @COLS
%2 = add nsw i32 %1, 1
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdscr
%7 = tail call i32 @getyx(i32 %6, i32 undef, i32 undef)
%8 = tail call i32 @printw(i8* %4)
%9 = tail call i32 @free(i8* %4)
ret void
}