#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 IPV6_2292DSTOPTS;
int IPV6_2292HOPLIMIT;
int IPV6_2292HOPOPTS;
int IPV6_2292PKTINFO;
int IPV6_2292PKTOPTIONS;
int IPV6_2292RTHDR;
int IPV6_CHECKSUM;
int IPV6_IPSEC_POLICY;
int IPV6_JOIN_GROUP;
int IPV6_LEAVE_GROUP;
int IPV6_MULTICAST_HOPS;
int IPV6_MULTICAST_IF;
int IPV6_MULTICAST_LOOP;
int IPV6_UNICAST_HOPS;
int IPV6_V6ONLY;
int darwin_convert_sockopt_ipv6_option(int opt) {
  if (opt == 2)
    return IPV6_2292PKTINFO;
  if (opt == 3)
    return IPV6_2292HOPOPTS;
  if (opt == 4)
    return IPV6_2292DSTOPTS;
  if (opt == 5)
    return IPV6_2292RTHDR;
  if (opt == 6)
    return IPV6_2292PKTOPTIONS;
  if (opt == 7)
    return IPV6_CHECKSUM;
  if (opt == 8)
    return IPV6_2292HOPLIMIT;
  if (opt == 16)
    return IPV6_UNICAST_HOPS;
  if (opt == 17)
    return IPV6_MULTICAST_IF;
  if (opt == 18)
    return IPV6_MULTICAST_HOPS;
  if (opt == 19)
    return IPV6_MULTICAST_LOOP;
  if (opt == 20)
    return IPV6_JOIN_GROUP;
  if (opt == 21)
    return IPV6_LEAVE_GROUP;
  if (opt == 26)
    return IPV6_V6ONLY;
  if (opt == 34)
    return IPV6_IPSEC_POLICY;
  return -1;
}


x86 assembly (clang, -O0):
<darwin_convert_sockopt_ipv6_option>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1122 <darwin_convert_sockopt_ipv6_option+0x22>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x3,-0x8(%rbp)
jne    113d <darwin_convert_sockopt_ipv6_option+0x3d>
mov    0x2e35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x4,-0x8(%rbp)
jne    1158 <darwin_convert_sockopt_ipv6_option+0x58>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x5,-0x8(%rbp)
jne    1173 <darwin_convert_sockopt_ipv6_option+0x73>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x6,-0x8(%rbp)
jne    118e <darwin_convert_sockopt_ipv6_option+0x8e>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x7,-0x8(%rbp)
jne    11a9 <darwin_convert_sockopt_ipv6_option+0xa9>
mov    0x2e41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x8,-0x8(%rbp)
jne    11c4 <darwin_convert_sockopt_ipv6_option+0xc4>
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x10,-0x8(%rbp)
jne    11df <darwin_convert_sockopt_ipv6_option+0xdf>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x11,-0x8(%rbp)
jne    11fa <darwin_convert_sockopt_ipv6_option+0xfa>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x12,-0x8(%rbp)
jne    1215 <darwin_convert_sockopt_ipv6_option+0x115>
mov    0x2d85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x13,-0x8(%rbp)
jne    1230 <darwin_convert_sockopt_ipv6_option+0x130>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x14,-0x8(%rbp)
jne    124b <darwin_convert_sockopt_ipv6_option+0x14b>
mov    0x2d37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x15,-0x8(%rbp)
jne    1266 <darwin_convert_sockopt_ipv6_option+0x166>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x1a,-0x8(%rbp)
jne    1281 <darwin_convert_sockopt_ipv6_option+0x181>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
cmpl   $0x22,-0x8(%rbp)
jne    129c <darwin_convert_sockopt_ipv6_option+0x19c>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a3 <darwin_convert_sockopt_ipv6_option+0x1a3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<darwin_convert_sockopt_ipv6_option>:
mov    $0xffffffff,%eax
add    $0xfffffffe,%edi
cmp    $0x20,%edi
ja     11a8 <darwin_convert_sockopt_ipv6_option+0xa8>
lea    0xee8(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x2e88(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e37(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e46(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e5d(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e84(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e8b(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e3a(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e59(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e20(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e7f(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2df6(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e3d(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e14(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2deb(%rip),%rax
jmp    11a6 <darwin_convert_sockopt_ipv6_option+0xa6>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@IPV6_2292PKTINFO = global i32 0
@IPV6_2292HOPOPTS = global i32 0
@IPV6_2292DSTOPTS = global i32 0
@IPV6_2292RTHDR = global i32 0
@IPV6_2292PKTOPTIONS = global i32 0
@IPV6_CHECKSUM = global i32 0
@IPV6_2292HOPLIMIT = global i32 0
@IPV6_UNICAST_HOPS = global i32 0
@IPV6_MULTICAST_IF = global i32 0
@IPV6_MULTICAST_HOPS = global i32 0
@IPV6_MULTICAST_LOOP = global i32 0
@IPV6_JOIN_GROUP = global i32 0
@IPV6_LEAVE_GROUP = global i32 0
@IPV6_V6ONLY = global i32 0
@IPV6_IPSEC_POLICY = global i32 0
define i32 @darwin_convert_sockopt_ipv6_option(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @IPV6_2292PKTINFO
store i32 %7, i32* %2
br label %79
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* @IPV6_2292HOPOPTS
store i32 %12, i32* %2
br label %79
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* @IPV6_2292DSTOPTS
store i32 %17, i32* %2
br label %79
18: ; preds = %13
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 5
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* @IPV6_2292RTHDR
store i32 %22, i32* %2
br label %79
23: ; preds = %18
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 6
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* @IPV6_2292PKTOPTIONS
store i32 %27, i32* %2
br label %79
28: ; preds = %23
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 7
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* @IPV6_CHECKSUM
store i32 %32, i32* %2
br label %79
33: ; preds = %28
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 8
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load i32, i32* @IPV6_2292HOPLIMIT
store i32 %37, i32* %2
br label %79
38: ; preds = %33
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 16
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* @IPV6_UNICAST_HOPS
store i32 %42, i32* %2
br label %79
43: ; preds = %38
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 17
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = load i32, i32* @IPV6_MULTICAST_IF
store i32 %47, i32* %2
br label %79
48: ; preds = %43
%49 = load i32, i32* %3
%50 = icmp eq i32 %49, 18
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = load i32, i32* @IPV6_MULTICAST_HOPS
store i32 %52, i32* %2
br label %79
53: ; preds = %48
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 19
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = load i32, i32* @IPV6_MULTICAST_LOOP
store i32 %57, i32* %2
br label %79
58: ; preds = %53
%59 = load i32, i32* %3
%60 = icmp eq i32 %59, 20
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = load i32, i32* @IPV6_JOIN_GROUP
store i32 %62, i32* %2
br label %79
63: ; preds = %58
%64 = load i32, i32* %3
%65 = icmp eq i32 %64, 21
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = load i32, i32* @IPV6_LEAVE_GROUP
store i32 %67, i32* %2
br label %79
68: ; preds = %63
%69 = load i32, i32* %3
%70 = icmp eq i32 %69, 26
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = load i32, i32* @IPV6_V6ONLY
store i32 %72, i32* %2
br label %79
73: ; preds = %68
%74 = load i32, i32* %3
%75 = icmp eq i32 %74, 34
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = load i32, i32* @IPV6_IPSEC_POLICY
store i32 %77, i32* %2
br label %79
78: ; preds = %73
store i32 -1, i32* %2
br label %79
79: ; preds = %78, %76, %71, %66, %61, %56, %51, %46, %41, %36, %31, %26, %21, %16, %11, %6
%80 = load i32, i32* %2
ret i32 %80
}

LLVM IR (-O2):
@IPV6_2292PKTINFO = global i32 0
@IPV6_2292HOPOPTS = global i32 0
@IPV6_2292DSTOPTS = global i32 0
@IPV6_2292RTHDR = global i32 0
@IPV6_2292PKTOPTIONS = global i32 0
@IPV6_CHECKSUM = global i32 0
@IPV6_2292HOPLIMIT = global i32 0
@IPV6_UNICAST_HOPS = global i32 0
@IPV6_MULTICAST_IF = global i32 0
@IPV6_MULTICAST_HOPS = global i32 0
@IPV6_MULTICAST_LOOP = global i32 0
@IPV6_JOIN_GROUP = global i32 0
@IPV6_LEAVE_GROUP = global i32 0
@IPV6_V6ONLY = global i32 0
@IPV6_IPSEC_POLICY = global i32 0
define i32 @darwin_convert_sockopt_ipv6_option(i32 %0) {
switch i32 %0, label %32 [
i32 2, label %2
i32 3, label %4
i32 4, label %6
i32 5, label %8
i32 6, label %10
i32 7, label %12
i32 8, label %14
i32 16, label %16
i32 17, label %18
i32 18, label %20
i32 19, label %22
i32 20, label %24
i32 21, label %26
i32 26, label %28
i32 34, label %30
]
2: ; preds = %1
%3 = load i32, i32* @IPV6_2292PKTINFO
br label %32
4: ; preds = %1
%5 = load i32, i32* @IPV6_2292HOPOPTS
br label %32
6: ; preds = %1
%7 = load i32, i32* @IPV6_2292DSTOPTS
br label %32
8: ; preds = %1
%9 = load i32, i32* @IPV6_2292RTHDR
br label %32
10: ; preds = %1
%11 = load i32, i32* @IPV6_2292PKTOPTIONS
br label %32
12: ; preds = %1
%13 = load i32, i32* @IPV6_CHECKSUM
br label %32
14: ; preds = %1
%15 = load i32, i32* @IPV6_2292HOPLIMIT
br label %32
16: ; preds = %1
%17 = load i32, i32* @IPV6_UNICAST_HOPS
br label %32
18: ; preds = %1
%19 = load i32, i32* @IPV6_MULTICAST_IF
br label %32
20: ; preds = %1
%21 = load i32, i32* @IPV6_MULTICAST_HOPS
br label %32
22: ; preds = %1
%23 = load i32, i32* @IPV6_MULTICAST_LOOP
br label %32
24: ; preds = %1
%25 = load i32, i32* @IPV6_JOIN_GROUP
br label %32
26: ; preds = %1
%27 = load i32, i32* @IPV6_LEAVE_GROUP
br label %32
28: ; preds = %1
%29 = load i32, i32* @IPV6_V6ONLY
br label %32
30: ; preds = %1
%31 = load i32, i32* @IPV6_IPSEC_POLICY
br label %32
32: ; preds = %1, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
%33 = 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 ], [ %27, %26 ], [ %29, %28 ], [ %31, %30 ], [ -1, %1 ]
ret i32 %33
}