#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 */

/* Variables and functions */
#define NID_X9_62_prime192v1 155
#define NID_X9_62_prime256v1 154
#define NID_brainpoolP256r1 153
#define NID_brainpoolP384r1 152
#define NID_brainpoolP512r1 151
#define NID_secp160k1 150
#define NID_secp160r1 149
#define NID_secp160r2 148
#define NID_secp192k1 147
#define NID_secp224k1 146
#define NID_secp224r1 145
#define NID_secp256k1 144
#define NID_secp384r1 143
#define NID_secp521r1 142
#define NID_sect163k1 141
#define NID_sect163r1 140
#define NID_sect163r2 139
#define NID_sect193r1 138
#define NID_sect193r2 137
#define NID_sect233k1 136
#define NID_sect233r1 135
#define NID_sect239k1 134
#define NID_sect283k1 133
#define NID_sect283r1 132
#define NID_sect409k1 131
#define NID_sect409r1 130
#define NID_sect571k1 129
#define NID_sect571r1 128
int tls1_ec_nid2curve_id(int nid) {
  switch (nid) {
  case NID_sect163k1:
    return 1;
  case NID_sect163r1:
    return 2;
  case NID_sect163r2:
    return 3;
  case NID_sect193r1:
    return 4;
  case NID_sect193r2:
    return 5;
  case NID_sect233k1:
    return 6;
  case NID_sect233r1:
    return 7;
  case NID_sect239k1:
    return 8;
  case NID_sect283k1:
    return 9;
  case NID_sect283r1:
    return 10;
  case NID_sect409k1:
    return 11;
  case NID_sect409r1:
    return 12;
  case NID_sect571k1:
    return 13;
  case NID_sect571r1:
    return 14;
  case NID_secp160k1:
    return 15;
  case NID_secp160r1:
    return 16;
  case NID_secp160r2:
    return 17;
  case NID_secp192k1:
    return 18;
  case NID_X9_62_prime192v1:
    return 19;
  case NID_secp224k1:
    return 20;
  case NID_secp224r1:
    return 21;
  case NID_secp256k1:
    return 22;
  case NID_X9_62_prime256v1:
    return 23;
  case NID_secp384r1:
    return 24;
  case NID_secp521r1:
    return 25;
  case NID_brainpoolP256r1:
    return 26;
  case NID_brainpoolP384r1:
    return 27;
  case NID_brainpoolP512r1:
    return 28;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<tls1_ec_nid2curve_id>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x1b,%eax
ja     1280 <tls1_ec_nid2curve_id+0x180>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x2,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x3,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x4,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x5,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x6,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x7,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x8,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x9,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xa,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xb,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xc,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xd,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xe,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0xf,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x10,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x11,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x12,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x13,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x14,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x15,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x16,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x17,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x18,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x19,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x1a,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x1b,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x1c,-0x4(%rbp)
jmp    1287 <tls1_ec_nid2curve_id+0x187>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tls1_ec_nid2curve_id>:
add    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x1b,%edi
ja     1117 <tls1_ec_nid2curve_id+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @tls1_ec_nid2curve_id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %33 [
i32 141, label %5
i32 140, label %6
i32 139, label %7
i32 138, label %8
i32 137, label %9
i32 136, label %10
i32 135, label %11
i32 134, label %12
i32 133, label %13
i32 132, label %14
i32 131, label %15
i32 130, label %16
i32 129, label %17
i32 128, label %18
i32 150, label %19
i32 149, label %20
i32 148, label %21
i32 147, label %22
i32 155, label %23
i32 146, label %24
i32 145, label %25
i32 144, label %26
i32 154, label %27
i32 143, label %28
i32 142, label %29
i32 153, label %30
i32 152, label %31
i32 151, label %32
]
5: ; preds = %1
store i32 1, i32* %2
br label %34
6: ; preds = %1
store i32 2, i32* %2
br label %34
7: ; preds = %1
store i32 3, i32* %2
br label %34
8: ; preds = %1
store i32 4, i32* %2
br label %34
9: ; preds = %1
store i32 5, i32* %2
br label %34
10: ; preds = %1
store i32 6, i32* %2
br label %34
11: ; preds = %1
store i32 7, i32* %2
br label %34
12: ; preds = %1
store i32 8, i32* %2
br label %34
13: ; preds = %1
store i32 9, i32* %2
br label %34
14: ; preds = %1
store i32 10, i32* %2
br label %34
15: ; preds = %1
store i32 11, i32* %2
br label %34
16: ; preds = %1
store i32 12, i32* %2
br label %34
17: ; preds = %1
store i32 13, i32* %2
br label %34
18: ; preds = %1
store i32 14, i32* %2
br label %34
19: ; preds = %1
store i32 15, i32* %2
br label %34
20: ; preds = %1
store i32 16, i32* %2
br label %34
21: ; preds = %1
store i32 17, i32* %2
br label %34
22: ; preds = %1
store i32 18, i32* %2
br label %34
23: ; preds = %1
store i32 19, i32* %2
br label %34
24: ; preds = %1
store i32 20, i32* %2
br label %34
25: ; preds = %1
store i32 21, i32* %2
br label %34
26: ; preds = %1
store i32 22, i32* %2
br label %34
27: ; preds = %1
store i32 23, i32* %2
br label %34
28: ; preds = %1
store i32 24, i32* %2
br label %34
29: ; preds = %1
store i32 25, i32* %2
br label %34
30: ; preds = %1
store i32 26, i32* %2
br label %34
31: ; preds = %1
store i32 27, i32* %2
br label %34
32: ; preds = %1
store i32 28, i32* %2
br label %34
33: ; preds = %1
store i32 0, i32* %2
br label %34
34: ; preds = %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
@switch.table.tls1_ec_nid2curve_id = [28 x i32] [i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 25, i32 24, i32 22, i32 21, i32 20, i32 18, i32 17, i32 16, i32 15, i32 28, i32 27, i32 26, i32 23, i32 19]
define i32 @tls1_ec_nid2curve_id(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 28
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [28 x i32], [28 x i32]* @switch.table.tls1_ec_nid2curve_id, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}