#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 */
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  int _maxx;
  int _maxy;
};
typedef TYPE_1__ WINDOW;

/* Variables and functions */
int COLS;
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ scrollok(TYPE_1__ *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ wmove(TYPE_1__ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ wprintw(TYPE_1__ *, char *, char *);
void tx_colorwin(WINDOW *win) {
  int ctr;
  char *blankpad;
  blankpad = (char *)malloc(sizeof(char) * (COLS + 1));
  strcpy(blankpad, "");
  for (ctr = 0; ctr <= win->_maxx; ctr++) {
    strcat(blankpad, " ");
  }
  scrollok(win, 0);
  for (ctr = 0; ctr <= win->_maxy; ctr++) {
    wmove(win, ctr, 0);
    wprintw(win, "%s", blankpad);
  }
  scrollok(win, 1);
  free(blankpad);
}


x86 assembly (clang, -O0):
<tx_colorwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jg     11dd <tx_colorwin+0x6d>
mov    -0x18(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1080 <strcat@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <tx_colorwin+0x40>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1070 <scrollok@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0x4(%rcx),%eax
jg     122f <tx_colorwin+0xbf>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1090 <wmove@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xde6(%rip),%rsi
call   1050 <wprintw@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ef <tx_colorwin+0x7f>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1070 <scrollok@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tx_colorwin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe6c(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
cmpl   $0x0,(%rbx)
js     11c2 <tx_colorwin+0x52>
mov    $0xffffffff,%ebp
lea    0xe52(%rip),%r15
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
add    $0x1,%ebp
cmp    (%rbx),%ebp
jl     11b0 <tx_colorwin+0x40>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <scrollok@plt>
cmpl   $0x0,0x4(%rbx)
js     1202 <tx_colorwin+0x92>
mov    $0xffffffff,%ebp
lea    0xe24(%rip),%r15
xchg   %ax,%ax
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1090 <wmove@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <wprintw@plt>
cmp    0x4(%rbx),%ebp
jl     11e0 <tx_colorwin+0x70>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <scrollok@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32 }
@COLS = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c"%s\00"
define void @tx_colorwin(%struct.TYPE_6__* %0) {
%2 = alloca %struct.TYPE_6__*
%3 = alloca i32
%4 = alloca i8*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %2
%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** %4
%12 = load i8*, i8** %4
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %14
14: ; preds = %23, %1
%15 = load i32, i32* %3
%16 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = icmp sle i32 %15, %18
br i1 %19, label %20, label %26
20: ; preds = %14
%21 = load i8*, i8** %4
%22 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %14
26: ; preds = %14
%27 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%28 = call i32 @scrollok(%struct.TYPE_6__* %27, i32 0)
store i32 0, i32* %3
br label %29
29: ; preds = %42, %26
%30 = load i32, i32* %3
%31 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%32 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %31, i32 0, i32 1
%33 = load i32, i32* %32
%34 = icmp sle i32 %30, %33
br i1 %34, label %35, label %45
35: ; preds = %29
%36 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%37 = load i32, i32* %3
%38 = call i32 @wmove(%struct.TYPE_6__* %36, i32 %37, i32 0)
%39 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%40 = load i8*, i8** %4
%41 = call i32 @wprintw(%struct.TYPE_6__* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %29
45: ; preds = %29
%46 = load %struct.TYPE_6__*, %struct.TYPE_6__** %2
%47 = call i32 @scrollok(%struct.TYPE_6__* %46, i32 1)
%48 = load i8*, i8** %4
%49 = call i32 @free(i8* %48)
ret void
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, i32 }
@COLS = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c"%s\00"
define void @tx_colorwin(%struct.TYPE_6__* %0) {
%2 = load i32, i32* @COLS
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %1, %10
%11 = phi i32 [ %13, %10 ], [ 0, %1 ]
%12 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = add nuw nsw i32 %11, 1
%14 = load i32, i32* %7
%15 = icmp slt i32 %11, %14
br i1 %15, label %10, label %16
16: ; preds = %10, %1
%17 = tail call i32 @scrollok(%struct.TYPE_6__* %0, i32 0)
%18 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1
%19 = load i32, i32* %18
%20 = icmp slt i32 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %16, %21
%22 = phi i32 [ %25, %21 ], [ 0, %16 ]
%23 = tail call i32 @wmove(%struct.TYPE_6__* %0, i32 %22, i32 0)
%24 = tail call i32 @wprintw(%struct.TYPE_6__* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%25 = add nuw nsw i32 %22, 1
%26 = load i32, i32* %18
%27 = icmp slt i32 %22, %26
br i1 %27, label %21, label %28
28: ; preds = %21, %16
%29 = tail call i32 @scrollok(%struct.TYPE_6__* %0, i32 1)
%30 = tail call i32 @free(i8* %5)
ret void
}