#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*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                             char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *draw_flappy_bird(int flappy_height, WINDOW *flappy_win) {
  if (flappy_win != NULL) {
    werase(flappy_win);
    wrefresh(flappy_win);
    delwin(flappy_win);
  }
  flappy_win = newwin(3, 3, flappy_height, 20);
  mvwprintw(flappy_win, 0, 0, " A ");
  mvwprintw(flappy_win, 1, 0, "BRD");
  wrefresh(flappy_win);
  return flappy_win;
}


x86 assembly (clang, -O0):
<draw_flappy_bird>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1185 <draw_flappy_bird+0x35>
mov    -0x10(%rbp),%rdi
call   1070 <werase@plt>
mov    -0x10(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1050 <delwin@plt>
mov    -0x4(%rbp),%edx
mov    $0x3,%esi
mov    $0x14,%ecx
mov    %esi,%edi
call   1040 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
lea    0xe56(%rip),%rcx
mov    %edx,%esi
call   1060 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
lea    0xe41(%rip),%rcx
call   1060 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_flappy_bird>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
test   %rsi,%rsi
je     1175 <draw_flappy_bird+0x25>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1070 <werase@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rdi
call   1050 <delwin@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    %ebp,%edx
mov    $0x14,%ecx
call   1040 <newwin@plt>
mov    %rax,%rbx
lea    0xe6b(%rip),%rcx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <mvwprintw@plt>
lea    0xe5c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <mvwprintw@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" A \00"
@.str.1 = [4 x i8] c"BRD\00"
define i32* @draw_flappy_bird(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = call i32 @werase(i32* %8)
%10 = load i32*, i32** %4
%11 = call i32 @wrefresh(i32* %10)
%12 = load i32*, i32** %4
%13 = call i32 @delwin(i32* %12)
br label %14
14: ; preds = %7, %2
%15 = load i32, i32* %3
%16 = call i32* @newwin(i32 3, i32 3, i32 %15, i32 20)
store i32* %16, i32** %4
%17 = load i32*, i32** %4
%18 = call i32 @mvwprintw(i32* %17, i32 0, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = load i32*, i32** %4
%20 = call i32 @mvwprintw(i32* %19, i32 1, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32*, i32** %4
%22 = call i32 @wrefresh(i32* %21)
%23 = load i32*, i32** %4
ret i32* %23
}

LLVM IR (-O2):
@.str = [4 x i8] c" A \00"
@.str.1 = [4 x i8] c"BRD\00"
define i32* @draw_flappy_bird(i32 %0, i32* %1) {
%3 = icmp eq i32* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @werase(i32* %1)
%6 = tail call i32 @wrefresh(i32* %1)
%7 = tail call i32 @delwin(i32* %1)
br label %8
8: ; preds = %4, %2
%9 = tail call i32* @newwin(i32 3, i32 3, i32 %0, i32 20)
%10 = tail call i32 @mvwprintw(i32* %9, i32 0, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @mvwprintw(i32* %9, i32 1, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @wrefresh(i32* %9)
ret i32* %9
}