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

/* Variables and functions */
int write(int, unsigned char *, int);
int send_clear_statusflags(unsigned char hcode, unsigned int bitmap) {
  extern int sptty;
  int ignoret;
  static unsigned char template[9] = {0xff, 0xff, 0xff, 5, 0x7b, 18, 0, 0, 0};
  template[6] = hcode;
  template[7] = (bitmap & 0xff00) >> 8;
  template[8] = bitmap & 0xff;
  ignoret = write(sptty, template, sizeof(template));
  return 0;
}


x86 assembly (clang, -O0):
<send_clear_statusflags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x1(%rbp),%al
mov    %al,0x2f04(%rip)
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
shr    $0x8,%eax
mov    %al,0x2ef4(%rip)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,0x2ee7(%rip)
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0x2ecf(%rip),%rsi
mov    $0x9,%edx
call   1030 <write@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_clear_statusflags>:
push   %rax
mov    %esi,%eax
mov    %dil,0x2f14(%rip)
lea    0x2f07(%rip),%rsi
mov    %ah,0x2f08(%rip)
mov    %al,0x2f03(%rip)
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    $0x9,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@send_clear_statusflags.template = internal global [9 x i8] c"\FF\FF\FF\05{\12\00\00\00"
@sptty = external global i32
define i32 @send_clear_statusflags(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%6 = load i8, i8* %3
store i8 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 6)
%7 = load i32, i32* %4
%8 = and i32 %7, 65280
%9 = lshr i32 %8, 8
%10 = trunc i32 %9 to i8
store i8 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 7)
%11 = load i32, i32* %4
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
store i8 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 8)
%14 = load i32, i32* @sptty
%15 = call i32 @write(i32 %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 0), i32 9)
store i32 %15, i32* %5
ret i32 0
}

LLVM IR (-O2):
@send_clear_statusflags.template = internal global [9 x i8] c"\FF\FF\FF\05{\12\00\00\00"
@sptty = external global i32
define i32 @send_clear_statusflags(i8 zeroext %0, i32 %1) {
store i8 %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 6)
%3 = lshr i32 %1, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 7)
%5 = trunc i32 %1 to i8
store i8 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 8)
%6 = load i32, i32* @sptty
%7 = tail call i32 @write(i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @send_clear_statusflags.template, i64 0, i64 0), i32 9)
ret i32 0
}