#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*/ A_BLINK;
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ A_NORMAL;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int /*<<< orphan*/);
void curutil_attrset_blink(WINDOW *win, unsigned char attr) {
  int fg = (attr & 0x70) >> 4;
  int bg = attr & 0x07;
  int cp = bg * 8 + 7 - fg;
  if (cp)
    wattrset(win, COLOR_PAIR(cp));
  else
    wattrset(win, A_NORMAL);
  wattron(win, A_BOLD);
  wattron(win, A_BLINK);
}


x86 assembly (clang, -O0):
<curutil_attrset_blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x70,%eax
sar    $0x4,%eax
mov    %eax,-0x10(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%eax
add    $0x7,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1192 <curutil_attrset_blink+0x62>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <COLOR_PAIR@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <wattrset@plt>
jmp    11a4 <curutil_attrset_blink+0x74>
mov    -0x8(%rbp),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
call   1030 <wattrset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
call   1050 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
call   1050 <wattron@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curutil_attrset_blink>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%eax
shr    $0x4,%eax
and    $0x7,%eax
and    $0x7,%esi
lea    0x7(,%rsi,8),%edi
sub    %eax,%edi
je     1153 <curutil_attrset_blink+0x23>
call   1040 <COLOR_PAIR@plt>
mov    %eax,%esi
jmp    115c <curutil_attrset_blink+0x2c>
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <wattrset@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <wattron@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <wattron@plt>

LLVM IR (-O0):
@A_NORMAL = global i32 0
@A_BOLD = global i32 0
@A_BLINK = global i32 0
define void @curutil_attrset_blink(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i8 %1, i8* %4
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = and i32 %9, 112
%11 = ashr i32 %10, 4
store i32 %11, i32* %5
%12 = load i8, i8* %4
%13 = zext i8 %12 to i32
%14 = and i32 %13, 7
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = mul nsw i32 %15, 8
%17 = add nsw i32 %16, 7
%18 = load i32, i32* %5
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i32*, i32** %3
%24 = load i32, i32* %7
%25 = call i32 @COLOR_PAIR(i32 %24)
%26 = call i32 @wattrset(i32* %23, i32 %25)
br label %31
27: ; preds = %2
%28 = load i32*, i32** %3
%29 = load i32, i32* @A_NORMAL
%30 = call i32 @wattrset(i32* %28, i32 %29)
br label %31
31: ; preds = %27, %22
%32 = load i32*, i32** %3
%33 = load i32, i32* @A_BOLD
%34 = call i32 @wattron(i32* %32, i32 %33)
%35 = load i32*, i32** %3
%36 = load i32, i32* @A_BLINK
%37 = call i32 @wattron(i32* %35, i32 %36)
ret void
}

LLVM IR (-O2):
@A_NORMAL = global i32 0
@A_BOLD = global i32 0
@A_BLINK = global i32 0
define void @curutil_attrset_blink(i32* %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = lshr i32 %3, 4
%5 = and i32 %4, 7
%6 = shl nuw nsw i32 %3, 3
%7 = and i32 %6, 56
%8 = or i32 %7, 7
%9 = sub nuw nsw i32 %8, %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = tail call i32 @COLOR_PAIR(i32 %9)
br label %15
13: ; preds = %2
%14 = load i32, i32* @A_NORMAL
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %14, %13 ], [ %12, %11 ]
%17 = tail call i32 @wattrset(i32* %0, i32 %16)
%18 = load i32, i32* @A_BOLD
%19 = tail call i32 @wattron(i32* %0, i32 %18)
%20 = load i32, i32* @A_BLINK
%21 = tail call i32 @wattron(i32* %0, i32 %20)
ret void
}