#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*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int /*<<< orphan*/ wborder(int /*<<< orphan*/ *, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void draw_window(WINDOW *win, int height, int width, char c) {
  int x, y;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      mvwaddch(win, y, x, c);
    }
  }
  wborder(win, 0, 0, 0, 0, 0, 0, 0, 0);
  wrefresh(win);
}


x86 assembly (clang, -O0):
<draw_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a1 <draw_window+0x71>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118e <draw_window+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1050 <mvwaddch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1161 <draw_window+0x31>
jmp    1193 <draw_window+0x63>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114e <draw_window+0x1e>
mov    -0x8(%rbp),%rdi
xor    %r9d,%r9d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <wborder@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_window>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
test   %esi,%esi
jle    1179 <draw_window+0x49>
mov    %edx,%r12d
mov    %esi,%r14d
xor    %ebx,%ebx
movsbl %cl,%r13d
jmp    1158 <draw_window+0x28>
add    $0x1,%ebx
cmp    %r14d,%ebx
je     1179 <draw_window+0x49>
test   %r12d,%r12d
jle    1150 <draw_window+0x20>
xor    %ebp,%ebp
nop
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
call   1050 <mvwaddch@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1160 <draw_window+0x30>
jmp    1150 <draw_window+0x20>
sub    $0x8,%rsp
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
push   $0x0
call   1030 <wborder@plt>
add    $0x20,%rsp
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wrefresh@plt>

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

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