#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ IOwrite_to_blue_LED_off();
int /*<<< orphan*/ IOwrite_to_blue_LED_on();
int /*<<< orphan*/ IOwrite_to_green_LED_off();
int /*<<< orphan*/ IOwrite_to_green_LED_on();
int /*<<< orphan*/ IOwrite_to_red_LED_off();
int /*<<< orphan*/ IOwrite_to_red_LED_on();
void IOwrite_to_red_green_blue_LED(uint8_t rgb) {
  if (rgb & 0x4) {
    IOwrite_to_red_LED_on();
  } else {
    IOwrite_to_red_LED_off();
  }
  if (rgb & 0x2) {
    IOwrite_to_green_LED_on();
  } else {
    IOwrite_to_green_LED_off();
  }
  if (rgb & 0x1) {
    IOwrite_to_blue_LED_on();
  } else {
    IOwrite_to_blue_LED_off();
  }
}


x86 assembly (clang, -O0):
<IOwrite_to_red_green_blue_LED>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1186 <IOwrite_to_red_green_blue_LED+0x26>
mov    $0x0,%al
call   1060 <IOwrite_to_red_LED_on@plt>
jmp    118d <IOwrite_to_red_green_blue_LED+0x2d>
mov    $0x0,%al
call   1050 <IOwrite_to_red_LED_off@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11a8 <IOwrite_to_red_green_blue_LED+0x48>
mov    $0x0,%al
call   1030 <IOwrite_to_green_LED_on@plt>
jmp    11af <IOwrite_to_red_green_blue_LED+0x4f>
mov    $0x0,%al
call   1040 <IOwrite_to_green_LED_off@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11ca <IOwrite_to_red_green_blue_LED+0x6a>
mov    $0x0,%al
call   1070 <IOwrite_to_blue_LED_on@plt>
jmp    11d1 <IOwrite_to_red_green_blue_LED+0x71>
mov    $0x0,%al
call   1080 <IOwrite_to_blue_LED_off@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IOwrite_to_red_green_blue_LED>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
test   $0x4,%bl
jne    1171 <IOwrite_to_red_green_blue_LED+0x11>
call   1050 <IOwrite_to_red_LED_off@plt>
jmp    1176 <IOwrite_to_red_green_blue_LED+0x16>
call   1060 <IOwrite_to_red_LED_on@plt>
xor    %eax,%eax
test   $0x2,%bl
jne    1184 <IOwrite_to_red_green_blue_LED+0x24>
call   1040 <IOwrite_to_green_LED_off@plt>
jmp    1189 <IOwrite_to_red_green_blue_LED+0x29>
call   1030 <IOwrite_to_green_LED_on@plt>
xor    %eax,%eax
test   $0x1,%bl
jne    1196 <IOwrite_to_red_green_blue_LED+0x36>
pop    %rbx
jmp    1080 <IOwrite_to_blue_LED_off@plt>
pop    %rbx
jmp    1070 <IOwrite_to_blue_LED_on@plt>

LLVM IR (-O0):
define void @IOwrite_to_red_green_blue_LED(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 4
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @IOwrite_to_red_LED_on()
br label %10
8: ; preds = %1
%9 = call i32 (...) @IOwrite_to_red_LED_off()
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
%12 = and i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @IOwrite_to_green_LED_on()
br label %18
16: ; preds = %10
%17 = call i32 (...) @IOwrite_to_green_LED_off()
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %2
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (...) @IOwrite_to_blue_LED_on()
br label %26
24: ; preds = %18
%25 = call i32 (...) @IOwrite_to_blue_LED_off()
br label %26
26: ; preds = %24, %22
ret void
}

LLVM IR (-O2):
define void @IOwrite_to_red_green_blue_LED(i32 %0) {
%2 = and i32 %0, 4
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @IOwrite_to_red_LED_on()
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @IOwrite_to_red_LED_off()
br label %8
8: ; preds = %6, %4
%9 = and i32 %0, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (...) @IOwrite_to_green_LED_on()
br label %15
13: ; preds = %8
%14 = tail call i32 (...) @IOwrite_to_green_LED_off()
br label %15
15: ; preds = %13, %11
%16 = and i32 %0, 1
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @IOwrite_to_blue_LED_on()
br label %22
20: ; preds = %15
%21 = tail call i32 (...) @IOwrite_to_blue_LED_off()
br label %22
22: ; preds = %20, %18
ret void
}