#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*/ free(char *);
char *get_driver();
int /*<<< orphan*/ printf(char *, char *, int, int);
int read_backlight(char *);
int read_max_backlight(char *);
void show_blacklight() {
  char *driver = get_driver();
  if (driver == NULL) {
    return;
  }
  int max_value = read_max_backlight(driver);
  int actual = read_backlight(driver);
  printf("%s %d %d\n", driver, max_value, actual);
  free(driver);
}


x86 assembly (clang, -O0):
<show_blacklight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <get_driver@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1173 <show_blacklight+0x23>
jmp    11aa <show_blacklight+0x5a>
mov    -0x8(%rbp),%rdi
call   1070 <read_max_backlight@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <read_backlight@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_blacklight>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <get_driver@plt>
test   %rax,%rax
je     1195 <show_blacklight+0x45>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <read_max_backlight@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <read_backlight@plt>
lea    0xe85(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s %d %d\0A\00"
define void @show_blacklight() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
%4 = call i8* (...) @get_driver()
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
br label %19
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @read_max_backlight(i8* %9)
store i32 %10, i32* %2
%11 = load i8*, i8** %1
%12 = call i32 @read_backlight(i8* %11)
store i32 %12, i32* %3
%13 = load i8*, i8** %1
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i32 %15)
%17 = load i8*, i8** %1
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s %d %d\0A\00"
define void @show_blacklight() {
%1 = tail call i8* (...) @get_driver()
%2 = icmp eq i8* %1, null
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32 @read_max_backlight(i8* %1)
%5 = tail call i32 @read_backlight(i8* %1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %4, i32 %5)
%7 = tail call i32 @free(i8* %1)
br label %8
8: ; preds = %0, %3
ret void
}