#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*/ COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(int, int, char const *);
void draw_str(char const *str, int col, int row, int color) {
  if (col >= (80) || col < 0 || row >= (24) || row < 0)
    return;
  attron(COLOR_PAIR(color));
  mvprintw(row, col, str);
  attroff(COLOR_PAIR(color));
}


x86 assembly (clang, -O0):
<draw_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x50,-0xc(%rbp)
jge    117d <draw_str+0x3d>
cmpl   $0x0,-0xc(%rbp)
jl     117d <draw_str+0x3d>
cmpl   $0x18,-0x10(%rbp)
jge    117d <draw_str+0x3d>
cmpl   $0x0,-0x10(%rbp)
jge    1182 <draw_str+0x42>
jmp    11af <draw_str+0x6f>
mov    -0x14(%rbp),%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1060 <mvprintw@plt>
mov    -0x14(%rbp),%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_str>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x4f,%esi
ja     118e <draw_str+0x4e>
mov    %edx,%ebx
cmp    $0x17,%edx
ja     118e <draw_str+0x4e>
mov    %ecx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
mov    %ecx,%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
call   1060 <mvprintw@plt>
mov    %r15d,%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <attroff@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_str(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 80
br i1 %10, label %20, label %11
11: ; preds = %4
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = load i32, i32* %7
%16 = icmp sge i32 %15, 24
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17, %14, %11, %4
br label %32
21: ; preds = %17
%22 = load i32, i32* %8
%23 = call i32 @COLOR_PAIR(i32 %22)
%24 = call i32 @attron(i32 %23)
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = load i8*, i8** %5
%28 = call i32 @mvprintw(i32 %25, i32 %26, i8* %27)
%29 = load i32, i32* %8
%30 = call i32 @COLOR_PAIR(i32 %29)
%31 = call i32 @attroff(i32 %30)
br label %32
32: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
define void @draw_str(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ugt i32 %1, 79
%6 = icmp ugt i32 %2, 23
%7 = or i1 %5, %6
br i1 %7, label %14, label %8
8: ; preds = %4
%9 = tail call i32 @COLOR_PAIR(i32 %3)
%10 = tail call i32 @attron(i32 %9)
%11 = tail call i32 @mvprintw(i32 %2, i32 %1, i8* %0)
%12 = tail call i32 @COLOR_PAIR(i32 %3)
%13 = tail call i32 @attroff(i32 %12)
br label %14
14: ; preds = %4, %8
ret void
}