#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 */

/* Variables and functions */
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvprintw(int, scalar_t__, char *, int);
scalar_t__ strlen(char *);
void printstatus(int score) {
  extern int rows;
  extern int cols;
  extern int level;
  static int oldscrrow;
  int clrcol;
  char *scoref = "Score: %d";
  char *levelf = "Level: %d";
  if (oldscrrow != rows)
    for (clrcol = 0; clrcol < cols; clrcol++)
      mvaddch(oldscrrow, clrcol, ' ');
  mvprintw(rows, 0, scoref, score);
  mvprintw(rows, cols - strlen(levelf), levelf, level);
  oldscrrow = rows;
}


x86 assembly (clang, -O0):
<printstatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ee5(%rip),%eax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
je     11a5 <printstatus+0x75>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%eax
jge    11a0 <printstatus+0x70>
mov    0x2eb7(%rip),%edi
mov    -0x8(%rbp),%esi
mov    $0x20,%edx
call   1040 <mvaddch@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <printstatus+0x3d>
jmp    11a5 <printstatus+0x75>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%esi
call   1050 <mvprintw@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e27(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edi
sub    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    0x2dea(%rip),%rax
mov    (%rax),%ecx
call   1050 <mvprintw@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2e30(%rip)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstatus>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
mov    0x2f04(%rip),%eax
mov    0x2e99(%rip),%r14
mov    (%r14),%edi
mov    0x2eb7(%rip),%rbx
cmp    %edi,%eax
je     118c <printstatus+0x6c>
cmpl   $0x0,(%rbx)
jle    118c <printstatus+0x6c>
mov    %eax,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <mvaddch@plt>
cmpl   $0x2,(%rbx)
jl     1189 <printstatus+0x69>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2ebe(%rip),%edi
mov    %ebp,%esi
mov    $0x20,%edx
call   1030 <mvaddch@plt>
add    $0x1,%ebp
cmp    (%rbx),%ebp
jl     1170 <printstatus+0x50>
mov    (%r14),%edi
lea    0xe6d(%rip),%rdx
xor    %esi,%esi
mov    %r15d,%ecx
call   1040 <mvprintw@plt>
mov    (%r14),%edi
movslq (%rbx),%rsi
add    $0xfffffffffffffff7,%rsi
mov    0x2e32(%rip),%rax
mov    (%rax),%ecx
lea    0xe53(%rip),%rdx
call   1040 <mvprintw@plt>
mov    (%r14),%eax
mov    %eax,0x2e6f(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@printstatus.oldscrrow = internal global i32 0
@.str = [10 x i8] c"Score: %d\00"
@.str.1 = [10 x i8] c"Level: %d\00"
@rows = external global i32
@cols = external global i32
@level = external global i32
define void @printstatus(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = load i32, i32* @printstatus.oldscrrow
%7 = load i32, i32* @rows
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %1
store i32 0, i32* %3
br label %10
10: ; preds = %18, %9
%11 = load i32, i32* %3
%12 = load i32, i32* @cols
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* @printstatus.oldscrrow
%16 = load i32, i32* %3
%17 = call i32 @mvaddch(i32 %15, i32 %16, i8 signext 32)
br label %18
18: ; preds = %14
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %10
21: ; preds = %10
br label %22
22: ; preds = %21, %1
%23 = load i32, i32* @rows
%24 = load i8*, i8** %4
%25 = load i32, i32* %2
%26 = call i32 @mvprintw(i32 %23, i64 0, i8* %24, i32 %25)
%27 = load i32, i32* @rows
%28 = load i32, i32* @cols
%29 = sext i32 %28 to i64
%30 = load i8*, i8** %5
%31 = call i64 @strlen(i8* %30)
%32 = sub nsw i64 %29, %31
%33 = load i8*, i8** %5
%34 = load i32, i32* @level
%35 = call i32 @mvprintw(i32 %27, i64 %32, i8* %33, i32 %34)
%36 = load i32, i32* @rows
store i32 %36, i32* @printstatus.oldscrrow
ret void
}

LLVM IR (-O2):
@printstatus.oldscrrow = internal unnamed_addr global i32 0
@.str = [10 x i8] c"Score: %d\00"
@.str.1 = [10 x i8] c"Level: %d\00"
@rows = external global i32
@cols = external global i32
@level = external global i32
define void @printstatus(i32 %0) {
%2 = load i32, i32* @printstatus.oldscrrow
%3 = load i32, i32* @rows
%4 = icmp ne i32 %2, %3
%5 = load i32, i32* @cols
%6 = icmp sgt i32 %5, 0
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %21
8: ; preds = %1
%9 = tail call i32 @mvaddch(i32 %2, i32 0, i8 signext 32)
%10 = load i32, i32* @cols
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %8, %12
%13 = phi i32 [ %16, %12 ], [ 1, %8 ]
%14 = load i32, i32* @printstatus.oldscrrow
%15 = tail call i32 @mvaddch(i32 %14, i32 %13, i8 signext 32)
%16 = add nuw nsw i32 %13, 1
%17 = load i32, i32* @cols
%18 = icmp slt i32 %16, %17
br i1 %18, label %12, label %19
19: ; preds = %12, %8
%20 = load i32, i32* @rows
br label %21
21: ; preds = %19, %1
%22 = phi i32 [ %20, %19 ], [ %3, %1 ]
%23 = tail call i32 @mvprintw(i32 %22, i64 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%24 = load i32, i32* @rows
%25 = load i32, i32* @cols
%26 = sext i32 %25 to i64
%27 = add nsw i64 %26, -9
%28 = load i32, i32* @level
%29 = tail call i32 @mvprintw(i32 %24, i64 %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @rows
store i32 %30, i32* @printstatus.oldscrrow
ret void
}