#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*/ printf(char *);
int /*<<< orphan*/ write_brightness_values(int, int);
void process_brightness_values(int value) {
  switch (value) {
  case 1:
    write_brightness_values(3, value);
    break;
  case 0:
    write_brightness_values(3, value);
    break;
  default:
    printf("Invalid value\n");
    printf("valid brightness values : 0,1\n");
  }
}


x86 assembly (clang, -O0):
<process_brightness_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1161 <process_brightness_values+0x41>
jmp    113e <process_brightness_values+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
jne    1173 <process_brightness_values+0x53>
jmp    114f <process_brightness_values+0x2f>
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1040 <write_brightness_values@plt>
jmp    118b <process_brightness_values+0x6b>
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1040 <write_brightness_values@plt>
jmp    118b <process_brightness_values+0x6b>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_brightness_values>:
test   %edi,%edi
je     1138 <process_brightness_values+0x18>
cmp    $0x1,%edi
jne    1144 <process_brightness_values+0x24>
mov    $0x3,%edi
mov    $0x1,%esi
jmp    1040 <write_brightness_values@plt>
mov    $0x3,%edi
xor    %esi,%esi
jmp    1040 <write_brightness_values@plt>
push   %rax
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Invalid value\0A\00"
@.str.1 = [31 x i8] c"valid brightness values : 0,1\0A\00"
define void @process_brightness_values(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 1, label %4
i32 0, label %7
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 @write_brightness_values(i32 3, i32 %5)
br label %13
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @write_brightness_values(i32 3, i32 %8)
br label %13
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %7, %4
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Invalid value\00"
@str.2 = [30 x i8] c"valid brightness values : 0,1\00"
define void @process_brightness_values(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 0, label %4
]
2: ; preds = %1
%3 = tail call i32 @write_brightness_values(i32 3, i32 1)
br label %9
4: ; preds = %1
%5 = tail call i32 @write_brightness_values(i32 3, i32 0)
br label %9
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
br label %9
9: ; preds = %6, %4, %2
ret void
}