void leds_OFF(unsigned short number) {
  if (number <= 4) {
    switch (number) {
    case 1:
      ((*(volatile unsigned long *)0x10008808) |= (1 << 4));
      break;
    case 2:
      ((*(volatile unsigned long *)0x10008808) |= (1 << 5));
      break;
    case 3:
      ((*(volatile unsigned long *)0x10008808) |= (1 << 6));
      break;
    case 4:
      ((*(volatile unsigned long *)0x10008808) |= (1 << 7));
      break;
    }
  }
}


x86 assembly (clang, -O0):
<leds_OFF>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x4,%eax
jg     11a9 <leds_OFF+0xa9>
movzwl -0x2(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11a4 <leds_OFF+0xa4>
mov    -0x10(%rbp),%rax
lea    0xec7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x10008808,%eax
mov    (%rax),%rcx
or     $0x10,%rcx
mov    $0x10008808,%eax
mov    %rcx,(%rax)
jmp    11a4 <leds_OFF+0xa4>
mov    $0x10008808,%eax
mov    (%rax),%rcx
or     $0x20,%rcx
mov    $0x10008808,%eax
mov    %rcx,(%rax)
jmp    11a4 <leds_OFF+0xa4>
mov    $0x10008808,%eax
mov    (%rax),%rcx
or     $0x40,%rcx
mov    $0x10008808,%eax
mov    %rcx,(%rax)
jmp    11a4 <leds_OFF+0xa4>
mov    $0x10008808,%eax
mov    (%rax),%rcx
or     $0x80,%rcx
mov    $0x10008808,%eax
mov    %rcx,(%rax)
jmp    11a9 <leds_OFF+0xa9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<leds_OFF>:
cmp    $0x4,%di
ja     1126 <leds_OFF+0x26>
add    $0xffffffff,%edi
cmp    $0x3,%di
ja     1126 <leds_OFF+0x26>
movswq %di,%rax
lea    0xee6(%rip),%rcx
mov    (%rcx,%rax,8),%rax
or     %rax,0x10008808
10
ret

LLVM IR (-O0):
define void @leds_OFF(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = icmp sle i32 %4, 4
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
switch i32 %8, label %21 [
i32 1, label %9
i32 2, label %12
i32 3, label %15
i32 4, label %18
]
9: ; preds = %6
%10 = load volatile i64, i64* inttoptr (i64 268470280 to i64*)
%11 = or i64 %10, 16
store volatile i64 %11, i64* inttoptr (i64 268470280 to i64*)
br label %21
12: ; preds = %6
%13 = load volatile i64, i64* inttoptr (i64 268470280 to i64*)
%14 = or i64 %13, 32
store volatile i64 %14, i64* inttoptr (i64 268470280 to i64*)
br label %21
15: ; preds = %6
%16 = load volatile i64, i64* inttoptr (i64 268470280 to i64*)
%17 = or i64 %16, 64
store volatile i64 %17, i64* inttoptr (i64 268470280 to i64*)
br label %21
18: ; preds = %6
%19 = load volatile i64, i64* inttoptr (i64 268470280 to i64*)
%20 = or i64 %19, 128
store volatile i64 %20, i64* inttoptr (i64 268470280 to i64*)
br label %21
21: ; preds = %6, %18, %15, %12, %9
br label %22
22: ; preds = %21, %1
ret void
}

LLVM IR (-O2):
@switch.table.leds_OFF = [4 x i64] [i64 16, i64 32, i64 64, i64 128]
define void @leds_OFF(i16 zeroext %0) {
%2 = icmp ult i16 %0, 5
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = add i16 %0, -1
%5 = icmp ult i16 %4, 4
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = sext i16 %4 to i64
%8 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.leds_OFF, i64 0, i64 %7
%9 = load i64, i64* %8
%10 = load volatile i64, i64* inttoptr (i64 268470280 to i64*)
%11 = or i64 %10, %9
store volatile i64 %11, i64* inttoptr (i64 268470280 to i64*)
br label %12
12: ; preds = %3, %6, %1
ret void
}