#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*/ waddch(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
void curutil_window_fill(WINDOW *win, int ch) {
  int h, w;
  int r, c;
  getmaxyx(win, h, w);
  wmove(win, 0, 0);
  for (r = 0; r < h; r++)
    for (c = 0; c < w; c++)
      waddch(win, ch);
  wmove(win, 0, 0);
}


x86 assembly (clang, -O0):
<curutil_window_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <getmaxyx@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <wmove@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ae <curutil_window_fill+0x7e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119b <curutil_window_fill+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <waddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <curutil_window_fill+0x45>
jmp    11a0 <curutil_window_fill+0x70>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <curutil_window_fill+0x32>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <wmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curutil_window_fill>:
push   %rbx
mov    %rdi,%rbx
call   1030 <getmaxyx@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <wmove@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <wmove@plt>

LLVM IR (-O0):
define void @curutil_window_fill(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @getmaxyx(i32* %9, i32 %10, i32 %11)
%13 = load i32*, i32** %3
%14 = call i32 @wmove(i32* %13, i32 0, i32 0)
store i32 0, i32* %7
br label %15
15: ; preds = %32, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %35
19: ; preds = %15
store i32 0, i32* %8
br label %20
20: ; preds = %28, %19
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i32*, i32** %3
%26 = load i32, i32* %4
%27 = call i32 @waddch(i32* %25, i32 %26)
br label %28
28: ; preds = %24
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %20
31: ; preds = %20
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %15
35: ; preds = %15
%36 = load i32*, i32** %3
%37 = call i32 @wmove(i32* %36, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @curutil_window_fill(i32* %0, i32 %1) {
%3 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%4 = tail call i32 @wmove(i32* %0, i32 0, i32 0)
%5 = tail call i32 @wmove(i32* %0, i32 0, i32 0)
ret void
}