void set_segments(unsigned digit, unsigned dot) {
  static const unsigned segments[16] = {
      1 + 2 + 4 + 8 + 16 + 32,
      2 + 4,
      1 + 2 + 8 + 16 + 64,
      1 + 2 + 4 + 8 + 64,
      2 + 4 + 32 + 64,
      1 + 4 + 8 + 32 + 64,
      1 + 4 + 8 + 16 + 32 + 64,
      1 + 2 + 4,
      1 + 2 + 4 + 8 + 16 + 32 + 64,
      1 + 2 + 4 + 8 + 32 + 64,
      64,
      8 + 16 + 32,
      1 + 8 + 16 + 32,
      1 + 16 + 32,
      1 + 8 + 16 + 32 + 64,
      0,
  };
  switch (digit) {
  case '-':
    digit = 10;
    break;
  case 'L':
    digit = 11;
    break;
  case 'C':
    digit = 12;
    break;
  case 'R':
    digit = 13;
    break;
  case 'E':
    digit = 14;
    break;
  case ' ':
    digit = 15;
    break;
  }
  unsigned mask = segments[digit & 15];
  if (mask & 1)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (0));
  if (mask & 2)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (1));
  if (mask & 4)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (2));
  if (mask & 8)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (3));
  if (mask & 16)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (4));
  if (mask & 32)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (5));
  if (mask & 64)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (6));
  if (dot)
    *(volatile unsigned *)(0xBF800000 + (0x86104)) = (1 << (7));
}


x86 assembly (clang, -O0):
<set_segments>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffe0,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x32,%eax
ja     1176 <set_segments+0x76>
mov    -0x18(%rbp),%rax
lea    0xed6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x4(%rbp)
jmp    1176 <set_segments+0x76>
movl   $0xb,-0x4(%rbp)
jmp    1176 <set_segments+0x76>
movl   $0xc,-0x4(%rbp)
jmp    1176 <set_segments+0x76>
movl   $0xd,-0x4(%rbp)
jmp    1176 <set_segments+0x76>
movl   $0xe,-0x4(%rbp)
jmp    1176 <set_segments+0x76>
movl   $0xf,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xf49(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11a7 <set_segments+0xa7>
mov    $0xbf886104,%eax
movl   $0x1,(%rax)
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11c1 <set_segments+0xc1>
mov    $0xbf886104,%eax
movl   $0x2,(%rax)
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11db <set_segments+0xdb>
mov    $0xbf886104,%eax
movl   $0x4,(%rax)
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11f5 <set_segments+0xf5>
mov    $0xbf886104,%eax
movl   $0x8,(%rax)
mov    -0xc(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     120f <set_segments+0x10f>
mov    $0xbf886104,%eax
movl   $0x10,(%rax)
mov    -0xc(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1229 <set_segments+0x129>
mov    $0xbf886104,%eax
movl   $0x20,(%rax)
mov    -0xc(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1243 <set_segments+0x143>
mov    $0xbf886104,%eax
movl   $0x40,(%rax)
cmpl   $0x0,-0x8(%rbp)
je     1258 <set_segments+0x158>
mov    $0xbf886104,%eax
movl   $0x80,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_segments>:
lea    -0x20(%rdi),%eax
cmp    $0x32,%eax
ja     1140 <set_segments+0x40>
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xf,%edi
jmp    1140 <set_segments+0x40>
mov    $0xa,%edi
jmp    1140 <set_segments+0x40>
mov    $0xc,%edi
jmp    1140 <set_segments+0x40>
mov    $0xe,%edi
jmp    1140 <set_segments+0x40>
mov    $0xb,%edi
jmp    1140 <set_segments+0x40>
mov    $0xd,%edi
mov    $0xbf886104,%eax
and    $0xf,%edi
mov    $0x8c12,%ecx
bt     %edi,%ecx
jb     1158 <set_segments+0x58>
movl   $0x1,(%rax)
mov    $0xfc60,%ecx
bt     %edi,%ecx
jb     1168 <set_segments+0x68>
movl   $0x2,(%rax)
mov    $0xfc04,%ecx
bt     %edi,%ecx
jb     1178 <set_segments+0x78>
movl   $0x4,(%rax)
mov    $0xa492,%ecx
bt     %edi,%ecx
jb     1188 <set_segments+0x88>
movl   $0x8,(%rax)
mov    $0x86ba,%ecx
bt     %edi,%ecx
jb     1198 <set_segments+0x98>
movl   $0x10,(%rax)
mov    $0x848e,%ecx
bt     %edi,%ecx
jb     11a8 <set_segments+0xa8>
movl   $0x20,(%rax)
mov    $0xb883,%ecx
bt     %edi,%ecx
jb     11b8 <set_segments+0xb8>
movl   $0x40,(%rax)
test   %esi,%esi
je     11c2 <set_segments+0xc2>
movl   $0x80,(%rax)
ret

LLVM IR (-O0):
@set_segments.segments = internal constant [16 x i32] [i32 63, i32 6, i32 91, i32 79, i32 102, i32 109, i32 125, i32 7, i32 127, i32 111, i32 64, i32 56, i32 57, i32 49, i32 121, i32 0]
define void @set_segments(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
switch i32 %6, label %13 [
i32 45, label %7
i32 76, label %8
i32 67, label %9
i32 82, label %10
i32 69, label %11
i32 32, label %12
]
7: ; preds = %2
store i32 10, i32* %3
br label %13
8: ; preds = %2
store i32 11, i32* %3
br label %13
9: ; preds = %2
store i32 12, i32* %3
br label %13
10: ; preds = %2
store i32 13, i32* %3
br label %13
11: ; preds = %2
store i32 14, i32* %3
br label %13
12: ; preds = %2
store i32 15, i32* %3
br label %13
13: ; preds = %2, %12, %11, %10, %9, %8, %7
%14 = load i32, i32* %3
%15 = and i32 %14, 15
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [16 x i32], [16 x i32]* @set_segments.segments, i64 0, i64 %16
%18 = load i32, i32* %17
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %13
store volatile i32 1, i32* inttoptr (i64 3213385988 to i32*)
br label %23
23: ; preds = %22, %13
%24 = load i32, i32* %5
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store volatile i32 2, i32* inttoptr (i64 3213385988 to i32*)
br label %28
28: ; preds = %27, %23
%29 = load i32, i32* %5
%30 = and i32 %29, 4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store volatile i32 4, i32* inttoptr (i64 3213385988 to i32*)
br label %33
33: ; preds = %32, %28
%34 = load i32, i32* %5
%35 = and i32 %34, 8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store volatile i32 8, i32* inttoptr (i64 3213385988 to i32*)
br label %38
38: ; preds = %37, %33
%39 = load i32, i32* %5
%40 = and i32 %39, 16
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store volatile i32 16, i32* inttoptr (i64 3213385988 to i32*)
br label %43
43: ; preds = %42, %38
%44 = load i32, i32* %5
%45 = and i32 %44, 32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43
store volatile i32 32, i32* inttoptr (i64 3213385988 to i32*)
br label %48
48: ; preds = %47, %43
%49 = load i32, i32* %5
%50 = and i32 %49, 64
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %48
store volatile i32 64, i32* inttoptr (i64 3213385988 to i32*)
br label %53
53: ; preds = %52, %48
%54 = load i32, i32* %4
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %53
store volatile i32 128, i32* inttoptr (i64 3213385988 to i32*)
br label %57
57: ; preds = %56, %53
ret void
}

LLVM IR (-O2):
define void @set_segments(i32 %0, i32 %1) {
switch i32 %0, label %9 [
i32 45, label %3
i32 76, label %4
i32 67, label %5
i32 82, label %6
i32 69, label %7
i32 32, label %8
]
3: ; preds = %2
br label %9
4: ; preds = %2
br label %9
5: ; preds = %2
br label %9
6: ; preds = %2
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %8, %7, %6, %5, %4, %3
%10 = phi i32 [ %0, %2 ], [ 15, %8 ], [ 14, %7 ], [ 13, %6 ], [ 12, %5 ], [ 11, %4 ], [ 10, %3 ]
%11 = and i32 %10, 15
%12 = zext i32 %11 to i64
%13 = lshr i64 35858, %12
%14 = and i64 %13, 1
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %9
store volatile i32 1, i32* inttoptr (i64 3213385988 to i32*)
br label %17
17: ; preds = %16, %9
%18 = lshr i64 64608, %12
%19 = and i64 %18, 1
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store volatile i32 2, i32* inttoptr (i64 3213385988 to i32*)
br label %22
22: ; preds = %21, %17
%23 = lshr i64 64516, %12
%24 = and i64 %23, 1
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store volatile i32 4, i32* inttoptr (i64 3213385988 to i32*)
br label %27
27: ; preds = %26, %22
%28 = lshr i64 42130, %12
%29 = and i64 %28, 1
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
store volatile i32 8, i32* inttoptr (i64 3213385988 to i32*)
br label %32
32: ; preds = %31, %27
%33 = lshr i64 34490, %12
%34 = and i64 %33, 1
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store volatile i32 16, i32* inttoptr (i64 3213385988 to i32*)
br label %37
37: ; preds = %36, %32
%38 = lshr i64 33934, %12
%39 = and i64 %38, 1
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
store volatile i32 32, i32* inttoptr (i64 3213385988 to i32*)
br label %42
42: ; preds = %41, %37
%43 = lshr i64 47235, %12
%44 = and i64 %43, 1
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %42
store volatile i32 64, i32* inttoptr (i64 3213385988 to i32*)
br label %47
47: ; preds = %46, %42
%48 = icmp eq i32 %1, 0
br i1 %48, label %50, label %49
49: ; preds = %47
store volatile i32 128, i32* inttoptr (i64 3213385988 to i32*)
br label %50
50: ; preds = %49, %47
ret void
}