#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*/ led_clear();
int /*<<< orphan*/ led_set_blink(int);
int /*<<< orphan*/ update_time(unsigned char);
void enter_time(unsigned char what) {
  led_clear();
  switch (what) {
  case 3:
  case 0:
    led_set_blink(5);
    led_set_blink(4);
    break;
  case 4:
  case 1:
    led_set_blink(3);
    led_set_blink(2);
    break;
  case 5:
  case 2:
    led_set_blink(1);
    led_set_blink(0);
    break;
  }
  update_time(what);
}


x86 assembly (clang, -O0):
<enter_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %eax,%eax
call   1040 <led_clear@plt>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     11ae <enter_time+0x7e>
jmp    1159 <enter_time+0x29>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     11c7 <enter_time+0x97>
jmp    116a <enter_time+0x3a>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11e0 <enter_time+0xb0>
jmp    117b <enter_time+0x4b>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11ae <enter_time+0x7e>
jmp    118c <enter_time+0x5c>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
je     11c7 <enter_time+0x97>
jmp    119d <enter_time+0x6d>
mov    -0x8(%rbp),%eax
sub    $0x5,%eax
je     11e0 <enter_time+0xb0>
jmp    11f1 <enter_time+0xc1>
mov    $0x5,%edi
call   1050 <led_set_blink@plt>
mov    $0x4,%edi
call   1050 <led_set_blink@plt>
jmp    11f1 <enter_time+0xc1>
mov    $0x3,%edi
call   1050 <led_set_blink@plt>
mov    $0x2,%edi
call   1050 <led_set_blink@plt>
jmp    11f1 <enter_time+0xc1>
mov    $0x1,%edi
call   1050 <led_set_blink@plt>
xor    %edi,%edi
call   1050 <led_set_blink@plt>
movzbl -0x1(%rbp),%edi
call   1030 <update_time@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enter_time>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <led_clear@plt>
cmp    $0x5,%bl
ja     1165 <enter_time+0x35>
movsbq %bl,%rax
lea    0xeb4(%rip),%rcx
mov    (%rcx,%rax,4),%edi
lea    0xec2(%rip),%rcx
mov    (%rcx,%rax,4),%ebp
call   1050 <led_set_blink@plt>
mov    %ebp,%edi
call   1050 <led_set_blink@plt>
movzbl %bl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <update_time@plt>

LLVM IR (-O0):
define void @enter_time(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @led_clear()
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %15 [
i32 3, label %6
i32 0, label %6
i32 4, label %9
i32 1, label %9
i32 5, label %12
i32 2, label %12
]
6: ; preds = %1, %1
%7 = call i32 @led_set_blink(i32 5)
%8 = call i32 @led_set_blink(i32 4)
br label %15
9: ; preds = %1, %1
%10 = call i32 @led_set_blink(i32 3)
%11 = call i32 @led_set_blink(i32 2)
br label %15
12: ; preds = %1, %1
%13 = call i32 @led_set_blink(i32 1)
%14 = call i32 @led_set_blink(i32 0)
br label %15
15: ; preds = %1, %12, %9, %6
%16 = load i8, i8* %2
%17 = call i32 @update_time(i8 zeroext %16)
ret void
}

LLVM IR (-O2):
@switch.table.enter_time = [6 x i32] [i32 5, i32 3, i32 1, i32 5, i32 3, i32 1]
@switch.table.enter_time.1 = [6 x i32] [i32 4, i32 2, i32 0, i32 4, i32 2, i32 0]
define void @enter_time(i8 zeroext %0) {
%2 = tail call i32 (...) @led_clear()
%3 = icmp ult i8 %0, 6
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = sext i8 %0 to i64
%6 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.enter_time, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = sext i8 %0 to i64
%9 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.enter_time.1, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @led_set_blink(i32 %7)
%12 = tail call i32 @led_set_blink(i32 %10)
br label %13
13: ; preds = %1, %4
%14 = tail call i32 @update_time(i8 zeroext %0)
ret void
}