void WriteDigital(int bitnumber, int value) {
  switch (bitnumber) {
  case 0: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 2);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 2);
    break;
  }
  case 1: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 3);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 3);
    break;
  }
  case 2: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 4);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 4);
    break;
  }
  case 3: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 5);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 5);
    break;
  }
  case 4: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 6);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 6);
    break;
  }
  case 5: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 7);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 7);
    break;
  }
  case 6: {
    if (value == 1)
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) | (1 << 8);
    else
      (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) =
          (*((volatile unsigned int *)(0x50000000 + 0x3ffc))) & ~(1 << 8);
    break;
  }
  }
}


x86 assembly (clang, -O0):
<WriteDigital>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     12b5 <WriteDigital+0x1b5>
mov    -0x10(%rbp),%rax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x1,-0x8(%rbp)
jne    114f <WriteDigital+0x4f>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    1160 <WriteDigital+0x60>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    1185 <WriteDigital+0x85>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    1196 <WriteDigital+0x96>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xfffffff7,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    11bb <WriteDigital+0xbb>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    11cc <WriteDigital+0xcc>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    11f1 <WriteDigital+0xf1>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x20,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    1202 <WriteDigital+0x102>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xffffffdf,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    1227 <WriteDigital+0x127>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x40,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    1238 <WriteDigital+0x138>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xffffffbf,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    1260 <WriteDigital+0x160>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x80,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    1274 <WriteDigital+0x174>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xffffff7f,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
cmpl   $0x1,-0x8(%rbp)
jne    129c <WriteDigital+0x19c>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
or     $0x100,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b0 <WriteDigital+0x1b0>
mov    $0x50003ffc,%eax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    $0x50003ffc,%eax
mov    %ecx,(%rax)
jmp    12b5 <WriteDigital+0x1b5>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteDigital>:
cmp    $0x6,%edi
ja     11c5 <WriteDigital+0xc5>
mov    %edi,%eax
lea    0xeee(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    1199 <WriteDigital+0x99>
or     $0x4,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    119e <WriteDigital+0x9e>
or     $0x8,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    11a3 <WriteDigital+0xa3>
or     $0x10,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    11a8 <WriteDigital+0xa8>
or     $0x20,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    11ad <WriteDigital+0xad>
or     $0x40,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    11b2 <WriteDigital+0xb2>
or     $0x80,%eax
jmp    11be <WriteDigital+0xbe>
mov    0x50003ffc,%eax
cmp    $0x1,%esi
jne    11b9 <WriteDigital+0xb9>
or     $0x100,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xfffffffb,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xfffffff7,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xffffffef,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xffffffdf,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xffffffbf,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xffffff7f,%eax
jmp    11be <WriteDigital+0xbe>
and    $0xfffffeff,%eax
mov    %eax,0x50003ffc
ret

LLVM IR (-O0):
define void @WriteDigital(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
switch i32 %5, label %76 [
i32 0, label %6
i32 1, label %16
i32 2, label %26
i32 3, label %36
i32 4, label %46
i32 5, label %56
i32 6, label %66
]
6: ; preds = %2
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%11 = or i32 %10, 4
store volatile i32 %11, i32* inttoptr (i64 1342193660 to i32*)
br label %15
12: ; preds = %6
%13 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%14 = and i32 %13, -5
store volatile i32 %14, i32* inttoptr (i64 1342193660 to i32*)
br label %15
15: ; preds = %12, %9
br label %76
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%21 = or i32 %20, 8
store volatile i32 %21, i32* inttoptr (i64 1342193660 to i32*)
br label %25
22: ; preds = %16
%23 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%24 = and i32 %23, -9
store volatile i32 %24, i32* inttoptr (i64 1342193660 to i32*)
br label %25
25: ; preds = %22, %19
br label %76
26: ; preds = %2
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%31 = or i32 %30, 16
store volatile i32 %31, i32* inttoptr (i64 1342193660 to i32*)
br label %35
32: ; preds = %26
%33 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%34 = and i32 %33, -17
store volatile i32 %34, i32* inttoptr (i64 1342193660 to i32*)
br label %35
35: ; preds = %32, %29
br label %76
36: ; preds = %2
%37 = load i32, i32* %4
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%41 = or i32 %40, 32
store volatile i32 %41, i32* inttoptr (i64 1342193660 to i32*)
br label %45
42: ; preds = %36
%43 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%44 = and i32 %43, -33
store volatile i32 %44, i32* inttoptr (i64 1342193660 to i32*)
br label %45
45: ; preds = %42, %39
br label %76
46: ; preds = %2
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 1
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%51 = or i32 %50, 64
store volatile i32 %51, i32* inttoptr (i64 1342193660 to i32*)
br label %55
52: ; preds = %46
%53 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%54 = and i32 %53, -65
store volatile i32 %54, i32* inttoptr (i64 1342193660 to i32*)
br label %55
55: ; preds = %52, %49
br label %76
56: ; preds = %2
%57 = load i32, i32* %4
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%61 = or i32 %60, 128
store volatile i32 %61, i32* inttoptr (i64 1342193660 to i32*)
br label %65
62: ; preds = %56
%63 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%64 = and i32 %63, -129
store volatile i32 %64, i32* inttoptr (i64 1342193660 to i32*)
br label %65
65: ; preds = %62, %59
br label %76
66: ; preds = %2
%67 = load i32, i32* %4
%68 = icmp eq i32 %67, 1
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%71 = or i32 %70, 256
store volatile i32 %71, i32* inttoptr (i64 1342193660 to i32*)
br label %75
72: ; preds = %66
%73 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
%74 = and i32 %73, -257
store volatile i32 %74, i32* inttoptr (i64 1342193660 to i32*)
br label %75
75: ; preds = %72, %69
br label %76
76: ; preds = %2, %75, %65, %55, %45, %35, %25, %15
ret void
}

LLVM IR (-O2):
define void @WriteDigital(i32 %0, i32 %1) {
switch i32 %0, label %54 [
i32 0, label %3
i32 1, label %10
i32 2, label %17
i32 3, label %24
i32 4, label %31
i32 5, label %38
i32 6, label %45
]
3: ; preds = %2
%4 = icmp eq i32 %1, 1
%5 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %4, label %6, label %8
6: ; preds = %3
%7 = or i32 %5, 4
br label %52
8: ; preds = %3
%9 = and i32 %5, -5
br label %52
10: ; preds = %2
%11 = icmp eq i32 %1, 1
%12 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %11, label %13, label %15
13: ; preds = %10
%14 = or i32 %12, 8
br label %52
15: ; preds = %10
%16 = and i32 %12, -9
br label %52
17: ; preds = %2
%18 = icmp eq i32 %1, 1
%19 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %18, label %20, label %22
20: ; preds = %17
%21 = or i32 %19, 16
br label %52
22: ; preds = %17
%23 = and i32 %19, -17
br label %52
24: ; preds = %2
%25 = icmp eq i32 %1, 1
%26 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %25, label %27, label %29
27: ; preds = %24
%28 = or i32 %26, 32
br label %52
29: ; preds = %24
%30 = and i32 %26, -33
br label %52
31: ; preds = %2
%32 = icmp eq i32 %1, 1
%33 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %32, label %34, label %36
34: ; preds = %31
%35 = or i32 %33, 64
br label %52
36: ; preds = %31
%37 = and i32 %33, -65
br label %52
38: ; preds = %2
%39 = icmp eq i32 %1, 1
%40 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %39, label %41, label %43
41: ; preds = %38
%42 = or i32 %40, 128
br label %52
43: ; preds = %38
%44 = and i32 %40, -129
br label %52
45: ; preds = %2
%46 = icmp eq i32 %1, 1
%47 = load volatile i32, i32* inttoptr (i64 1342193660 to i32*)
br i1 %46, label %48, label %50
48: ; preds = %45
%49 = or i32 %47, 256
br label %52
50: ; preds = %45
%51 = and i32 %47, -257
br label %52
52: ; preds = %8, %6, %15, %13, %22, %20, %29, %27, %36, %34, %43, %41, %50, %48
%53 = phi i32 [ %49, %48 ], [ %51, %50 ], [ %42, %41 ], [ %44, %43 ], [ %35, %34 ], [ %37, %36 ], [ %28, %27 ], [ %30, %29 ], [ %21, %20 ], [ %23, %22 ], [ %14, %13 ], [ %16, %15 ], [ %7, %6 ], [ %9, %8 ]
store volatile i32 %53, i32* inttoptr (i64 1342193660 to i32*)
br label %54
54: ; preds = %52, %2
ret void
}