#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 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 ahcp_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, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
  if (rc < 0)
    perror("setsockopt(SO_REUSEADDR)");
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &zero, sizeof(zero));
  if (rc < 0)
    perror("setsockopt(IPV6_MULTICAST_LOOP)");
  rc = setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &one, sizeof(one));
  if (rc < 0)
    perror("setsockopt(IPV6_MULTICAST_HOPS)");
  rc = -1;
  errno = ENOSYS;
  if (rc < 0)
    perror("setsockopt(IPV6_TCLASS)");
  rc = fcntl(s, F_GETFD, 0);
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_SETFD, rc | FD_CLOEXEC);
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_GETFL, 0);
  if (rc < 0)
    goto fail;
  rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK));
  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):
<ahcp_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 <ahcp_socket+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    13dc <ahcp_socket+0x25c>
mov    -0x14(%rbp),%edi
mov    0x2e04(%rip),%rax
mov    (%rax),%esi
mov    0x2d83(%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    120f <ahcp_socket+0x8f>
lea    0xdf6(%rip),%rdi
call   1090 <perror@plt>
mov    -0x14(%rbp),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
mov    0x2dd6(%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    124c <ahcp_socket+0xcc>
lea    0xdd2(%rip),%rdi
call   1090 <perror@plt>
mov    -0x14(%rbp),%edi
mov    0x2d1a(%rip),%rax
mov    (%rax),%esi
mov    0x2d19(%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    1289 <ahcp_socket+0x109>
lea    0xdb5(%rip),%rdi
call   1090 <perror@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    0x2d31(%rip),%rax
mov    (%rax),%ecx
mov    0x2cf0(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x18(%rbp)
jge    12b8 <ahcp_socket+0x138>
lea    0xda6(%rip),%rdi
call   1090 <perror@plt>
mov    -0x14(%rbp),%edi
mov    0x2cc6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12dd <ahcp_socket+0x15d>
jmp    13b5 <ahcp_socket+0x235>
mov    -0x14(%rbp),%edi
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2ca5(%rip),%rax
or     (%rax),%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    130c <ahcp_socket+0x18c>
jmp    13b5 <ahcp_socket+0x235>
mov    -0x14(%rbp),%edi
mov    0x2c6a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1331 <ahcp_socket+0x1b1>
jmp    13b5 <ahcp_socket+0x235>
mov    -0x14(%rbp),%edi
mov    0x2c65(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2c89(%rip),%rax
or     (%rax),%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1360 <ahcp_socket+0x1e0>
jmp    13b5 <ahcp_socket+0x235>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2c41(%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    13aa <ahcp_socket+0x22a>
jmp    13b5 <ahcp_socket+0x235>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13dc <ahcp_socket+0x25c>
mov    0x2bd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x1c(%rbp),%ecx
mov    0x2bbd(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ahcp_socket>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
movl   $0x1,(%rsp)
movl   $0x0,0x4(%rsp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
jns    11cf <ahcp_socket+0x4f>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    0x2d87(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
jns    1203 <ahcp_socket+0x83>
lea    0xe02(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d66(%rip),%r15
mov    (%r15),%esi
mov    0x2de4(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
jns    1238 <ahcp_socket+0xb8>
lea    0xde6(%rip),%rdi
call   1090 <perror@plt>
mov    (%r15),%esi
mov    0x2d36(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
jns    1264 <ahcp_socket+0xe4>
lea    0xdda(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    0x2d1c(%rip),%r12
mov    %eax,(%r12)
lea    0xdda(%rip),%rdi
call   1090 <perror@plt>
mov    0x2cfd(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1339 <ahcp_socket+0x1b9>
mov    0x2d03(%rip),%rcx
mov    (%rcx),%esi
mov    0x2cea(%rip),%rcx
or     (%rcx),%eax
mov    %ebp,%edi
mov    %eax,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1339 <ahcp_socket+0x1b9>
mov    0x2cbc(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1339 <ahcp_socket+0x1b9>
mov    0x2cc6(%rip),%rcx
mov    (%rcx),%esi
mov    0x2ced(%rip),%rcx
or     (%rcx),%eax
mov    %ebp,%edi
mov    %eax,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
js     1339 <ahcp_socket+0x1b9>
lea    0x8(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2cab(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    %r14d,%edi
call   1050 <htons@plt>
mov    %eax,0x8(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x8,%edx
call   1080 <bind@plt>
test   %eax,%eax
js     1339 <ahcp_socket+0x1b9>
mov    %ebp,%ebx
jmp    11c0 <ahcp_socket+0x40>
mov    (%r12),%r14d
mov    %ebp,%edi
call   1070 <close@plt>
mov    %r14d,(%r12)
jmp    11c0 <ahcp_socket+0x40>

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [25 x i8] c"setsockopt(SO_REUSEADDR)\00"
@IPPROTO_IPV6 = global i32 0
@IPV6_MULTICAST_LOOP = global i32 0
@.str.1 = [32 x i8] c"setsockopt(IPV6_MULTICAST_LOOP)\00"
@IPV6_MULTICAST_HOPS = global i32 0
@.str.2 = [32 x i8] c"setsockopt(IPV6_MULTICAST_HOPS)\00"
@ENOSYS = global i32 0
@errno = global i32 0
@.str.3 = [24 x i8] c"setsockopt(IPV6_TCLASS)\00"
@F_GETFD = global i32 0
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@AF_INET6 = global i32 0
define i32 @ahcp_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 %104
17: ; preds = %1
%18 = load i32, i32* %5
%19 = load i32, i32* @SOL_SOCKET
%20 = load i32, i32* @SO_REUSEADDR
%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 %26
24: ; preds = %17
%25 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %17
%27 = load i32, i32* %5
%28 = load i32, i32* @IPPROTO_IPV6
%29 = load i32, i32* @IPV6_MULTICAST_LOOP
%30 = call i32 @setsockopt(i32 %27, i32 %28, i32 %29, i32* %9, i32 4)
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %26
%36 = load i32, i32* %5
%37 = load i32, i32* @IPPROTO_IPV6
%38 = load i32, i32* @IPV6_MULTICAST_HOPS
%39 = call i32 @setsockopt(i32 %36, i32 %37, i32 %38, i32* %8, i32 4)
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %35
store i32 -1, i32* %6
%45 = load i32, i32* @ENOSYS
store i32 %45, i32* @errno
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = load i32, i32* %5
%52 = load i32, i32* @F_GETFD
%53 = call i32 @fcntl(i32 %51, i32 %52, i32 0)
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 = %50
br label %99
57: ; preds = %50
%58 = load i32, i32* %5
%59 = load i32, i32* @F_SETFD
%60 = load i32, i32* %6
%61 = load i32, i32* @FD_CLOEXEC
%62 = or i32 %60, %61
%63 = call i32 @fcntl(i32 %58, i32 %59, i32 %62)
store i32 %63, i32* %6
%64 = load i32, i32* %6
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %57
br label %99
67: ; preds = %57
%68 = load i32, i32* %5
%69 = load i32, i32* @F_GETFL
%70 = call i32 @fcntl(i32 %68, i32 %69, i32 0)
store i32 %70, i32* %6
%71 = load i32, i32* %6
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %67
br label %99
74: ; preds = %67
%75 = load i32, i32* %5
%76 = load i32, i32* @F_SETFL
%77 = load i32, i32* %6
%78 = load i32, i32* @O_NONBLOCK
%79 = or i32 %77, %78
%80 = call i32 @fcntl(i32 %75, i32 %76, i32 %79)
store i32 %80, i32* %6
%81 = load i32, i32* %6
%82 = icmp slt i32 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %74
br label %99
84: ; preds = %74
%85 = call i32 @memset(%struct.sockaddr_in6* %4, i32 0, i32 8)
%86 = load i32, i32* @AF_INET6
%87 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i32 0, i32 1
store i32 %86, i32* %87
%88 = load i32, i32* %3
%89 = call i32 @htons(i32 %88)
%90 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i32 0, i32 0
store i32 %89, i32* %90
%91 = load i32, i32* %5
%92 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%93 = call i32 @bind(i32 %91, %struct.sockaddr* %92, i32 8)
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 = %84
br label %99
97: ; preds = %84
%98 = load i32, i32* %5
store i32 %98, i32* %2
br label %104
99: ; preds = %96, %83, %73, %66, %56
%100 = load i32, i32* @errno
store i32 %100, i32* %7
%101 = load i32, i32* %5
%102 = call i32 @close(i32 %101)
%103 = load i32, i32* %7
store i32 %103, i32* @errno
store i32 -1, i32* %2
br label %104
104: ; preds = %99, %97, %16
%105 = load i32, i32* %2
ret i32 %105
}

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