#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*/ drv_generic_serial_write(char *, int);
int drv_BuE_CT_contrast(int contrast) {
  static char Contrast = 7;
  char cmd[4] = "\033"
                "LKn";
  if (contrast == -1)
    return Contrast;
  if (contrast < 0)
    contrast = 0;
  if (contrast > 15)
    contrast = 15;
  Contrast = contrast;
  cmd[3] = Contrast;
  drv_generic_serial_write(cmd, 4);
  return Contrast;
}


x86 assembly (clang, -O0):
<drv_BuE_CT_contrast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    113d <drv_BuE_CT_contrast+0x2d>
movsbl 0x2ef3(%rip),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <drv_BuE_CT_contrast+0x79>
cmpl   $0x0,-0x8(%rbp)
jge    114e <drv_BuE_CT_contrast+0x3e>
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jle    115f <drv_BuE_CT_contrast+0x4f>
movl   $0xf,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,0x2ec0(%rip)
mov    0x2eba(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
call   1030 <drv_generic_serial_write@plt>
movsbl 0x2ea2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_BuE_CT_contrast>:
push   %rax
movl   $0x6e4b4c1b,0x4(%rsp)
6e
cmp    $0xffffffff,%edi
je     1149 <drv_BuE_CT_contrast+0x39>
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
cmp    $0xf,%eax
mov    $0xf,%ecx
cmovb  %eax,%ecx
mov    %cl,0x2ef2(%rip)
mov    %cl,0x7(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <drv_generic_serial_write@plt>
movsbl 0x2ed8(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@drv_BuE_CT_contrast.Contrast = internal global i8 7
@__const.drv_BuE_CT_contrast.cmd = [4 x i8] c"\1BLKn"
define i32 @drv_BuE_CT_contrast(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x i8]
store i32 %0, i32* %3
%5 = bitcast [4 x i8]* %4 to i8*
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8, i8* @drv_BuE_CT_contrast.Contrast
%10 = sext i8 %9 to i32
store i32 %10, i32* %2
br label %28
11: ; preds = %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %3
br label %15
15: ; preds = %14, %11
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 15
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 15, i32* %3
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %3
%21 = trunc i32 %20 to i8
store i8 %21, i8* @drv_BuE_CT_contrast.Contrast
%22 = load i8, i8* @drv_BuE_CT_contrast.Contrast
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 %22, i8* %23
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%25 = call i32 @drv_generic_serial_write(i8* %24, i32 4)
%26 = load i8, i8* @drv_BuE_CT_contrast.Contrast
%27 = sext i8 %26 to i32
store i32 %27, i32* %2
br label %28
28: ; preds = %19, %8
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@drv_BuE_CT_contrast.Contrast = internal unnamed_addr global i8 7
define i32 @drv_BuE_CT_contrast(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1850428443, i32* %2
%4 = icmp eq i32 %0, -1
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = bitcast i32* %2 to [4 x i8]*
%7 = icmp sgt i32 %0, 0
%8 = select i1 %7, i32 %0, i32 0
%9 = icmp ult i32 %8, 15
%10 = select i1 %9, i32 %8, i32 15
%11 = trunc i32 %10 to i8
store i8 %11, i8* @drv_BuE_CT_contrast.Contrast
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 3
store i8 %11, i8* %12
%13 = call i32 @drv_generic_serial_write(i8* %3, i32 4)
br label %14
14: ; preds = %1, %5
%15 = load i8, i8* @drv_BuE_CT_contrast.Contrast
%16 = sext i8 %15 to i32
ret i32 %16
}