#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_backlight(int backlight) {
  static char Backlight = 0;
  char cmd[4] = "\033"
                "LBn";
  if (backlight == -1)
    return Backlight;
  if (backlight < 0)
    backlight = 0;
  if (backlight > 1)
    backlight = 1;
  Backlight = backlight;
  cmd[3] = Backlight;
  drv_generic_serial_write(cmd, 4);
  return Backlight;
}


x86 assembly (clang, -O0):
<drv_BuE_CT_backlight>:
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_backlight+0x2d>
movsbl 0x2ef4(%rip),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <drv_BuE_CT_backlight+0x79>
cmpl   $0x0,-0x8(%rbp)
jge    114e <drv_BuE_CT_backlight+0x3e>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    115f <drv_BuE_CT_backlight+0x4f>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,0x2ec1(%rip)
mov    0x2ebb(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
call   1030 <drv_generic_serial_write@plt>
movsbl 0x2ea3(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_BuE_CT_backlight>:
push   %rax
movl   $0x6e424c1b,0x4(%rsp)
6e
cmp    $0xffffffff,%edi
je     1148 <drv_BuE_CT_backlight+0x38>
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
test   %eax,%eax
mov    $0x1,%ecx
cmove  %eax,%ecx
mov    %cl,0x2ef4(%rip)
mov    %cl,0x7(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <drv_generic_serial_write@plt>
movsbl 0x2eda(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@drv_BuE_CT_backlight.Backlight = internal global i8 0
@__const.drv_BuE_CT_backlight.cmd = [4 x i8] c"\1BLBn"
define i32 @drv_BuE_CT_backlight(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_backlight.Backlight
%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, 1
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 1, 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_backlight.Backlight
%22 = load i8, i8* @drv_BuE_CT_backlight.Backlight
%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_backlight.Backlight
%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_backlight.Backlight = internal unnamed_addr global i8 0
define i32 @drv_BuE_CT_backlight(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1849838619, 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, 1
%10 = select i1 %9, i32 %8, i32 1
%11 = trunc i32 %10 to i8
store i8 %11, i8* @drv_BuE_CT_backlight.Backlight
%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_backlight.Backlight
%16 = sext i8 %15 to i32
ret i32 %16
}