long GPIOGetIntNumber(unsigned long ulPort) {
  unsigned int ulInt;
  switch (ulPort) {
  case 0x40004000:
  case 0x40058000: {
    ulInt = 16;
    break;
  }
  case 0x40005000:
  case 0x40059000: {
    ulInt = 17;
    break;
  }
  case 0x40006000:
  case 0x4005A000: {
    ulInt = 18;
    break;
  }
  case 0x40007000:
  case 0x4005B000: {
    ulInt = 19;
    break;
  }
  case 0x40024000:
  case 0x4005C000: {
    ulInt = 20;
    break;
  }
  case 0x40025000:
  case 0x4005D000: {
    ulInt = 46;
    break;
  }
  case 0x40026000:
  case 0x4005E000: {
    ulInt = 47;
    break;
  }
  case 0x40027000:
  case 0x4005F000: {
    ulInt = 48;
    break;
  }
  case 0x4003D000:
  case 0x40060000: {
    ulInt = 70;
    break;
  }
  default: {
    return (-1);
  }
  }
  return (ulInt);
}


x86 assembly (clang, -O0):
<GPIOGetIntNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
sub    $0x40004000,%rax
je     1286 <GPIOGetIntNumber+0x186>
jmp    1121 <GPIOGetIntNumber+0x21>
mov    -0x20(%rbp),%rax
sub    $0x40005000,%rax
je     1292 <GPIOGetIntNumber+0x192>
jmp    1136 <GPIOGetIntNumber+0x36>
mov    -0x20(%rbp),%rax
sub    $0x40006000,%rax
je     129e <GPIOGetIntNumber+0x19e>
jmp    114b <GPIOGetIntNumber+0x4b>
mov    -0x20(%rbp),%rax
sub    $0x40007000,%rax
je     12aa <GPIOGetIntNumber+0x1aa>
jmp    1160 <GPIOGetIntNumber+0x60>
mov    -0x20(%rbp),%rax
sub    $0x40024000,%rax
je     12b6 <GPIOGetIntNumber+0x1b6>
jmp    1175 <GPIOGetIntNumber+0x75>
mov    -0x20(%rbp),%rax
sub    $0x40025000,%rax
je     12c2 <GPIOGetIntNumber+0x1c2>
jmp    118a <GPIOGetIntNumber+0x8a>
mov    -0x20(%rbp),%rax
sub    $0x40026000,%rax
je     12ce <GPIOGetIntNumber+0x1ce>
jmp    119f <GPIOGetIntNumber+0x9f>
mov    -0x20(%rbp),%rax
sub    $0x40027000,%rax
je     12da <GPIOGetIntNumber+0x1da>
jmp    11b4 <GPIOGetIntNumber+0xb4>
mov    -0x20(%rbp),%rax
sub    $0x4003d000,%rax
je     12e6 <GPIOGetIntNumber+0x1e6>
jmp    11c9 <GPIOGetIntNumber+0xc9>
mov    -0x20(%rbp),%rax
sub    $0x40058000,%rax
je     1286 <GPIOGetIntNumber+0x186>
jmp    11de <GPIOGetIntNumber+0xde>
mov    -0x20(%rbp),%rax
sub    $0x40059000,%rax
je     1292 <GPIOGetIntNumber+0x192>
jmp    11f3 <GPIOGetIntNumber+0xf3>
mov    -0x20(%rbp),%rax
sub    $0x4005a000,%rax
je     129e <GPIOGetIntNumber+0x19e>
jmp    1208 <GPIOGetIntNumber+0x108>
mov    -0x20(%rbp),%rax
sub    $0x4005b000,%rax
je     12aa <GPIOGetIntNumber+0x1aa>
jmp    121d <GPIOGetIntNumber+0x11d>
mov    -0x20(%rbp),%rax
sub    $0x4005c000,%rax
je     12b6 <GPIOGetIntNumber+0x1b6>
jmp    1232 <GPIOGetIntNumber+0x132>
mov    -0x20(%rbp),%rax
sub    $0x4005d000,%rax
je     12c2 <GPIOGetIntNumber+0x1c2>
jmp    1247 <GPIOGetIntNumber+0x147>
mov    -0x20(%rbp),%rax
sub    $0x4005e000,%rax
je     12ce <GPIOGetIntNumber+0x1ce>
jmp    125c <GPIOGetIntNumber+0x15c>
mov    -0x20(%rbp),%rax
sub    $0x4005f000,%rax
je     12da <GPIOGetIntNumber+0x1da>
jmp    1271 <GPIOGetIntNumber+0x171>
mov    -0x20(%rbp),%rax
sub    $0x40060000,%rax
je     12e6 <GPIOGetIntNumber+0x1e6>
jmp    12f2 <GPIOGetIntNumber+0x1f2>
movl   $0x10,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x11,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x12,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x13,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x14,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x2e,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x2f,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x30,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movl   $0x46,-0x14(%rbp)
jmp    12ff <GPIOGetIntNumber+0x1ff>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1306 <GPIOGetIntNumber+0x206>
mov    -0x14(%rbp),%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOGetIntNumber>:
mov    $0x10,%ecx
mov    $0xffffffffffffffff,%rax
cmp    $0x40057fff,%rdi
jg     1153 <GPIOGetIntNumber+0x53>
cmp    $0x40023fff,%rdi
jle    119a <GPIOGetIntNumber+0x9a>
cmp    $0x40025fff,%rdi
jle    11e4 <GPIOGetIntNumber+0xe4>
cmp    $0x40026000,%rdi
je     123e <GPIOGetIntNumber+0x13e>
cmp    $0x40027000,%rdi
je     1245 <GPIOGetIntNumber+0x145>
cmp    $0x4003d000,%rdi
je     1190 <GPIOGetIntNumber+0x90>
jmp    125b <GPIOGetIntNumber+0x15b>
cmp    $0x4005bfff,%rdi
jle    11be <GPIOGetIntNumber+0xbe>
cmp    $0x4005dfff,%rdi
jle    11f8 <GPIOGetIntNumber+0xf8>
cmp    $0x4005e000,%rdi
je     123e <GPIOGetIntNumber+0x13e>
cmp    $0x4005f000,%rdi
je     1245 <GPIOGetIntNumber+0x145>
cmp    $0x40060000,%rdi
jne    125b <GPIOGetIntNumber+0x15b>
mov    $0x46,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
cmp    $0x40005fff,%rdi
jg     1211 <GPIOGetIntNumber+0x111>
cmp    $0x40004000,%rdi
je     1258 <GPIOGetIntNumber+0x158>
cmp    $0x40005000,%rdi
je     11dd <GPIOGetIntNumber+0xdd>
jmp    125b <GPIOGetIntNumber+0x15b>
cmp    $0x40059fff,%rdi
jg     1225 <GPIOGetIntNumber+0x125>
cmp    $0x40058000,%rdi
je     1258 <GPIOGetIntNumber+0x158>
cmp    $0x40059000,%rdi
jne    125b <GPIOGetIntNumber+0x15b>
mov    $0x11,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
cmp    $0x40024000,%rdi
je     124c <GPIOGetIntNumber+0x14c>
cmp    $0x40025000,%rdi
je     120a <GPIOGetIntNumber+0x10a>
jmp    125b <GPIOGetIntNumber+0x15b>
cmp    $0x4005c000,%rdi
je     124c <GPIOGetIntNumber+0x14c>
cmp    $0x4005d000,%rdi
jne    125b <GPIOGetIntNumber+0x15b>
mov    $0x2e,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
cmp    $0x40006000,%rdi
je     1253 <GPIOGetIntNumber+0x153>
cmp    $0x40007000,%rdi
je     1237 <GPIOGetIntNumber+0x137>
jmp    125b <GPIOGetIntNumber+0x15b>
cmp    $0x4005a000,%rdi
je     1253 <GPIOGetIntNumber+0x153>
cmp    $0x4005b000,%rdi
jne    125b <GPIOGetIntNumber+0x15b>
mov    $0x13,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
mov    $0x2f,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
mov    $0x30,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
mov    $0x14,%ecx
jmp    1258 <GPIOGetIntNumber+0x158>
mov    $0x12,%ecx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @GPIOGetIntNumber(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
%5 = load i64, i64* %3
switch i64 %5, label %15 [
i64 1073758208, label %6
i64 1074102272, label %6
i64 1073762304, label %7
i64 1074106368, label %7
i64 1073766400, label %8
i64 1074110464, label %8
i64 1073770496, label %9
i64 1074114560, label %9
i64 1073889280, label %10
i64 1074118656, label %10
i64 1073893376, label %11
i64 1074122752, label %11
i64 1073897472, label %12
i64 1074126848, label %12
i64 1073901568, label %13
i64 1074130944, label %13
i64 1073991680, label %14
i64 1074135040, label %14
]
6: ; preds = %1, %1
store i32 16, i32* %4
br label %16
7: ; preds = %1, %1
store i32 17, i32* %4
br label %16
8: ; preds = %1, %1
store i32 18, i32* %4
br label %16
9: ; preds = %1, %1
store i32 19, i32* %4
br label %16
10: ; preds = %1, %1
store i32 20, i32* %4
br label %16
11: ; preds = %1, %1
store i32 46, i32* %4
br label %16
12: ; preds = %1, %1
store i32 47, i32* %4
br label %16
13: ; preds = %1, %1
store i32 48, i32* %4
br label %16
14: ; preds = %1, %1
store i32 70, i32* %4
br label %16
15: ; preds = %1
store i64 -1, i64* %2
br label %19
16: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i32, i32* %4
%18 = zext i32 %17 to i64
store i64 %18, i64* %2
br label %19
19: ; preds = %16, %15
%20 = load i64, i64* %2
ret i64 %20
}

LLVM IR (-O2):
define i64 @GPIOGetIntNumber(i64 %0) {
switch i64 %0, label %12 [
i64 1073758208, label %10
i64 1074102272, label %10
i64 1073762304, label %2
i64 1074106368, label %2
i64 1073766400, label %3
i64 1074110464, label %3
i64 1073770496, label %4
i64 1074114560, label %4
i64 1073889280, label %5
i64 1074118656, label %5
i64 1073893376, label %6
i64 1074122752, label %6
i64 1073897472, label %7
i64 1074126848, label %7
i64 1073901568, label %8
i64 1074130944, label %8
i64 1073991680, label %9
i64 1074135040, label %9
]
2: ; preds = %1, %1
br label %10
3: ; preds = %1, %1
br label %10
4: ; preds = %1, %1
br label %10
5: ; preds = %1, %1
br label %10
6: ; preds = %1, %1
br label %10
7: ; preds = %1, %1
br label %10
8: ; preds = %1, %1
br label %10
9: ; preds = %1, %1
br label %10
10: ; preds = %1, %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i64 [ 70, %9 ], [ 48, %8 ], [ 47, %7 ], [ 46, %6 ], [ 20, %5 ], [ 19, %4 ], [ 18, %3 ], [ 17, %2 ], [ 16, %1 ], [ 16, %1 ]
br label %12
12: ; preds = %1, %10
%13 = phi i64 [ %11, %10 ], [ -1, %1 ]
ret i64 %13
}