#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 COLS;
scalar_t__ LINES;
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ color_set(int, int /*<<< orphan*/);
int /*<<< orphan*/ move(scalar_t__, int);
int /*<<< orphan*/ printw(char *, char *, char *);
int /*<<< orphan*/ refresh();
void print_mes(int mes_color, char *who, char *mes) {
  int i;
  for (i = 0; i < COLS - 1; i++) {
    move(LINES - 1, i);
    addstr(" ");
  }
  color_set(mes_color, 0);
  move(LINES - 1, 0);
  printw("%s: %s", who, mes);
  refresh();
}


x86 assembly (clang, -O0):
<print_mes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e6c(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11b1 <print_mes+0x61>
mov    0x2e60(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
mov    -0x1c(%rbp),%esi
call   1070 <move@plt>
lea    0xe62(%rip),%rdi
call   1050 <addstr@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <print_mes+0x1a>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1060 <color_set@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
call   1070 <move@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe23(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %rsi,%r15
mov    %edi,%r12d
mov    0x2e74(%rip),%r13
cmpl   $0x2,0x0(%r13)
jl     11b4 <print_mes+0x64>
xor    %ebx,%ebx
mov    0x2e6c(%rip),%r14
lea    0xe7d(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14),%rdi
add    $0xffffffffffffffff,%rdi
mov    %ebx,%esi
call   1070 <move@plt>
mov    %rbp,%rdi
call   1050 <addstr@plt>
add    $0x1,%ebx
mov    0x0(%r13),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1190 <print_mes+0x40>
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <color_set@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe28(%rip),%rdi
mov    %r15,%rsi
mov    (%rsp),%rdx
call   1030 <printw@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <refresh@plt>

LLVM IR (-O0):
@COLS = global i32 0
@LINES = global i64 0
@.str = [2 x i8] c" \00"
@.str.1 = [7 x i8] c"%s: %s\00"
define void @print_mes(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %7
br label %8
8: ; preds = %19, %3
%9 = load i32, i32* %7
%10 = load i32, i32* @COLS
%11 = sub nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %22
13: ; preds = %8
%14 = load i64, i64* @LINES
%15 = sub nsw i64 %14, 1
%16 = load i32, i32* %7
%17 = call i32 @move(i64 %15, i32 %16)
%18 = call i32 @addstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %13
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %8
22: ; preds = %8
%23 = load i32, i32* %4
%24 = call i32 @color_set(i32 %23, i32 0)
%25 = load i64, i64* @LINES
%26 = sub nsw i64 %25, 1
%27 = call i32 @move(i64 %26, i32 0)
%28 = load i8*, i8** %5
%29 = load i8*, i8** %6
%30 = call i32 @printw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8* %29)
%31 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@COLS = global i32 0
@LINES = global i64 0
@.str = [2 x i8] c" \00"
@.str.1 = [7 x i8] c"%s: %s\00"
define void @print_mes(i32 %0, i8* %1, i8* %2) {
%4 = load i32, i32* @COLS
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %16
6: ; preds = %3, %6
%7 = phi i32 [ %12, %6 ], [ 0, %3 ]
%8 = load i64, i64* @LINES
%9 = add nsw i64 %8, -1
%10 = tail call i32 @move(i64 %9, i32 %7)
%11 = tail call i32 @addstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = add nuw nsw i32 %7, 1
%13 = load i32, i32* @COLS
%14 = add nsw i32 %13, -1
%15 = icmp slt i32 %12, %14
br i1 %15, label %6, label %16
16: ; preds = %6, %3
%17 = tail call i32 @color_set(i32 %0, i32 0)
%18 = load i64, i64* @LINES
%19 = add nsw i64 %18, -1
%20 = tail call i32 @move(i64 %19, i32 0)
%21 = tail call i32 @printw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%22 = tail call i32 (...) @refresh()
ret void
}