#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 */
typedef int uint16_t;

/* Variables and functions */
int port_to_page(uint16_t addr) {
  switch (addr) {
  case 0x208:
    return 0;
  case 0x4208:
    return 1;
  case 0x8208:
    return 2;
  case 0xC208:
    return 3;
  case 0x218:
    return 4;
  case 0x4218:
    return 5;
  case 0x8218:
    return 6;
  case 0xC218:
    return 7;
  case 0x258:
    return 8;
  case 0x4258:
    return 9;
  case 0x8258:
    return 10;
  case 0xC258:
    return 11;
  case 0x268:
    return 12;
  case 0x4268:
    return 13;
  case 0x8268:
    return 14;
  case 0xC268:
    return 15;
  }
  return -1;
}


x86 assembly (clang, -O0):
<port_to_page>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x208,%eax
je     123a <port_to_page+0x13a>
jmp    111d <port_to_page+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x218,%eax
je     126a <port_to_page+0x16a>
jmp    1130 <port_to_page+0x30>
mov    -0xc(%rbp),%eax
sub    $0x258,%eax
je     129a <port_to_page+0x19a>
jmp    1143 <port_to_page+0x43>
mov    -0xc(%rbp),%eax
sub    $0x268,%eax
je     12ca <port_to_page+0x1ca>
jmp    1156 <port_to_page+0x56>
mov    -0xc(%rbp),%eax
sub    $0x4208,%eax
je     1246 <port_to_page+0x146>
jmp    1169 <port_to_page+0x69>
mov    -0xc(%rbp),%eax
sub    $0x4218,%eax
je     1276 <port_to_page+0x176>
jmp    117c <port_to_page+0x7c>
mov    -0xc(%rbp),%eax
sub    $0x4258,%eax
je     12a6 <port_to_page+0x1a6>
jmp    118f <port_to_page+0x8f>
mov    -0xc(%rbp),%eax
sub    $0x4268,%eax
je     12d6 <port_to_page+0x1d6>
jmp    11a2 <port_to_page+0xa2>
mov    -0xc(%rbp),%eax
sub    $0x8208,%eax
je     1252 <port_to_page+0x152>
jmp    11b5 <port_to_page+0xb5>
mov    -0xc(%rbp),%eax
sub    $0x8218,%eax
je     1282 <port_to_page+0x182>
jmp    11c8 <port_to_page+0xc8>
mov    -0xc(%rbp),%eax
sub    $0x8258,%eax
je     12b2 <port_to_page+0x1b2>
jmp    11db <port_to_page+0xdb>
mov    -0xc(%rbp),%eax
sub    $0x8268,%eax
je     12e2 <port_to_page+0x1e2>
jmp    11ee <port_to_page+0xee>
mov    -0xc(%rbp),%eax
sub    $0xc208,%eax
je     125e <port_to_page+0x15e>
jmp    1201 <port_to_page+0x101>
mov    -0xc(%rbp),%eax
sub    $0xc218,%eax
je     128e <port_to_page+0x18e>
jmp    1214 <port_to_page+0x114>
mov    -0xc(%rbp),%eax
sub    $0xc258,%eax
je     12be <port_to_page+0x1be>
jmp    1227 <port_to_page+0x127>
mov    -0xc(%rbp),%eax
sub    $0xc268,%eax
je     12ee <port_to_page+0x1ee>
jmp    12fa <port_to_page+0x1fa>
movl   $0x0,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x1,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x2,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x3,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x4,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x5,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x6,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x7,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x8,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0x9,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xa,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xb,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xc,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xd,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xe,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xf,-0x4(%rbp)
jmp    1301 <port_to_page+0x201>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_to_page>:
cmp    $0x8207,%edi
jg     113c <port_to_page+0x3c>
cmp    $0x4207,%edi
jg     116a <port_to_page+0x6a>
cmp    $0x257,%edi
jg     11b2 <port_to_page+0xb2>
xor    %eax,%eax
cmp    $0x208,%edi
je     1239 <port_to_page+0x139>
cmp    $0x218,%edi
jne    1234 <port_to_page+0x134>
mov    $0x4,%eax
ret
cmp    $0xc207,%edi
jg     1190 <port_to_page+0x90>
cmp    $0x8257,%edi
jg     11c8 <port_to_page+0xc8>
cmp    $0x8208,%edi
je     120a <port_to_page+0x10a>
cmp    $0x8218,%edi
jne    1234 <port_to_page+0x134>
mov    $0x6,%eax
ret
cmp    $0x4257,%edi
jg     11de <port_to_page+0xde>
cmp    $0x4208,%edi
je     1210 <port_to_page+0x110>
cmp    $0x4218,%edi
jne    1234 <port_to_page+0x134>
mov    $0x5,%eax
ret
cmp    $0xc257,%edi
jg     11f4 <port_to_page+0xf4>
cmp    $0xc208,%edi
je     1216 <port_to_page+0x116>
cmp    $0xc218,%edi
jne    1234 <port_to_page+0x134>
mov    $0x7,%eax
ret
cmp    $0x258,%edi
je     121c <port_to_page+0x11c>
cmp    $0x268,%edi
jne    1234 <port_to_page+0x134>
mov    $0xc,%eax
ret
cmp    $0x8258,%edi
je     1222 <port_to_page+0x122>
cmp    $0x8268,%edi
jne    1234 <port_to_page+0x134>
mov    $0xe,%eax
ret
cmp    $0x4258,%edi
je     1228 <port_to_page+0x128>
cmp    $0x4268,%edi
jne    1234 <port_to_page+0x134>
mov    $0xd,%eax
ret
cmp    $0xc258,%edi
je     122e <port_to_page+0x12e>
cmp    $0xc268,%edi
jne    1234 <port_to_page+0x134>
mov    $0xf,%eax
ret
mov    $0x2,%eax
ret
mov    $0x1,%eax
ret
mov    $0x3,%eax
ret
mov    $0x8,%eax
ret
mov    $0xa,%eax
ret
mov    $0x9,%eax
ret
mov    $0xb,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @port_to_page(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 520, label %5
i32 16904, label %6
i32 33288, label %7
i32 49672, label %8
i32 536, label %9
i32 16920, label %10
i32 33304, label %11
i32 49688, label %12
i32 600, label %13
i32 16984, label %14
i32 33368, label %15
i32 49752, label %16
i32 616, label %17
i32 17000, label %18
i32 33384, label %19
i32 49768, label %20
]
5: ; preds = %1
store i32 0, i32* %2
br label %22
6: ; preds = %1
store i32 1, i32* %2
br label %22
7: ; preds = %1
store i32 2, i32* %2
br label %22
8: ; preds = %1
store i32 3, i32* %2
br label %22
9: ; preds = %1
store i32 4, i32* %2
br label %22
10: ; preds = %1
store i32 5, i32* %2
br label %22
11: ; preds = %1
store i32 6, i32* %2
br label %22
12: ; preds = %1
store i32 7, i32* %2
br label %22
13: ; preds = %1
store i32 8, i32* %2
br label %22
14: ; preds = %1
store i32 9, i32* %2
br label %22
15: ; preds = %1
store i32 10, i32* %2
br label %22
16: ; preds = %1
store i32 11, i32* %2
br label %22
17: ; preds = %1
store i32 12, i32* %2
br label %22
18: ; preds = %1
store i32 13, i32* %2
br label %22
19: ; preds = %1
store i32 14, i32* %2
br label %22
20: ; preds = %1
store i32 15, i32* %2
br label %22
21: ; preds = %1
store i32 -1, i32* %2
br label %22
22: ; preds = %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @port_to_page(i32 %0) {
switch i32 %0, label %17 [
i32 520, label %18
i32 16904, label %2
i32 33288, label %3
i32 49672, label %4
i32 536, label %5
i32 16920, label %6
i32 33304, label %7
i32 49688, label %8
i32 600, label %9
i32 16984, label %10
i32 33368, label %11
i32 49752, label %12
i32 616, label %13
i32 17000, label %14
i32 33384, label %15
i32 49768, label %16
]
2: ; preds = %1
br label %18
3: ; preds = %1
br label %18
4: ; preds = %1
br label %18
5: ; preds = %1
br label %18
6: ; preds = %1
br label %18
7: ; preds = %1
br label %18
8: ; preds = %1
br label %18
9: ; preds = %1
br label %18
10: ; preds = %1
br label %18
11: ; preds = %1
br label %18
12: ; preds = %1
br label %18
13: ; preds = %1
br label %18
14: ; preds = %1
br label %18
15: ; preds = %1
br label %18
16: ; preds = %1
br label %18
17: ; preds = %1
br label %18
18: ; preds = %1, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%19 = phi i32 [ -1, %17 ], [ 15, %16 ], [ 14, %15 ], [ 13, %14 ], [ 12, %13 ], [ 11, %12 ], [ 10, %11 ], [ 9, %10 ], [ 8, %9 ], [ 7, %8 ], [ 6, %7 ], [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %1 ]
ret i32 %19
}