#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 lang;

/* Variables and functions */
int /*<<< orphan*/ SendChar(int);
void SetLanguage(unsigned char ui_lang, unsigned char sys_lang) {
  unsigned char lang = ui_lang;
  if (sys_lang)
    lang |= 0x80;
  SendChar((0XEE) & 0xFF);
  SendChar((0xC1) & 0xFF);
  SendChar((lang)&0xFF);
  SendChar((0xC1 + lang) & 0xFF);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}


x86 assembly (clang, -O0):
<SetLanguage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     1140 <SetLanguage+0x30>
movzbl -0x3(%rbp),%eax
or     $0x80,%eax
mov    %al,-0x3(%rbp)
mov    $0xee,%edi
call   1030 <SendChar@plt>
mov    $0xc1,%edi
call   1030 <SendChar@plt>
movzbl -0x3(%rbp),%edi
and    $0xff,%edi
call   1030 <SendChar@plt>
movzbl -0x3(%rbp),%edi
add    $0xc1,%edi
and    $0xff,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
call   1030 <SendChar@plt>
mov    $0xfc,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
call   1030 <SendChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetLanguage>:
push   %rbx
mov    %edi,%eax
or     $0x80,%al
test   %esi,%esi
movzbl %al,%ebx
cmove  %edi,%ebx
mov    $0xee,%edi
call   1030 <SendChar@plt>
mov    $0xc1,%edi
call   1030 <SendChar@plt>
movzbl %bl,%ebx
mov    %ebx,%edi
call   1030 <SendChar@plt>
add    $0xc1,%ebx
movzbl %bl,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
call   1030 <SendChar@plt>
mov    $0xfc,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
call   1030 <SendChar@plt>
mov    $0xff,%edi
pop    %rbx
jmp    1030 <SendChar@plt>

LLVM IR (-O0):
define void @SetLanguage(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
store i8 %6, i8* %5
%7 = load i8, i8* %4
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = or i32 %11, 128
%13 = trunc i32 %12 to i8
store i8 %13, i8* %5
br label %14
14: ; preds = %9, %2
%15 = call i32 @SendChar(i32 238)
%16 = call i32 @SendChar(i32 193)
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = and i32 %18, 255
%20 = call i32 @SendChar(i32 %19)
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = add nsw i32 193, %22
%24 = and i32 %23, 255
%25 = call i32 @SendChar(i32 %24)
%26 = call i32 @SendChar(i32 255)
%27 = call i32 @SendChar(i32 252)
%28 = call i32 @SendChar(i32 255)
%29 = call i32 @SendChar(i32 255)
ret void
}

LLVM IR (-O2):
define void @SetLanguage(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp eq i8 %1, 0
%4 = or i8 %0, -128
%5 = select i1 %3, i8 %0, i8 %4
%6 = tail call i32 @SendChar(i32 238)
%7 = tail call i32 @SendChar(i32 193)
%8 = zext i8 %5 to i32
%9 = tail call i32 @SendChar(i32 %8)
%10 = add nuw nsw i32 %8, 193
%11 = and i32 %10, 255
%12 = tail call i32 @SendChar(i32 %11)
%13 = tail call i32 @SendChar(i32 255)
%14 = tail call i32 @SendChar(i32 252)
%15 = tail call i32 @SendChar(i32 255)
%16 = tail call i32 @SendChar(i32 255)
ret void
}