#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 IP_ADD_MEMBERSHIP;
int IP_DROP_MEMBERSHIP;
int IP_HDRINCL;
int IP_IPSEC_POLICY;
int IP_MULTICAST_IF;
int IP_MULTICAST_LOOP;
int IP_MULTICAST_TTL;
int IP_OPTIONS;
int IP_RECVOPTS;
int IP_RETOPTS;
int IP_TOS;
int IP_TTL;
int darwin_convert_sockopt_ip_option(int opt) {
  if (opt == 1)
    return IP_TOS;
  if (opt == 2)
    return IP_TTL;
  if (opt == 3)
    return IP_HDRINCL;
  if (opt == 4)
    return IP_OPTIONS;
  if (opt == 6)
    return IP_RECVOPTS;
  if (opt == 7)
    return IP_RETOPTS;
  if (opt == 16)
    return IP_IPSEC_POLICY;
  if (opt == 32)
    return IP_MULTICAST_IF;
  if (opt == 33)
    return IP_MULTICAST_TTL;
  if (opt == 34)
    return IP_MULTICAST_LOOP;
  if (opt == 35)
    return IP_ADD_MEMBERSHIP;
  if (opt == 36)
    return IP_DROP_MEMBERSHIP;
  return -1;
}


x86 assembly (clang, -O0):
<darwin_convert_sockopt_ip_option>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1122 <darwin_convert_sockopt_ip_option+0x22>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x2,-0x8(%rbp)
jne    113d <darwin_convert_sockopt_ip_option+0x3d>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x3,-0x8(%rbp)
jne    1158 <darwin_convert_sockopt_ip_option+0x58>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x4,-0x8(%rbp)
jne    1173 <darwin_convert_sockopt_ip_option+0x73>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x6,-0x8(%rbp)
jne    118e <darwin_convert_sockopt_ip_option+0x8e>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x7,-0x8(%rbp)
jne    11a9 <darwin_convert_sockopt_ip_option+0xa9>
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x10,-0x8(%rbp)
jne    11c4 <darwin_convert_sockopt_ip_option+0xc4>
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x20,-0x8(%rbp)
jne    11df <darwin_convert_sockopt_ip_option+0xdf>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x21,-0x8(%rbp)
jne    11fa <darwin_convert_sockopt_ip_option+0xfa>
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x22,-0x8(%rbp)
jne    1215 <darwin_convert_sockopt_ip_option+0x115>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x23,-0x8(%rbp)
jne    1230 <darwin_convert_sockopt_ip_option+0x130>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
cmpl   $0x24,-0x8(%rbp)
jne    124b <darwin_convert_sockopt_ip_option+0x14b>
mov    0x2d5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <darwin_convert_sockopt_ip_option+0x152>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<darwin_convert_sockopt_ip_option>:
mov    $0xffffffff,%eax
add    $0xffffffff,%edi
cmp    $0x23,%edi
ja     1189 <darwin_convert_sockopt_ip_option+0x89>
lea    0xeec(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x2e94(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e53(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2eb2(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e89(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e50(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e37(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e7e(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e5d(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e3c(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e7b(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e52(%rip),%rax
jmp    1187 <darwin_convert_sockopt_ip_option+0x87>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@IP_TOS = global i32 0
@IP_TTL = global i32 0
@IP_HDRINCL = global i32 0
@IP_OPTIONS = global i32 0
@IP_RECVOPTS = global i32 0
@IP_RETOPTS = global i32 0
@IP_IPSEC_POLICY = global i32 0
@IP_MULTICAST_IF = global i32 0
@IP_MULTICAST_TTL = global i32 0
@IP_MULTICAST_LOOP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@IP_DROP_MEMBERSHIP = global i32 0
define i32 @darwin_convert_sockopt_ip_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* @IP_TOS
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* @IP_TTL
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* @IP_HDRINCL
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* @IP_OPTIONS
store i32 %22, i32* %2
br label %64
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* @IP_RECVOPTS
store i32 %27, i32* %2
br label %64
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* @IP_RETOPTS
store i32 %32, i32* %2
br label %64
33: ; preds = %28
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 16
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load i32, i32* @IP_IPSEC_POLICY
store i32 %37, i32* %2
br label %64
38: ; preds = %33
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 32
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* @IP_MULTICAST_IF
store i32 %42, i32* %2
br label %64
43: ; preds = %38
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 33
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = load i32, i32* @IP_MULTICAST_TTL
store i32 %47, i32* %2
br label %64
48: ; preds = %43
%49 = load i32, i32* %3
%50 = icmp eq i32 %49, 34
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = load i32, i32* @IP_MULTICAST_LOOP
store i32 %52, i32* %2
br label %64
53: ; preds = %48
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 35
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = load i32, i32* @IP_ADD_MEMBERSHIP
store i32 %57, i32* %2
br label %64
58: ; preds = %53
%59 = load i32, i32* %3
%60 = icmp eq i32 %59, 36
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = load i32, i32* @IP_DROP_MEMBERSHIP
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):
@IP_TOS = global i32 0
@IP_TTL = global i32 0
@IP_HDRINCL = global i32 0
@IP_OPTIONS = global i32 0
@IP_RECVOPTS = global i32 0
@IP_RETOPTS = global i32 0
@IP_IPSEC_POLICY = global i32 0
@IP_MULTICAST_IF = global i32 0
@IP_MULTICAST_TTL = global i32 0
@IP_MULTICAST_LOOP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@IP_DROP_MEMBERSHIP = global i32 0
define i32 @darwin_convert_sockopt_ip_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 6, label %10
i32 7, label %12
i32 16, label %14
i32 32, label %16
i32 33, label %18
i32 34, label %20
i32 35, label %22
i32 36, label %24
]
2: ; preds = %1
%3 = load i32, i32* @IP_TOS
br label %26
4: ; preds = %1
%5 = load i32, i32* @IP_TTL
br label %26
6: ; preds = %1
%7 = load i32, i32* @IP_HDRINCL
br label %26
8: ; preds = %1
%9 = load i32, i32* @IP_OPTIONS
br label %26
10: ; preds = %1
%11 = load i32, i32* @IP_RECVOPTS
br label %26
12: ; preds = %1
%13 = load i32, i32* @IP_RETOPTS
br label %26
14: ; preds = %1
%15 = load i32, i32* @IP_IPSEC_POLICY
br label %26
16: ; preds = %1
%17 = load i32, i32* @IP_MULTICAST_IF
br label %26
18: ; preds = %1
%19 = load i32, i32* @IP_MULTICAST_TTL
br label %26
20: ; preds = %1
%21 = load i32, i32* @IP_MULTICAST_LOOP
br label %26
22: ; preds = %1
%23 = load i32, i32* @IP_ADD_MEMBERSHIP
br label %26
24: ; preds = %1
%25 = load i32, i32* @IP_DROP_MEMBERSHIP
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
}