#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*/ COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *,
                             char const *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void print_color(WINDOW *win, int y, int x, int color, const char *str) {
  attron(COLOR_PAIR(color));
  mvwprintw(win, y, x, "%s", str);
  attroff(COLOR_PAIR(color));
  wrefresh(win);
}


x86 assembly (clang, -O0):
<print_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%r8
lea    0xe73(%rip),%rcx
call   1070 <mvwprintw@plt>
mov    -0x14(%rbp),%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_color>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%rbx
mov    %ecx,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
lea    0xe85(%rip),%rcx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14,%r8
call   1070 <mvwprintw@plt>
mov    %ebp,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wrefresh@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @print_color(i32* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i32, i32* %9
%12 = call i32 @COLOR_PAIR(i32 %11)
%13 = call i32 @attron(i32 %12)
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = load i8*, i8** %10
%18 = call i32 @mvwprintw(i32* %14, i32 %15, i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %9
%20 = call i32 @COLOR_PAIR(i32 %19)
%21 = call i32 @attroff(i32 %20)
%22 = load i32*, i32** %6
%23 = call i32 @wrefresh(i32* %22)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @print_color(i32* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = tail call i32 @COLOR_PAIR(i32 %3)
%7 = tail call i32 @attron(i32 %6)
%8 = tail call i32 @mvwprintw(i32* %0, i32 %1, i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = tail call i32 @COLOR_PAIR(i32 %3)
%10 = tail call i32 @attroff(i32 %9)
%11 = tail call i32 @wrefresh(i32* %0)
ret void
}