#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 /*<<< orphan*/ zero;
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_port;
  int /*<<< orphan*/ sin6_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ sin6;
typedef int /*<<< orphan*/ one;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int ENOSYS;
int FD_CLOEXEC;
int /*<<< orphan*/ F_GETFD;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFD;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ IPPROTO_IPV6;
int /*<<< orphan*/ IPV6_MULTICAST_HOPS;
int /*<<< orphan*/ IPV6_MULTICAST_LOOP;
int /*<<< orphan*/ IPV6_UNICAST_HOPS;
int /*<<< orphan*/ IPV6_V6ONLY;
int O_NONBLOCK;
int /*<<< orphan*/ PF_INET6;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int errno;
int fcntl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(struct sockaddr_in6 *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int babel_socket(int port) {
  struct sockaddr_in6 sin6;
  int s, rc;
  int saved_errno;
  int one = 1, zero = 0;
  const int ds = 0xc0;
  s = socket(PF_INET6, SOCK_DGRAM, 0);
  if (s < 0)
    return -1;
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
  if (rc < 0)
    goto fail;
  rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
  if (rc < 0)
    goto fail;
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &zero, sizeof(zero));
  if (rc < 0)
    goto fail;
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &one, sizeof(one));
  if (rc < 0)
    goto fail;
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &one, sizeof(one));
  if (rc < 0)
    goto fail;
  rc = -1;
  errno = ENOSYS;
  if (rc < 0)
    perror("Couldn't set traffic class");
  rc = fcntl(s, F_GETFL, 0);
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK));
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_GETFD, 0);
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_SETFD, rc | FD_CLOEXEC);
  if (rc < 0)
    goto fail;
  memset(&sin6, 0, sizeof(sin6));
  sin6.sin6_family = AF_INET6;
  sin6.sin6_port = htons(port);
  rc = bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
  if (rc < 0)
    goto fail;
  return s;
fail:
  saved_errno = errno;
  close(s);
  errno = saved_errno;
  return -1;
}


x86 assembly (clang, -O0):
<babel_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0xc0,-0x28(%rbp)
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11d2 <babel_socket+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    1433 <babel_socket+0x2b3>
mov    -0x14(%rbp),%edi
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
mov    0x2dab(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1208 <babel_socket+0x88>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
mov    0x2d3d(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    123e <babel_socket+0xbe>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
lea    -0x24(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1274 <babel_socket+0xf4>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
mov    0x2d29(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12aa <babel_socket+0x12a>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2cac(%rip),%rax
mov    (%rax),%esi
mov    0x2cab(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12e0 <babel_socket+0x160>
jmp    140c <babel_socket+0x28c>
movl   $0xffffffff,-0x18(%rbp)
mov    0x2cda(%rip),%rax
mov    (%rax),%ecx
mov    0x2c89(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x18(%rbp)
jge    130f <babel_socket+0x18f>
lea    0xcf6(%rip),%rdi
call   1090 <perror@plt>
mov    -0x14(%rbp),%edi
mov    0x2c57(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1334 <babel_socket+0x1b4>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2c5a(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2c86(%rip),%rax
or     (%rax),%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1363 <babel_socket+0x1e3>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2c0b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1388 <babel_socket+0x208>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%edi
mov    0x2c0e(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2bea(%rip),%rax
or     (%rax),%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13b7 <babel_socket+0x237>
jmp    140c <babel_socket+0x28c>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2bea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1080 <bind@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1401 <babel_socket+0x281>
jmp    140c <babel_socket+0x28c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1433 <babel_socket+0x2b3>
mov    0x2b6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x1c(%rbp),%ecx
mov    0x2b56(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<babel_socket>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
movl   $0x1,0x8(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    $0xffffffff,%r12d
test   %eax,%eax
js     129a <babel_socket+0x11a>
mov    %eax,%r13d
mov    0x2d8e(%rip),%rbx
mov    (%rbx),%esi
mov    0x2db5(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
mov    0x2d50(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    (%rbx),%esi
mov    0x2dce(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    (%rbx),%esi
mov    0x2d64(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    (%rbx),%esi
mov    0x2cfa(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
jns    12ac <babel_socket+0x12c>
mov    0x2cf2(%rip),%rbx
mov    (%rbx),%ebp
mov    %r13d,%edi
call   1070 <close@plt>
mov    %ebp,(%rbx)
mov    %r12d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    0x2cc4(%rip),%rcx
mov    %eax,(%rcx)
lea    0xd3b(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    0x2cb0(%rip),%rcx
mov    (%rcx),%esi
mov    0x2cdf(%rip),%rcx
or     (%rcx),%eax
mov    %r13d,%edi
mov    %eax,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    0x2c70(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    0x2c7d(%rip),%rcx
mov    (%rcx),%esi
mov    0x2c5c(%rip),%rcx
or     (%rcx),%eax
mov    %r13d,%edi
mov    %eax,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2c5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    %r14d,%edi
call   1050 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r13d,%edi
mov    %r15,%rsi
mov    $0x8,%edx
call   1080 <bind@plt>
test   %eax,%eax
js     1287 <babel_socket+0x107>
mov    %r13d,%r12d
jmp    129a <babel_socket+0x11a>

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@IPV6_MULTICAST_LOOP = global i32 0
@IPV6_UNICAST_HOPS = global i32 0
@IPV6_MULTICAST_HOPS = global i32 0
@ENOSYS = global i32 0
@errno = global i32 0
@.str = [27 x i8] c"Couldn't set traffic class\00"
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_GETFD = global i32 0
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
@AF_INET6 = global i32 0
define i32 @babel_socket(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in6
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %8
store i32 0, i32* %9
store i32 192, i32* %10
%11 = load i32, i32* @PF_INET6
%12 = load i32, i32* @SOCK_DGRAM
%13 = call i32 @socket(i32 %11, i32 %12, i32 0)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 -1, i32* %2
br label %117
17: ; preds = %1
%18 = load i32, i32* %5
%19 = load i32, i32* @IPPROTO_IPV6
%20 = load i32, i32* @IPV6_V6ONLY
%21 = call i32 @setsockopt(i32 %18, i32 %19, i32 %20, i32* %8, i32 4)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17
br label %112
25: ; preds = %17
%26 = load i32, i32* %5
%27 = load i32, i32* @SOL_SOCKET
%28 = load i32, i32* @SO_REUSEADDR
%29 = call i32 @setsockopt(i32 %26, i32 %27, i32 %28, i32* %8, i32 4)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %25
br label %112
33: ; preds = %25
%34 = load i32, i32* %5
%35 = load i32, i32* @IPPROTO_IPV6
%36 = load i32, i32* @IPV6_MULTICAST_LOOP
%37 = call i32 @setsockopt(i32 %34, i32 %35, i32 %36, i32* %9, i32 4)
store i32 %37, i32* %6
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %33
br label %112
41: ; preds = %33
%42 = load i32, i32* %5
%43 = load i32, i32* @IPPROTO_IPV6
%44 = load i32, i32* @IPV6_UNICAST_HOPS
%45 = call i32 @setsockopt(i32 %42, i32 %43, i32 %44, i32* %8, i32 4)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %41
br label %112
49: ; preds = %41
%50 = load i32, i32* %5
%51 = load i32, i32* @IPPROTO_IPV6
%52 = load i32, i32* @IPV6_MULTICAST_HOPS
%53 = call i32 @setsockopt(i32 %50, i32 %51, i32 %52, i32* %8, i32 4)
store i32 %53, i32* %6
%54 = load i32, i32* %6
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %49
br label %112
57: ; preds = %49
store i32 -1, i32* %6
%58 = load i32, i32* @ENOSYS
store i32 %58, i32* @errno
%59 = load i32, i32* %6
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %63
63: ; preds = %61, %57
%64 = load i32, i32* %5
%65 = load i32, i32* @F_GETFL
%66 = call i32 @fcntl(i32 %64, i32 %65, i32 0)
store i32 %66, i32* %6
%67 = load i32, i32* %6
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %63
br label %112
70: ; preds = %63
%71 = load i32, i32* %5
%72 = load i32, i32* @F_SETFL
%73 = load i32, i32* %6
%74 = load i32, i32* @O_NONBLOCK
%75 = or i32 %73, %74
%76 = call i32 @fcntl(i32 %71, i32 %72, i32 %75)
store i32 %76, i32* %6
%77 = load i32, i32* %6
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %70
br label %112
80: ; preds = %70
%81 = load i32, i32* %5
%82 = load i32, i32* @F_GETFD
%83 = call i32 @fcntl(i32 %81, i32 %82, i32 0)
store i32 %83, i32* %6
%84 = load i32, i32* %6
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %80
br label %112
87: ; preds = %80
%88 = load i32, i32* %5
%89 = load i32, i32* @F_SETFD
%90 = load i32, i32* %6
%91 = load i32, i32* @FD_CLOEXEC
%92 = or i32 %90, %91
%93 = call i32 @fcntl(i32 %88, i32 %89, i32 %92)
store i32 %93, i32* %6
%94 = load i32, i32* %6
%95 = icmp slt i32 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %87
br label %112
97: ; preds = %87
%98 = call i32 @memset(%struct.sockaddr_in6* %4, i32 0, i32 8)
%99 = load i32, i32* @AF_INET6
%100 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i32 0, i32 1
store i32 %99, i32* %100
%101 = load i32, i32* %3
%102 = call i32 @htons(i32 %101)
%103 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i32 0, i32 0
store i32 %102, i32* %103
%104 = load i32, i32* %5
%105 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%106 = call i32 @bind(i32 %104, %struct.sockaddr* %105, i32 8)
store i32 %106, i32* %6
%107 = load i32, i32* %6
%108 = icmp slt i32 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %97
br label %112
110: ; preds = %97
%111 = load i32, i32* %5
store i32 %111, i32* %2
br label %117
112: ; preds = %109, %96, %86, %79, %69, %56, %48, %40, %32, %24
%113 = load i32, i32* @errno
store i32 %113, i32* %7
%114 = load i32, i32* %5
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* %7
store i32 %116, i32* @errno
store i32 -1, i32* %2
br label %117
117: ; preds = %112, %110, %16
%118 = load i32, i32* %2
ret i32 %118
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@IPV6_MULTICAST_LOOP = global i32 0
@IPV6_UNICAST_HOPS = global i32 0
@IPV6_MULTICAST_HOPS = global i32 0
@ENOSYS = global i32 0
@errno = global i32 0
@.str = [27 x i8] c"Couldn't set traffic class\00"
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_GETFD = global i32 0
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
@AF_INET6 = global i32 0
define i32 @babel_socket(i32 %0) {
%2 = alloca %struct.sockaddr_in6
%3 = alloca i32
%4 = alloca i32
%5 = bitcast %struct.sockaddr_in6* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = load i32, i32* @PF_INET6
%9 = load i32, i32* @SOCK_DGRAM
%10 = tail call i32 @socket(i32 %8, i32 %9, i32 0)
%11 = icmp slt i32 %10, 0
br i1 %11, label %71, label %12
12: ; preds = %1
%13 = load i32, i32* @IPPROTO_IPV6
%14 = load i32, i32* @IPV6_V6ONLY
%15 = call i32 @setsockopt(i32 %10, i32 %13, i32 %14, i32* %3, i32 4)
%16 = icmp slt i32 %15, 0
br i1 %16, label %68, label %17
17: ; preds = %12
%18 = load i32, i32* @SOL_SOCKET
%19 = load i32, i32* @SO_REUSEADDR
%20 = call i32 @setsockopt(i32 %10, i32 %18, i32 %19, i32* %3, i32 4)
%21 = icmp slt i32 %20, 0
br i1 %21, label %68, label %22
22: ; preds = %17
%23 = load i32, i32* @IPPROTO_IPV6
%24 = load i32, i32* @IPV6_MULTICAST_LOOP
%25 = call i32 @setsockopt(i32 %10, i32 %23, i32 %24, i32* %4, i32 4)
%26 = icmp slt i32 %25, 0
br i1 %26, label %68, label %27
27: ; preds = %22
%28 = load i32, i32* @IPPROTO_IPV6
%29 = load i32, i32* @IPV6_UNICAST_HOPS
%30 = call i32 @setsockopt(i32 %10, i32 %28, i32 %29, i32* %3, i32 4)
%31 = icmp slt i32 %30, 0
br i1 %31, label %68, label %32
32: ; preds = %27
%33 = load i32, i32* @IPPROTO_IPV6
%34 = load i32, i32* @IPV6_MULTICAST_HOPS
%35 = call i32 @setsockopt(i32 %10, i32 %33, i32 %34, i32* %3, i32 4)
%36 = icmp slt i32 %35, 0
br i1 %36, label %68, label %37
37: ; preds = %32
%38 = load i32, i32* @ENOSYS
store i32 %38, i32* @errno
%39 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%40 = load i32, i32* @F_GETFL
%41 = call i32 @fcntl(i32 %10, i32 %40, i32 0)
%42 = icmp slt i32 %41, 0
br i1 %42, label %68, label %43
43: ; preds = %37
%44 = load i32, i32* @F_SETFL
%45 = load i32, i32* @O_NONBLOCK
%46 = or i32 %45, %41
%47 = call i32 @fcntl(i32 %10, i32 %44, i32 %46)
%48 = icmp slt i32 %47, 0
br i1 %48, label %68, label %49
49: ; preds = %43
%50 = load i32, i32* @F_GETFD
%51 = call i32 @fcntl(i32 %10, i32 %50, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %68, label %53
53: ; preds = %49
%54 = load i32, i32* @F_SETFD
%55 = load i32, i32* @FD_CLOEXEC
%56 = or i32 %55, %51
%57 = call i32 @fcntl(i32 %10, i32 %54, i32 %56)
%58 = icmp slt i32 %57, 0
br i1 %58, label %68, label %59
59: ; preds = %53
%60 = call i32 @memset(%struct.sockaddr_in6* %2, i32 0, i32 8)
%61 = load i32, i32* @AF_INET6
%62 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %2, i64 0, i32 1
store i32 %61, i32* %62
%63 = call i32 @htons(i32 %0)
%64 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %2, i64 0, i32 0
store i32 %63, i32* %64
%65 = bitcast %struct.sockaddr_in6* %2 to %struct.sockaddr*
%66 = call i32 @bind(i32 %10, %struct.sockaddr* %65, i32 8)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %59, %53, %49, %43, %37, %32, %27, %22, %17, %12
%69 = load i32, i32* @errno
%70 = call i32 @close(i32 %10)
store i32 %69, i32* @errno
br label %71
71: ; preds = %59, %1, %68
%72 = phi i32 [ -1, %68 ], [ -1, %1 ], [ %10, %59 ]
ret i32 %72
}