#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*/ logprintf(char *);
int /*<<< orphan*/ qfprintf(char *, char *, int);
void set_brightness(int bright) {
  if (bright < 4) {
    logprintf("1can't set brightness < 4");
    return;
  }
  if (bright > 255) {
    logprintf("1can't set brightness > 255");
    return;
  }
  qfprintf("/sys/class/leds/lcd-backlight/brightness", "%d", bright);
}


x86 assembly (clang, -O0):
<set_brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1146 <set_brightness+0x26>
lea    0xec4(%rip),%rdi
call   1040 <logprintf@plt>
jmp    117a <set_brightness+0x5a>
cmpl   $0xff,-0x4(%rbp)
jle    1164 <set_brightness+0x44>
lea    0xec0(%rip),%rdi
call   1040 <logprintf@plt>
jmp    117a <set_brightness+0x5a>
mov    -0x4(%rbp),%edx
lea    0xec8(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1030 <qfprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_brightness>:
cmp    $0x3,%edi
jg     1131 <set_brightness+0x11>
lea    0xed4(%rip),%rdi
jmp    1040 <logprintf@plt>
mov    %edi,%edx
cmp    $0x100,%edi
jb     1147 <set_brightness+0x27>
lea    0xed8(%rip),%rdi
jmp    1040 <logprintf@plt>
lea    0xee8(%rip),%rdi
lea    0xf0a(%rip),%rsi
jmp    1030 <qfprintf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"1can't set brightness < 4\00"
@.str.1 = [28 x i8] c"1can't set brightness > 255\00"
@.str.2 = [41 x i8] c"/sys/class/leds/lcd-backlight/brightness\00"
@.str.3 = [3 x i8] c"%d\00"
define void @set_brightness(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 4
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @logprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 255
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @logprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %7
%13 = load i32, i32* %2
%14 = call i32 @qfprintf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %10, %5
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"1can't set brightness < 4\00"
@.str.1 = [28 x i8] c"1can't set brightness > 255\00"
@.str.2 = [41 x i8] c"/sys/class/leds/lcd-backlight/brightness\00"
@.str.3 = [3 x i8] c"%d\00"
define void @set_brightness(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @logprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %11
5: ; preds = %1
%6 = icmp ugt i32 %0, 255
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @logprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %11
9: ; preds = %5
%10 = tail call i32 @qfprintf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %11
11: ; preds = %9, %7, %3
ret void
}