#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*/ beeper_get_beep_enable();
int /*<<< orphan*/ led_clear();
int /*<<< orphan*/ led_get_auto_light_enable();
int /*<<< orphan*/ led_set_code(int, float);
int power_get_powersave_to_s();
int /*<<< orphan*/ remote_get_enable();
int /*<<< orphan*/ rom_read(int);
void display_global_flag(unsigned char what) {
  led_clear();
  ;
  switch (what) {
  case 17:
    led_set_code(5, 'P');
    led_set_code(4, 'S');
    if (power_get_powersave_to_s() == 0) {
      led_set_code(2, 'O');
      led_set_code(1, 'F');
      led_set_code(0, 'F');
    } else {
      led_set_code(1, (power_get_powersave_to_s() / 10) + 0x30);
      led_set_code(0, (power_get_powersave_to_s() % 10) + 0x30);
    }
    break;
  case 37:
    led_set_code(5, 'A');
    led_set_code(4, 'U');
    led_set_code(3, 'L');
    if (led_get_auto_light_enable()) {
      led_set_code(2, 0xFF);
      led_set_code(1, 'O');
      led_set_code(0, 'N');
    } else {
      led_set_code(2, 'O');
      led_set_code(1, 'F');
      led_set_code(0, 'F');
    }
    break;
  case 19:
    led_set_code(5, 'B');
    led_set_code(4, 'E');
    led_set_code(3, 'P');
    if (beeper_get_beep_enable()) {
      led_set_code(2, 0xFF);
      led_set_code(1, 'O');
      led_set_code(0, 'N');
    } else {
      led_set_code(2, 'O');
      led_set_code(1, 'F');
      led_set_code(0, 'F');
    }
    break;
  case 20:
    led_set_code(5, 'D');
    led_set_code(4, 'S');
    led_set_code(3, 'P');
    if (!rom_read(10)) {
      led_set_code(1, '2');
      led_set_code(0, '4');
    } else {
      led_set_code(1, '1');
      led_set_code(0, '2');
    }
    break;
  case 15:
    led_set_code(5, 'R');
    led_set_code(4, 'A');
    led_set_code(3, 0xFF);
    if (remote_get_enable()) {
      led_set_code(2, 0xFF);
      led_set_code(1, 'O');
      led_set_code(0, 'N');
    } else {
      led_set_code(2, 'O');
      led_set_code(1, 'F');
      led_set_code(0, 'F');
    }
    break;
  }
}


x86 assembly (clang, -O0):
<display_global_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %eax,%eax
call   1030 <led_clear@plt>
movzbl -0x1(%rbp),%eax
add    $0xfffffff1,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x16,%eax
ja     1514 <display_global_flag+0x3a4>
mov    -0x10(%rbp),%rax
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x5,%edi
movss  0xe5c(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x4,%edi
movss  0xe4e(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x0,%al
call   1070 <power_get_powersave_to_s@plt>
cmp    $0x0,%eax
jne    121b <display_global_flag+0xab>
mov    $0x2,%edi
movss  0xe20(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xe0a(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xdfb(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1258 <display_global_flag+0xe8>
mov    $0x0,%al
call   1070 <power_get_powersave_to_s@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
cvtsi2ss %eax,%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
mov    $0x0,%al
call   1070 <power_get_powersave_to_s@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
cvtsi2ss %edx,%xmm0
xor    %edi,%edi
call   1050 <led_set_code@plt>
jmp    1514 <display_global_flag+0x3a4>
mov    $0x5,%edi
movss  0xd9a(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x4,%edi
movss  0xdc0(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x3,%edi
movss  0xdaa(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x0,%al
call   1090 <led_get_auto_light_enable@plt>
cmp    $0x0,%eax
je     12db <display_global_flag+0x16b>
mov    $0x2,%edi
movss  0xd50(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xd4e(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xd43(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    130e <display_global_flag+0x19e>
mov    $0x2,%edi
movss  0xd28(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xd12(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xd03(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1514 <display_global_flag+0x3a4>
mov    $0x5,%edi
movss  0xd14(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x4,%edi
movss  0xcfe(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x3,%edi
movss  0xcd4(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x0,%al
call   1060 <beeper_get_beep_enable@plt>
cmp    $0x0,%eax
je     1391 <display_global_flag+0x221>
mov    $0x2,%edi
movss  0xc9a(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xc98(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xc8d(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    13c4 <display_global_flag+0x254>
mov    $0x2,%edi
movss  0xc72(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xc5c(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xc4d(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1514 <display_global_flag+0x3a4>
mov    $0x5,%edi
movss  0xc4a(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x4,%edi
movss  0xc34(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x3,%edi
movss  0xc1e(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0xa,%edi
call   1080 <rom_read@plt>
cmp    $0x0,%eax
jne    1438 <display_global_flag+0x2c8>
mov    $0x1,%edi
movss  0xc09(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xbf6(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1459 <display_global_flag+0x2e9>
mov    $0x1,%edi
movss  0xbe7(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xbd4(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1514 <display_global_flag+0x3a4>
mov    $0x5,%edi
movss  0xb9d(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x4,%edi
movss  0xb87(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x3,%edi
movss  0xb71(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x0,%al
call   1040 <remote_get_enable@plt>
cmp    $0x0,%eax
je     14dc <display_global_flag+0x36c>
mov    $0x2,%edi
movss  0xb4f(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xb4d(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xb42(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    150f <display_global_flag+0x39f>
mov    $0x2,%edi
movss  0xb27(%rip),%xmm0
call   1050 <led_set_code@plt>
mov    $0x1,%edi
movss  0xb11(%rip),%xmm0
call   1050 <led_set_code@plt>
xor    %edi,%edi
movss  0xb02(%rip),%xmm0
call   1050 <led_set_code@plt>
jmp    1514 <display_global_flag+0x3a4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_global_flag>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <led_clear@plt>
add    $0xf1,%bl
cmp    $0x16,%bl
ja     11df <display_global_flag+0x6f>
movzbl %bl,%eax
lea    0xeb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xe63(%rip),%xmm0
mov    $0x5,%edi
call   1050 <led_set_code@plt>
movss  0xe55(%rip),%xmm0
mov    $0x4,%edi
call   1050 <led_set_code@plt>
movss  0xe47(%rip),%xmm0
mov    $0x3,%edi
call   1050 <led_set_code@plt>
xor    %eax,%eax
call   1040 <remote_get_enable@plt>
test   %eax,%eax
jne    12bf <display_global_flag+0x14f>
jmp    1399 <display_global_flag+0x229>
pop    %rbx
ret
movss  0xe37(%rip),%xmm0
mov    $0x5,%edi
call   1050 <led_set_code@plt>
movss  0xe21(%rip),%xmm0
mov    $0x4,%edi
call   1050 <led_set_code@plt>
xor    %eax,%eax
call   1070 <power_get_powersave_to_s@plt>
test   %eax,%eax
je     1399 <display_global_flag+0x229>
xor    %eax,%eax
call   1070 <power_get_powersave_to_s@plt>
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x22,%rcx
shr    $0x3f,%rax
add    %ecx,%eax
add    $0x30,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
xor    %eax,%eax
call   1070 <power_get_powersave_to_s@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x30,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
jmp    13c5 <display_global_flag+0x255>
movss  0xdae(%rip),%xmm0
mov    $0x5,%edi
call   1050 <led_set_code@plt>
movss  0xda0(%rip),%xmm0
mov    $0x4,%edi
call   1050 <led_set_code@plt>
movss  0xd7a(%rip),%xmm0
mov    $0x3,%edi
call   1050 <led_set_code@plt>
xor    %eax,%eax
call   1060 <beeper_get_beep_enable@plt>
test   %eax,%eax
je     1399 <display_global_flag+0x229>
movss  0xd41(%rip),%xmm0
mov    $0x2,%edi
call   1050 <led_set_code@plt>
movss  0xd33(%rip),%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
movss  0xd25(%rip),%xmm0
jmp    13c5 <display_global_flag+0x255>
movss  0xd20(%rip),%xmm0
mov    $0x5,%edi
call   1050 <led_set_code@plt>
movss  0xd12(%rip),%xmm0
mov    $0x4,%edi
call   1050 <led_set_code@plt>
movss  0xd04(%rip),%xmm0
mov    $0x3,%edi
call   1050 <led_set_code@plt>
mov    $0xa,%edi
call   1080 <rom_read@plt>
test   %eax,%eax
je     13cd <display_global_flag+0x25d>
movss  0xce4(%rip),%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
movss  0xcd6(%rip),%xmm0
jmp    13c5 <display_global_flag+0x255>
movss  0xca8(%rip),%xmm0
mov    $0x5,%edi
call   1050 <led_set_code@plt>
movss  0xcca(%rip),%xmm0
mov    $0x4,%edi
call   1050 <led_set_code@plt>
movss  0xcbc(%rip),%xmm0
mov    $0x3,%edi
call   1050 <led_set_code@plt>
xor    %eax,%eax
call   1090 <led_get_auto_light_enable@plt>
test   %eax,%eax
jne    12bf <display_global_flag+0x14f>
movss  0xc6b(%rip),%xmm0
mov    $0x2,%edi
call   1050 <led_set_code@plt>
movss  0xc61(%rip),%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
movss  0xc4f(%rip),%xmm0
xor    %edi,%edi
pop    %rbx
jmp    1050 <led_set_code@plt>
movss  0xc53(%rip),%xmm0
mov    $0x1,%edi
call   1050 <led_set_code@plt>
movss  0xc45(%rip),%xmm0
jmp    13c5 <display_global_flag+0x255>

LLVM IR (-O0):
define void @display_global_flag(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 %85 [
i32 17, label %6
i32 37, label %27
i32 19, label %42
i32 20, label %57
i32 15, label %70
]
6: ; preds = %1
%7 = call i32 @led_set_code(i32 5, float 8.000000e+01)
%8 = call i32 @led_set_code(i32 4, float 8.300000e+01)
%9 = call i32 (...) @power_get_powersave_to_s()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = call i32 @led_set_code(i32 2, float 7.900000e+01)
%13 = call i32 @led_set_code(i32 1, float 7.000000e+01)
%14 = call i32 @led_set_code(i32 0, float 7.000000e+01)
br label %26
15: ; preds = %6
%16 = call i32 (...) @power_get_powersave_to_s()
%17 = sdiv i32 %16, 10
%18 = add nsw i32 %17, 48
%19 = sitofp i32 %18 to float
%20 = call i32 @led_set_code(i32 1, float %19)
%21 = call i32 (...) @power_get_powersave_to_s()
%22 = srem i32 %21, 10
%23 = add nsw i32 %22, 48
%24 = sitofp i32 %23 to float
%25 = call i32 @led_set_code(i32 0, float %24)
br label %26
26: ; preds = %15, %11
br label %85
27: ; preds = %1
%28 = call i32 @led_set_code(i32 5, float 6.500000e+01)
%29 = call i32 @led_set_code(i32 4, float 8.500000e+01)
%30 = call i32 @led_set_code(i32 3, float 7.600000e+01)
%31 = call i32 (...) @led_get_auto_light_enable()
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %27
%34 = call i32 @led_set_code(i32 2, float 2.550000e+02)
%35 = call i32 @led_set_code(i32 1, float 7.900000e+01)
%36 = call i32 @led_set_code(i32 0, float 7.800000e+01)
br label %41
37: ; preds = %27
%38 = call i32 @led_set_code(i32 2, float 7.900000e+01)
%39 = call i32 @led_set_code(i32 1, float 7.000000e+01)
%40 = call i32 @led_set_code(i32 0, float 7.000000e+01)
br label %41
41: ; preds = %37, %33
br label %85
42: ; preds = %1
%43 = call i32 @led_set_code(i32 5, float 6.600000e+01)
%44 = call i32 @led_set_code(i32 4, float 6.900000e+01)
%45 = call i32 @led_set_code(i32 3, float 8.000000e+01)
%46 = call i32 (...) @beeper_get_beep_enable()
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %42
%49 = call i32 @led_set_code(i32 2, float 2.550000e+02)
%50 = call i32 @led_set_code(i32 1, float 7.900000e+01)
%51 = call i32 @led_set_code(i32 0, float 7.800000e+01)
br label %56
52: ; preds = %42
%53 = call i32 @led_set_code(i32 2, float 7.900000e+01)
%54 = call i32 @led_set_code(i32 1, float 7.000000e+01)
%55 = call i32 @led_set_code(i32 0, float 7.000000e+01)
br label %56
56: ; preds = %52, %48
br label %85
57: ; preds = %1
%58 = call i32 @led_set_code(i32 5, float 6.800000e+01)
%59 = call i32 @led_set_code(i32 4, float 8.300000e+01)
%60 = call i32 @led_set_code(i32 3, float 8.000000e+01)
%61 = call i32 @rom_read(i32 10)
%62 = icmp ne i32 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %57
%64 = call i32 @led_set_code(i32 1, float 5.000000e+01)
%65 = call i32 @led_set_code(i32 0, float 5.200000e+01)
br label %69
66: ; preds = %57
%67 = call i32 @led_set_code(i32 1, float 4.900000e+01)
%68 = call i32 @led_set_code(i32 0, float 5.000000e+01)
br label %69
69: ; preds = %66, %63
br label %85
70: ; preds = %1
%71 = call i32 @led_set_code(i32 5, float 8.200000e+01)
%72 = call i32 @led_set_code(i32 4, float 6.500000e+01)
%73 = call i32 @led_set_code(i32 3, float 2.550000e+02)
%74 = call i32 (...) @remote_get_enable()
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %70
%77 = call i32 @led_set_code(i32 2, float 2.550000e+02)
%78 = call i32 @led_set_code(i32 1, float 7.900000e+01)
%79 = call i32 @led_set_code(i32 0, float 7.800000e+01)
br label %84
80: ; preds = %70
%81 = call i32 @led_set_code(i32 2, float 7.900000e+01)
%82 = call i32 @led_set_code(i32 1, float 7.000000e+01)
%83 = call i32 @led_set_code(i32 0, float 7.000000e+01)
br label %84
84: ; preds = %80, %76
br label %85
85: ; preds = %1, %84, %69, %56, %41, %26
ret void
}

LLVM IR (-O2):
define void @display_global_flag(i8 zeroext %0) {
%2 = tail call i32 (...) @led_clear()
switch i8 %0, label %70 [
i8 17, label %3
i8 37, label %21
i8 19, label %33
i8 20, label %45
i8 15, label %55
]
3: ; preds = %1
%4 = tail call i32 @led_set_code(i32 5, float 8.000000e+01)
%5 = tail call i32 @led_set_code(i32 4, float 8.300000e+01)
%6 = tail call i32 (...) @power_get_powersave_to_s()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = tail call i32 @led_set_code(i32 2, float 7.900000e+01)
%10 = tail call i32 @led_set_code(i32 1, float 7.000000e+01)
br label %67
11: ; preds = %3
%12 = tail call i32 (...) @power_get_powersave_to_s()
%13 = sdiv i32 %12, 10
%14 = add nsw i32 %13, 48
%15 = sitofp i32 %14 to float
%16 = tail call i32 @led_set_code(i32 1, float %15)
%17 = tail call i32 (...) @power_get_powersave_to_s()
%18 = srem i32 %17, 10
%19 = add nsw i32 %18, 48
%20 = sitofp i32 %19 to float
br label %67
21: ; preds = %1
%22 = tail call i32 @led_set_code(i32 5, float 6.500000e+01)
%23 = tail call i32 @led_set_code(i32 4, float 8.500000e+01)
%24 = tail call i32 @led_set_code(i32 3, float 7.600000e+01)
%25 = tail call i32 (...) @led_get_auto_light_enable()
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %21
%28 = tail call i32 @led_set_code(i32 2, float 2.550000e+02)
%29 = tail call i32 @led_set_code(i32 1, float 7.900000e+01)
br label %67
30: ; preds = %21
%31 = tail call i32 @led_set_code(i32 2, float 7.900000e+01)
%32 = tail call i32 @led_set_code(i32 1, float 7.000000e+01)
br label %67
33: ; preds = %1
%34 = tail call i32 @led_set_code(i32 5, float 6.600000e+01)
%35 = tail call i32 @led_set_code(i32 4, float 6.900000e+01)
%36 = tail call i32 @led_set_code(i32 3, float 8.000000e+01)
%37 = tail call i32 (...) @beeper_get_beep_enable()
%38 = icmp eq i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %33
%40 = tail call i32 @led_set_code(i32 2, float 2.550000e+02)
%41 = tail call i32 @led_set_code(i32 1, float 7.900000e+01)
br label %67
42: ; preds = %33
%43 = tail call i32 @led_set_code(i32 2, float 7.900000e+01)
%44 = tail call i32 @led_set_code(i32 1, float 7.000000e+01)
br label %67
45: ; preds = %1
%46 = tail call i32 @led_set_code(i32 5, float 6.800000e+01)
%47 = tail call i32 @led_set_code(i32 4, float 8.300000e+01)
%48 = tail call i32 @led_set_code(i32 3, float 8.000000e+01)
%49 = tail call i32 @rom_read(i32 10)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = tail call i32 @led_set_code(i32 1, float 5.000000e+01)
br label %67
53: ; preds = %45
%54 = tail call i32 @led_set_code(i32 1, float 4.900000e+01)
br label %67
55: ; preds = %1
%56 = tail call i32 @led_set_code(i32 5, float 8.200000e+01)
%57 = tail call i32 @led_set_code(i32 4, float 6.500000e+01)
%58 = tail call i32 @led_set_code(i32 3, float 2.550000e+02)
%59 = tail call i32 (...) @remote_get_enable()
%60 = icmp eq i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %55
%62 = tail call i32 @led_set_code(i32 2, float 2.550000e+02)
%63 = tail call i32 @led_set_code(i32 1, float 7.900000e+01)
br label %67
64: ; preds = %55
%65 = tail call i32 @led_set_code(i32 2, float 7.900000e+01)
%66 = tail call i32 @led_set_code(i32 1, float 7.000000e+01)
br label %67
67: ; preds = %11, %8, %30, %27, %42, %39, %53, %51, %64, %61
%68 = phi float [ 7.800000e+01, %61 ], [ 7.000000e+01, %64 ], [ 5.200000e+01, %51 ], [ 5.000000e+01, %53 ], [ 7.800000e+01, %39 ], [ 7.000000e+01, %42 ], [ 7.800000e+01, %27 ], [ 7.000000e+01, %30 ], [ 7.000000e+01, %8 ], [ %20, %11 ]
%69 = tail call i32 @led_set_code(i32 0, float %68)
br label %70
70: ; preds = %67, %1
ret void
}