#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 */
int SO_BROADCAST;
int SO_DEBUG;
int SO_DONTROUTE;
int SO_ERROR;
int SO_KEEPALIVE;
int SO_LINGER;
int SO_OOBINLINE;
int SO_RCVBUF;
int SO_REUSEADDR;
int SO_REUSEPORT;
int SO_SNDBUF;
int SO_TYPE;
int darwin_convert_sockopt_socket_option(int opt) {
  if (opt == 1)
    return SO_DEBUG;
  if (opt == 2)
    return SO_REUSEADDR;
  if (opt == 3)
    return SO_TYPE;
  if (opt == 4)
    return SO_ERROR;
  if (opt == 5)
    return SO_DONTROUTE;
  if (opt == 6)
    return SO_BROADCAST;
  if (opt == 7)
    return SO_SNDBUF;
  if (opt == 8)
    return SO_RCVBUF;
  if (opt == 9)
    return SO_KEEPALIVE;
  if (opt == 10)
    return SO_OOBINLINE;
  if (opt == 13)
    return SO_LINGER;
  if (opt == 15)
    return SO_REUSEPORT;
  return -1;
}


x86 assembly (clang, -O0):
<darwin_convert_sockopt_socket_option>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1122 <darwin_convert_sockopt_socket_option+0x22>
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x2,-0x8(%rbp)
jne    113d <darwin_convert_sockopt_socket_option+0x3d>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x3,-0x8(%rbp)
jne    1158 <darwin_convert_sockopt_socket_option+0x58>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x4,-0x8(%rbp)
jne    1173 <darwin_convert_sockopt_socket_option+0x73>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x5,-0x8(%rbp)
jne    118e <darwin_convert_sockopt_socket_option+0x8e>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x6,-0x8(%rbp)
jne    11a9 <darwin_convert_sockopt_socket_option+0xa9>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x7,-0x8(%rbp)
jne    11c4 <darwin_convert_sockopt_socket_option+0xc4>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x8,-0x8(%rbp)
jne    11df <darwin_convert_sockopt_socket_option+0xdf>
mov    0x2ddb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0x9,-0x8(%rbp)
jne    11fa <darwin_convert_sockopt_socket_option+0xfa>
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0xa,-0x8(%rbp)
jne    1215 <darwin_convert_sockopt_socket_option+0x115>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0xd,-0x8(%rbp)
jne    1230 <darwin_convert_sockopt_socket_option+0x130>
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
cmpl   $0xf,-0x8(%rbp)
jne    124b <darwin_convert_sockopt_socket_option+0x14b>
mov    0x2d97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_socket_option+0x152>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<darwin_convert_sockopt_socket_option>:
mov    $0xffffffff,%eax
add    $0xffffffff,%edi
cmp    $0xe,%edi
ja     1189 <darwin_convert_sockopt_socket_option+0x89>
lea    0xeec(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x2e9c(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e6b(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e9a(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e69(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e38(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e77(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e8e(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e4d(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e1c(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e2b(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e62(%rip),%rax
jmp    1187 <darwin_convert_sockopt_socket_option+0x87>
mov    0x2e51(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SO_DEBUG = global i32 0
@SO_REUSEADDR = global i32 0
@SO_TYPE = global i32 0
@SO_ERROR = global i32 0
@SO_DONTROUTE = global i32 0
@SO_BROADCAST = global i32 0
@SO_SNDBUF = global i32 0
@SO_RCVBUF = global i32 0
@SO_KEEPALIVE = global i32 0
@SO_OOBINLINE = global i32 0
@SO_LINGER = global i32 0
@SO_REUSEPORT = global i32 0
define i32 @darwin_convert_sockopt_socket_option(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @SO_DEBUG
store i32 %7, i32* %2
br label %64
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* @SO_REUSEADDR
store i32 %12, i32* %2
br label %64
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* @SO_TYPE
store i32 %17, i32* %2
br label %64
18: ; preds = %13
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* @SO_ERROR
store i32 %22, i32* %2
br label %64
23: ; preds = %18
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 5
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* @SO_DONTROUTE
store i32 %27, i32* %2
br label %64
28: ; preds = %23
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 6
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* @SO_BROADCAST
store i32 %32, i32* %2
br label %64
33: ; preds = %28
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 7
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load i32, i32* @SO_SNDBUF
store i32 %37, i32* %2
br label %64
38: ; preds = %33
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 8
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* @SO_RCVBUF
store i32 %42, i32* %2
br label %64
43: ; preds = %38
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 9
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = load i32, i32* @SO_KEEPALIVE
store i32 %47, i32* %2
br label %64
48: ; preds = %43
%49 = load i32, i32* %3
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = load i32, i32* @SO_OOBINLINE
store i32 %52, i32* %2
br label %64
53: ; preds = %48
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 13
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = load i32, i32* @SO_LINGER
store i32 %57, i32* %2
br label %64
58: ; preds = %53
%59 = load i32, i32* %3
%60 = icmp eq i32 %59, 15
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = load i32, i32* @SO_REUSEPORT
store i32 %62, i32* %2
br label %64
63: ; preds = %58
store i32 -1, i32* %2
br label %64
64: ; preds = %63, %61, %56, %51, %46, %41, %36, %31, %26, %21, %16, %11, %6
%65 = load i32, i32* %2
ret i32 %65
}

LLVM IR (-O2):
@SO_DEBUG = global i32 0
@SO_REUSEADDR = global i32 0
@SO_TYPE = global i32 0
@SO_ERROR = global i32 0
@SO_DONTROUTE = global i32 0
@SO_BROADCAST = global i32 0
@SO_SNDBUF = global i32 0
@SO_RCVBUF = global i32 0
@SO_KEEPALIVE = global i32 0
@SO_OOBINLINE = global i32 0
@SO_LINGER = global i32 0
@SO_REUSEPORT = global i32 0
define i32 @darwin_convert_sockopt_socket_option(i32 %0) {
switch i32 %0, label %26 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %10
i32 6, label %12
i32 7, label %14
i32 8, label %16
i32 9, label %18
i32 10, label %20
i32 13, label %22
i32 15, label %24
]
2: ; preds = %1
%3 = load i32, i32* @SO_DEBUG
br label %26
4: ; preds = %1
%5 = load i32, i32* @SO_REUSEADDR
br label %26
6: ; preds = %1
%7 = load i32, i32* @SO_TYPE
br label %26
8: ; preds = %1
%9 = load i32, i32* @SO_ERROR
br label %26
10: ; preds = %1
%11 = load i32, i32* @SO_DONTROUTE
br label %26
12: ; preds = %1
%13 = load i32, i32* @SO_BROADCAST
br label %26
14: ; preds = %1
%15 = load i32, i32* @SO_SNDBUF
br label %26
16: ; preds = %1
%17 = load i32, i32* @SO_RCVBUF
br label %26
18: ; preds = %1
%19 = load i32, i32* @SO_KEEPALIVE
br label %26
20: ; preds = %1
%21 = load i32, i32* @SO_OOBINLINE
br label %26
22: ; preds = %1
%23 = load i32, i32* @SO_LINGER
br label %26
24: ; preds = %1
%25 = load i32, i32* @SO_REUSEPORT
br label %26
26: ; preds = %1, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
%27 = phi i32 [ %3, %2 ], [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %17, %16 ], [ %19, %18 ], [ %21, %20 ], [ %23, %22 ], [ %25, %24 ], [ -1, %1 ]
ret i32 %27
}