#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 */
typedef int u_int32_t;
typedef int /*<<< orphan*/ test_options;
typedef int socklen_t;
typedef int /*<<< orphan*/ new_options;

/* Variables and functions */
int IPOPT_EOL;
int IPOPT_NOP;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_OPTIONS;
int /*<<< orphan*/ err(int, char *, char const *);
int /*<<< orphan*/ errx(int, char *, char const *, ...);
scalar_t__ getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *,
                      int *);
int htonl(int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
void test_ip_options(int sock, const char *socktypename) {
  u_int32_t new_options, test_options[2];
  socklen_t len;
  len = sizeof(test_options);
  if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0)
    err(-1, "test_ip_options(%s): initial getsockopt()", socktypename);
  if (len != 0)
    errx(-1,
         "test_ip_options(%s): initial getsockopt() returned "
         "%d bytes",
         socktypename, len);
  new_options = htonl(IPOPT_EOL | (IPOPT_NOP << 8) | (IPOPT_NOP << 16) |
                      (IPOPT_NOP << 24));
  if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, &new_options,
                 sizeof(new_options)) < 0)
    err(-1, "test_ip_options(%s): setsockopt(NOP|NOP|NOP|EOL)", socktypename);
  test_options[0] = 0xc34e4212;
  test_options[1] = 0xc34e4212;
  len = sizeof(test_options);
  if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0)
    err(-1, "test_ip_options(%s): getsockopt() after set", socktypename);
  if (len != sizeof(new_options))
    errx(-1,
         "test_ip_options(%s): getsockopt() after set "
         "returned %d bytes of data",
         socktypename, len);
  if (test_options[0] == 0xc34e4212)
    errx(-1,
         "test_ip_options(%s): getsockopt() after set didn't "
         "return data",
         socktypename);
  if (new_options != test_options[0])
    errx(-1,
         "test_ip_options(%s): getsockopt() after set "
         "returned wrong options (%08x, %08x)",
         socktypename, new_options, test_options[0]);
  if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, NULL, 0) < 0)
    err(-1, "test_ip_options(%s): setsockopt() to reset", socktypename);
  test_options[0] = 0xc34e4212;
  test_options[1] = 0xc34e4212;
  len = sizeof(test_options);
  if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0)
    err(-1, "test_ip_options(%s): getsockopt() after reset", socktypename);
  if (len != 0)
    errx(-1,
         "test_ip_options(%s): getsockopt() after reset "
         "returned %d bytes",
         socktypename, len);
}


x86 assembly (clang, -O0):
<test_ip_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e70(%rip),%rax
mov    (%rax),%esi
mov    0x2e6f(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1060 <getsockopt@plt>
cmp    $0x0,%rax
jge    11a7 <test_ip_options+0x57>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xe5e(%rip),%rsi
call   1070 <err@plt>
cmpl   $0x0,-0x20(%rbp)
je     11cb <test_ip_options+0x7b>
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    $0xffffffff,%edi
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
shl    $0x8,%eax
or     %eax,%edi
mov    0x2def(%rip),%rax
mov    (%rax),%eax
shl    $0x10,%eax
or     %eax,%edi
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
shl    $0x18,%eax
or     %eax,%edi
call   1050 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
mov    0x2dcf(%rip),%rax
mov    (%rax),%edx
lea    -0x14(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1249 <test_ip_options+0xf9>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xe22(%rip),%rsi
call   1070 <err@plt>
movl   $0xc34e4212,-0x1c(%rbp)
movl   $0xc34e4212,-0x18(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2d78(%rip),%rax
mov    (%rax),%esi
mov    0x2d77(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1060 <getsockopt@plt>
cmp    $0x0,%rax
jge    129f <test_ip_options+0x14f>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xdfd(%rip),%rsi
call   1070 <err@plt>
movslq -0x20(%rbp),%rax
cmp    $0x4,%rax
je     12c7 <test_ip_options+0x177>
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    $0xffffffff,%edi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
cmpl   $0xc34e4212,-0x1c(%rbp)
jne    12eb <test_ip_options+0x19b>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1315 <test_ip_options+0x1c5>
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    $0xffffffff,%edi
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
mov    -0x4(%rbp),%edi
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
mov    0x2cc0(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1355 <test_ip_options+0x205>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xe48(%rip),%rsi
call   1070 <err@plt>
movl   $0xc34e4212,-0x1c(%rbp)
movl   $0xc34e4212,-0x18(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2c6c(%rip),%rax
mov    (%rax),%esi
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1060 <getsockopt@plt>
cmp    $0x0,%rax
jge    13ab <test_ip_options+0x25b>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%edi
lea    0xe1d(%rip),%rsi
call   1070 <err@plt>
cmpl   $0x0,-0x20(%rbp)
je     13cf <test_ip_options+0x27f>
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    $0xffffffff,%edi
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ip_options>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x8,(%rsp)
mov    0x2e71(%rip),%r14
mov    (%r14),%esi
mov    0x2e6f(%rip),%r15
mov    (%r15),%edx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1060 <getsockopt@plt>
test   %rax,%rax
jns    11a2 <test_ip_options+0x52>
lea    0xe6b(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
call   1070 <err@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
je     11bf <test_ip_options+0x6f>
lea    0xe7a(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
mov    0x2dfa(%rip),%rax
mov    0x2e0b(%rip),%rcx
mov    (%rcx),%edi
mov    %edi,%ecx
shl    $0x8,%ecx
or     (%rax),%ecx
mov    %edi,%eax
shl    $0x10,%eax
shl    $0x18,%edi
or     %eax,%edi
or     %ecx,%edi
call   1050 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    (%r14),%esi
mov    (%r15),%edx
lea    0xc(%rsp),%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
jns    121c <test_ip_options+0xcc>
lea    0xe57(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
call   1070 <err@plt>
movabs $0xc34e4212c34e4212,%r12
42 4e c3
mov    %r12,0x4(%rsp)
movl   $0x8,(%rsp)
mov    (%r14),%esi
mov    (%r15),%edx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
mov    %ebp,%edi
call   1060 <getsockopt@plt>
test   %rax,%rax
jns    1260 <test_ip_options+0x110>
lea    0xe44(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
call   1070 <err@plt>
mov    (%rsp),%ecx
cmp    $0x4,%ecx
je     127e <test_ip_options+0x12e>
lea    0xe54(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
mov    0x4(%rsp),%r8d
cmp    $0xc34e4212,%r8d
jne    12a7 <test_ip_options+0x157>
lea    0xe76(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
mov    0x4(%rsp),%r8d
mov    0xc(%rsp),%ecx
cmp    %r8d,%ecx
je     12c6 <test_ip_options+0x176>
lea    0xe91(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
mov    (%r14),%esi
mov    (%r15),%edx
mov    %ebp,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
jns    12f1 <test_ip_options+0x1a1>
lea    0xeb4(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
call   1070 <err@plt>
mov    %r12,0x4(%rsp)
movl   $0x8,(%rsp)
mov    (%r14),%esi
mov    (%r15),%edx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
mov    %ebp,%edi
call   1060 <getsockopt@plt>
test   %rax,%rax
jns    132b <test_ip_options+0x1db>
lea    0xea5(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
call   1070 <err@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
je     1348 <test_ip_options+0x1f8>
lea    0xeb8(%rip),%rsi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@IPPROTO_IP = global i32 0
@IP_OPTIONS = global i32 0
@.str = [42 x i8] c"test_ip_options(%s): initial getsockopt()\00"
@.str.1 = [60 x i8] c"test_ip_options(%s): initial getsockopt() returned %d bytes\00"
@IPOPT_EOL = global i32 0
@IPOPT_NOP = global i32 0
@.str.2 = [49 x i8] c"test_ip_options(%s): setsockopt(NOP|NOP|NOP|EOL)\00"
@.str.3 = [44 x i8] c"test_ip_options(%s): getsockopt() after set\00"
@.str.4 = [70 x i8] c"test_ip_options(%s): getsockopt() after set returned %d bytes of data\00"
@.str.5 = [63 x i8] c"test_ip_options(%s): getsockopt() after set didn't return data\00"
@.str.6 = [80 x i8] c"test_ip_options(%s): getsockopt() after set returned wrong options (%08x, %08x)\00"
@.str.7 = [43 x i8] c"test_ip_options(%s): setsockopt() to reset\00"
@.str.8 = [46 x i8] c"test_ip_options(%s): getsockopt() after reset\00"
@.str.9 = [64 x i8] c"test_ip_options(%s): getsockopt() after reset returned %d bytes\00"
define void @test_ip_options(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 8, i32* %7
%8 = load i32, i32* %3
%9 = load i32, i32* @IPPROTO_IP
%10 = load i32, i32* @IP_OPTIONS
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%12 = call i64 @getsockopt(i32 %8, i32 %9, i32 %10, i32* %11, i32* %7)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = call i32 @err(i32 -1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %2
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i8*, i8** %4
%22 = load i32, i32* %7
%23 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %22)
br label %24
24: ; preds = %20, %17
%25 = load i32, i32* @IPOPT_EOL
%26 = load i32, i32* @IPOPT_NOP
%27 = shl i32 %26, 8
%28 = or i32 %25, %27
%29 = load i32, i32* @IPOPT_NOP
%30 = shl i32 %29, 16
%31 = or i32 %28, %30
%32 = load i32, i32* @IPOPT_NOP
%33 = shl i32 %32, 24
%34 = or i32 %31, %33
%35 = call i32 @htonl(i32 %34)
store i32 %35, i32* %5
%36 = load i32, i32* %3
%37 = load i32, i32* @IPPROTO_IP
%38 = load i32, i32* @IP_OPTIONS
%39 = call i64 @setsockopt(i32 %36, i32 %37, i32 %38, i32* %5, i32 4)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %24
%42 = load i8*, i8** %4
%43 = call i32 @err(i32 -1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %41, %24
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 -1018281454, i32* %45
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 -1018281454, i32* %46
store i32 8, i32* %7
%47 = load i32, i32* %3
%48 = load i32, i32* @IPPROTO_IP
%49 = load i32, i32* @IP_OPTIONS
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%51 = call i64 @getsockopt(i32 %47, i32 %48, i32 %49, i32* %50, i32* %7)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %44
%54 = load i8*, i8** %4
%55 = call i32 @err(i32 -1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %53, %44
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = icmp ne i64 %58, 4
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i8*, i8** %4
%62 = load i32, i32* %7
%63 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0), i8* %61, i32 %62)
br label %64
64: ; preds = %60, %56
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%66 = load i32, i32* %65
%67 = icmp eq i32 %66, -1018281454
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load i8*, i8** %4
%70 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0), i8* %69)
br label %71
71: ; preds = %68, %64
%72 = load i32, i32* %5
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%74 = load i32, i32* %73
%75 = icmp ne i32 %72, %74
br i1 %75, label %76, label %82
76: ; preds = %71
%77 = load i8*, i8** %4
%78 = load i32, i32* %5
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0), i8* %77, i32 %78, i32 %80)
br label %82
82: ; preds = %76, %71
%83 = load i32, i32* %3
%84 = load i32, i32* @IPPROTO_IP
%85 = load i32, i32* @IP_OPTIONS
%86 = call i64 @setsockopt(i32 %83, i32 %84, i32 %85, i32* null, i32 0)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %82
%89 = load i8*, i8** %4
%90 = call i32 @err(i32 -1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %88, %82
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 -1018281454, i32* %92
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 -1018281454, i32* %93
store i32 8, i32* %7
%94 = load i32, i32* %3
%95 = load i32, i32* @IPPROTO_IP
%96 = load i32, i32* @IP_OPTIONS
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%98 = call i64 @getsockopt(i32 %94, i32 %95, i32 %96, i32* %97, i32* %7)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %91
%101 = load i8*, i8** %4
%102 = call i32 @err(i32 -1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i8* %101)
br label %103
103: ; preds = %100, %91
%104 = load i32, i32* %7
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %110
106: ; preds = %103
%107 = load i8*, i8** %4
%108 = load i32, i32* %7
%109 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.9, i64 0, i64 0), i8* %107, i32 %108)
br label %110
110: ; preds = %106, %103
ret void
}

LLVM IR (-O2):
@IPPROTO_IP = global i32 0
@IP_OPTIONS = global i32 0
@.str = [42 x i8] c"test_ip_options(%s): initial getsockopt()\00"
@.str.1 = [60 x i8] c"test_ip_options(%s): initial getsockopt() returned %d bytes\00"
@IPOPT_EOL = global i32 0
@IPOPT_NOP = global i32 0
@.str.2 = [49 x i8] c"test_ip_options(%s): setsockopt(NOP|NOP|NOP|EOL)\00"
@.str.3 = [44 x i8] c"test_ip_options(%s): getsockopt() after set\00"
@.str.4 = [70 x i8] c"test_ip_options(%s): getsockopt() after set returned %d bytes of data\00"
@.str.5 = [63 x i8] c"test_ip_options(%s): getsockopt() after set didn't return data\00"
@.str.6 = [80 x i8] c"test_ip_options(%s): getsockopt() after set returned wrong options (%08x, %08x)\00"
@.str.7 = [43 x i8] c"test_ip_options(%s): setsockopt() to reset\00"
@.str.8 = [46 x i8] c"test_ip_options(%s): getsockopt() after reset\00"
@.str.9 = [64 x i8] c"test_ip_options(%s): getsockopt() after reset returned %d bytes\00"
define void @test_ip_options(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast [2 x i32]* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 8, i32* %5
%9 = load i32, i32* @IPPROTO_IP
%10 = load i32, i32* @IP_OPTIONS
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%12 = call i64 @getsockopt(i32 %0, i32 %9, i32 %10, i32* %11, i32* %5)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @err(i32 -1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %16
16: ; preds = %14, %2
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %17)
br label %21
21: ; preds = %19, %16
%22 = load i32, i32* @IPOPT_EOL
%23 = load i32, i32* @IPOPT_NOP
%24 = shl i32 %23, 8
%25 = or i32 %24, %22
%26 = shl i32 %23, 16
%27 = or i32 %25, %26
%28 = shl i32 %23, 24
%29 = or i32 %27, %28
%30 = call i32 @htonl(i32 %29)
store i32 %30, i32* %3
%31 = load i32, i32* @IPPROTO_IP
%32 = load i32, i32* @IP_OPTIONS
%33 = call i64 @setsockopt(i32 %0, i32 %31, i32 %32, i32* %3, i32 4)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %21
%36 = call i32 @err(i32 -1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %37
37: ; preds = %35, %21
store i32 -1018281454, i32* %11
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 -1018281454, i32* %38
store i32 8, i32* %5
%39 = load i32, i32* @IPPROTO_IP
%40 = load i32, i32* @IP_OPTIONS
%41 = call i64 @getsockopt(i32 %0, i32 %39, i32 %40, i32* %11, i32* %5)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = call i32 @err(i32 -1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %45
45: ; preds = %43, %37
%46 = load i32, i32* %5
%47 = icmp eq i32 %46, 4
br i1 %47, label %50, label %48
48: ; preds = %45
%49 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %46)
br label %50
50: ; preds = %48, %45
%51 = load i32, i32* %11
%52 = icmp eq i32 %51, -1018281454
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%55 = load i32, i32* %11
br label %56
56: ; preds = %53, %50
%57 = phi i32 [ %55, %53 ], [ %51, %50 ]
%58 = load i32, i32* %3
%59 = icmp eq i32 %58, %57
br i1 %59, label %62, label %60
60: ; preds = %56
%61 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0), i8* %1, i32 %58, i32 %57)
br label %62
62: ; preds = %60, %56
%63 = load i32, i32* @IPPROTO_IP
%64 = load i32, i32* @IP_OPTIONS
%65 = call i64 @setsockopt(i32 %0, i32 %63, i32 %64, i32* null, i32 0)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @err(i32 -1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %1)
br label %69
69: ; preds = %67, %62
store i32 -1018281454, i32* %11
store i32 -1018281454, i32* %38
store i32 8, i32* %5
%70 = load i32, i32* @IPPROTO_IP
%71 = load i32, i32* @IP_OPTIONS
%72 = call i64 @getsockopt(i32 %0, i32 %70, i32 %71, i32* %11, i32* %5)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = call i32 @err(i32 -1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i8* %1)
br label %76
76: ; preds = %74, %69
%77 = load i32, i32* %5
%78 = icmp eq i32 %77, 0
br i1 %78, label %81, label %79
79: ; preds = %76
%80 = call i32 (i32, i8*, i8*, ...) @errx(i32 -1, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.9, i64 0, i64 0), i8* %1, i32 %77)
br label %81
81: ; preds = %79, %76
ret void
}