#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*/ waddch(int /*<<< orphan*/ *, char);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
void wfillrect(WINDOW *w, int sy, int sx, int height, int width) {
  int x, y;
  for (y = sy; y < (sy + height); y++) {
    wmove(w, y, sx);
    for (x = 0; x < width; x++)
      waddch(w, ' ');
  }
}


x86 assembly (clang, -O0):
<wfillrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    11a1 <wfillrect+0x81>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <wmove@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    118e <wfillrect+0x6e>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1166 <wfillrect+0x46>
jmp    1193 <wfillrect+0x73>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113f <wfillrect+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfillrect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    1184 <wfillrect+0x64>
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%r13d
mov    %rdi,%rbx
add    %esi,%r15d
jmp    1159 <wfillrect+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
cmp    %r15d,%r13d
jge    1184 <wfillrect+0x64>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
call   1040 <wmove@plt>
test   %r12d,%r12d
jle    1150 <wfillrect+0x30>
mov    %r12d,%ebp
nop
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
add    $0xffffffff,%ebp
jne    1170 <wfillrect+0x50>
jmp    1150 <wfillrect+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @wfillrect(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %3, %1
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = icmp sgt i32 %4, 0
br label %10
10: ; preds = %8, %18
%11 = phi i32 [ %1, %8 ], [ %19, %18 ]
%12 = tail call i32 @wmove(i32* %0, i32 %11, i32 %2)
br i1 %9, label %13, label %18
13: ; preds = %10, %13
%14 = phi i32 [ %16, %13 ], [ 0, %10 ]
%15 = tail call i32 @waddch(i32* %0, i8 signext 32)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %4
br i1 %17, label %18, label %13
18: ; preds = %13, %10
%19 = add nsw i32 %11, 1
%20 = icmp slt i32 %19, %6
br i1 %20, label %10, label %21
21: ; preds = %18, %5
ret void
}