#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 */
struct sockaddr_ll {
  int /*<<< orphan*/ sll_protocol;
  int /*<<< orphan*/ ifr_ifindex;
  int /*<<< orphan*/ sll_ifindex;
  int /*<<< orphan*/ sll_family;
  int /*<<< orphan*/ ifr_name;
};
struct sockaddr {
  int dummy;
};
struct ifreq {
  int /*<<< orphan*/ sll_protocol;
  int /*<<< orphan*/ ifr_ifindex;
  int /*<<< orphan*/ sll_ifindex;
  int /*<<< orphan*/ sll_family;
  int /*<<< orphan*/ ifr_name;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sll;
typedef int /*<<< orphan*/ ifr;
typedef int /*<<< orphan*/ err;

/* Variables and functions */
int /*<<< orphan*/ AF_PACKET;
int ENETDOWN;
int /*<<< orphan*/ ETH_P_ALL;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ERROR;
int bind(int, struct sockaddr *, int);
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int ioctl(int, int /*<<< orphan*/, struct sockaddr_ll *);
int /*<<< orphan*/ memset(struct sockaddr_ll *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
char *strerror(int);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char const *, int);
int bind2dev(int fd, const char *dev) {
  struct ifreq ifr;
  struct sockaddr_ll sll;
  int err;
  socklen_t errlen = sizeof(err);
  memset(&ifr, 0, sizeof(ifr));
  strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
  if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
    fprintf(stderr, "bind2dev ioctl error:%s\r\n", strerror(errno));
    return -2;
  }
  memset(&sll, 0, sizeof(sll));
  sll.sll_family = AF_PACKET;
  sll.sll_ifindex = ifr.ifr_ifindex;
  sll.sll_protocol = htons(ETH_P_ALL);
  if (bind(fd, (struct sockaddr *)&sll, sizeof(sll)) == -1) {
    if (errno == ENETDOWN) {
      fprintf(stderr, "interface '%s' is not up.\r\n", dev);
      return -3;
    } else {
      fprintf(stderr, "bind '%s' error: %s, not bind\r\n", dev,
              strerror(errno));
      return -4;
    }
  }
  if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
    fprintf(stderr, "getsockopt '%s' error: %s\r\n", dev, strerror(errno));
    return -5;
  }
  if (err == ENETDOWN) {
    fprintf(stderr, "interface '%s' is not up.\r\n", dev);
    return -3;
  } else if (err > 0) {
    fprintf(stderr, "bind '%s' error: %s\r\n", dev, strerror(err));
    return -4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bind2dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x48(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%edi
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1060 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1212 <bind2dev+0x92>
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rdx
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1040 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x14,%edx
call   1090 <bind@plt>
cmp    $0xffffffff,%eax
jne    12e4 <bind2dev+0x164>
mov    0x2d52(%rip),%rax
mov    (%rax),%eax
mov    0x2d71(%rip),%rcx
cmp    (%rcx),%eax
jne    129e <bind2dev+0x11e>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
mov    0x2d1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xd65(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
mov    -0x8(%rbp),%edi
mov    0x2cfa(%rip),%rax
mov    (%rax),%esi
mov    0x2cb9(%rip),%rax
mov    (%rax),%edx
lea    -0x44(%rbp),%rcx
lea    -0x48(%rbp),%r8
call   1070 <getsockopt@plt>
cmp    $0xffffffff,%eax
jne    1355 <bind2dev+0x1d5>
mov    0x2caa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd14(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffb,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
mov    -0x44(%rbp),%eax
mov    0x2c81(%rip),%rcx
cmp    (%rcx),%eax
jne    138e <bind2dev+0x20e>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xc9f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
cmpl   $0x0,-0x44(%rbp)
jle    13d8 <bind2dev+0x258>
mov    0x2c21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x44(%rbp),%edi
call   10a0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    13e4 <bind2dev+0x264>
jmp    13dd <bind2dev+0x25d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bind2dev>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
movl   $0x4,0x8(%rsp)
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    0x38(%rsp),%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1060 <ioctl@plt>
cmp    $0xffffffff,%eax
je     127a <bind2dev+0xfa>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2c(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1040 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x14,%edx
call   1090 <bind@plt>
cmp    $0xffffffff,%eax
je     12ae <bind2dev+0x12e>
mov    0x2db8(%rip),%rax
mov    (%rax),%esi
mov    0x2d77(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %ebp,%edi
call   1070 <getsockopt@plt>
cmp    $0xffffffff,%eax
je     12e5 <bind2dev+0x165>
mov    0xc(%rsp),%edi
mov    0x2d80(%rip),%rax
cmp    (%rax),%edi
jne    1319 <bind2dev+0x199>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xda2(%rip),%rsi
jmp    12d4 <bind2dev+0x154>
mov    0x2d3f(%rip),%rax
mov    (%rax),%ebx
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd68(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xfffffffe,%eax
jmp    135a <bind2dev+0x1da>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
mov    0x2d22(%rip),%rax
mov    0x2cfb(%rip),%rcx
mov    (%rcx),%ebp
cmp    (%rax),%edi
jne    1336 <bind2dev+0x1b6>
lea    0xd48(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xfffffffd,%eax
jmp    135a <bind2dev+0x1da>
mov    0x2cd4(%rip),%rax
mov    (%rax),%ebx
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd53(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xfffffffb,%eax
jmp    135a <bind2dev+0x1da>
test   %edi,%edi
jle    1358 <bind2dev+0x1d8>
mov    0x2c9c(%rip),%rax
mov    (%rax),%ebx
call   10a0 <strerror@plt>
lea    0xd40(%rip),%rsi
mov    %ebx,%edi
jmp    1344 <bind2dev+0x1c4>
call   10a0 <strerror@plt>
lea    0xcf4(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xfffffffc,%eax
jmp    135a <bind2dev+0x1da>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ifreq = type { i32, i32, i32, i32, i32 }
%struct.sockaddr_ll = type { i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@SIOCGIFINDEX = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"bind2dev ioctl error:%s\0D\0A\00"
@errno = global i32 0
@AF_PACKET = global i32 0
@ETH_P_ALL = global i32 0
@ENETDOWN = global i32 0
@.str.1 = [28 x i8] c"interface '%s' is not up.\0D\0A\00"
@.str.2 = [32 x i8] c"bind '%s' error: %s, not bind\0D\0A\00"
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
@.str.3 = [28 x i8] c"getsockopt '%s' error: %s\0D\0A\00"
@.str.4 = [22 x i8] c"bind '%s' error: %s\0D\0A\00"
define i32 @bind2dev(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.ifreq
%7 = alloca %struct.sockaddr_ll
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 4, i32* %9
%10 = bitcast %struct.ifreq* %6 to %struct.sockaddr_ll*
%11 = call i32 @memset(%struct.sockaddr_ll* %10, i32 0, i32 20)
%12 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 4
%13 = load i32, i32* %12
%14 = load i8*, i8** %5
%15 = call i32 @strncpy(i32 %13, i8* %14, i32 4)
%16 = load i32, i32* %4
%17 = load i32, i32* @SIOCGIFINDEX
%18 = bitcast %struct.ifreq* %6 to %struct.sockaddr_ll*
%19 = call i32 @ioctl(i32 %16, i32 %17, %struct.sockaddr_ll* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 -2, i32* %3
br label %85
26: ; preds = %2
%27 = call i32 @memset(%struct.sockaddr_ll* %7, i32 0, i32 20)
%28 = load i32, i32* @AF_PACKET
%29 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %7, i32 0, i32 3
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 1
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %7, i32 0, i32 2
store i32 %31, i32* %32
%33 = load i32, i32* @ETH_P_ALL
%34 = call i32 @htons(i32 %33)
%35 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %7, i32 0, i32 0
store i32 %34, i32* %35
%36 = load i32, i32* %4
%37 = bitcast %struct.sockaddr_ll* %7 to %struct.sockaddr*
%38 = call i32 @bind(i32 %36, %struct.sockaddr* %37, i32 20)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %54
40: ; preds = %26
%41 = load i32, i32* @errno
%42 = load i32, i32* @ENETDOWN
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %5
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %46)
store i32 -3, i32* %3
br label %85
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = load i8*, i8** %5
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %50, i8* %52)
store i32 -4, i32* %3
br label %85
54: ; preds = %26
%55 = load i32, i32* %4
%56 = load i32, i32* @SOL_SOCKET
%57 = load i32, i32* @SO_ERROR
%58 = call i32 @getsockopt(i32 %55, i32 %56, i32 %57, i32* %8, i32* %9)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %66
60: ; preds = %54
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %5
%63 = load i32, i32* @errno
%64 = call i8* @strerror(i32 %63)
%65 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %62, i8* %64)
store i32 -5, i32* %3
br label %85
66: ; preds = %54
%67 = load i32, i32* %8
%68 = load i32, i32* @ENETDOWN
%69 = icmp eq i32 %67, %68
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %5
%73 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %72)
store i32 -3, i32* %3
br label %85
74: ; preds = %66
%75 = load i32, i32* %8
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %74
%78 = load i32, i32* @stderr
%79 = load i8*, i8** %5
%80 = load i32, i32* %8
%81 = call i8* @strerror(i32 %80)
%82 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %79, i8* %81)
store i32 -4, i32* %3
br label %85
83: ; preds = %74
br label %84
84: ; preds = %83
store i32 0, i32* %3
br label %85
85: ; preds = %84, %77, %70, %60, %48, %44, %21
%86 = load i32, i32* %3
ret i32 %86
}

LLVM IR (-O2):
%struct.ifreq = type { i32, i32, i32, i32, i32 }
%struct.sockaddr_ll = type { i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@SIOCGIFINDEX = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"bind2dev ioctl error:%s\0D\0A\00"
@errno = global i32 0
@AF_PACKET = global i32 0
@ETH_P_ALL = global i32 0
@ENETDOWN = global i32 0
@.str.1 = [28 x i8] c"interface '%s' is not up.\0D\0A\00"
@.str.2 = [32 x i8] c"bind '%s' error: %s, not bind\0D\0A\00"
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
@.str.3 = [28 x i8] c"getsockopt '%s' error: %s\0D\0A\00"
@.str.4 = [22 x i8] c"bind '%s' error: %s\0D\0A\00"
define i32 @bind2dev(i32 %0, i8* %1) {
%3 = alloca %struct.ifreq
%4 = alloca %struct.sockaddr_ll
%5 = alloca i32
%6 = alloca i32
%7 = bitcast %struct.ifreq* %3 to i8*
%8 = bitcast %struct.sockaddr_ll* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
store i32 4, i32* %6
%11 = bitcast %struct.ifreq* %3 to %struct.sockaddr_ll*
%12 = call i32 @memset(%struct.sockaddr_ll* %11, i32 0, i32 20)
%13 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 4
%14 = load i32, i32* %13
%15 = call i32 @strncpy(i32 %14, i8* %1, i32 4)
%16 = load i32, i32* @SIOCGIFINDEX
%17 = call i32 @ioctl(i32 %0, i32 %16, %struct.sockaddr_ll* %11)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = call i8* @strerror(i32 %21)
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %70
24: ; preds = %2
%25 = call i32 @memset(%struct.sockaddr_ll* %4, i32 0, i32 20)
%26 = load i32, i32* @AF_PACKET
%27 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 3
store i32 %26, i32* %27
%28 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 1
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 2
store i32 %29, i32* %30
%31 = load i32, i32* @ETH_P_ALL
%32 = call i32 @htons(i32 %31)
%33 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 0
store i32 %32, i32* %33
%34 = bitcast %struct.sockaddr_ll* %4 to %struct.sockaddr*
%35 = call i32 @bind(i32 %0, %struct.sockaddr* %34, i32 20)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %47
37: ; preds = %24
%38 = load i32, i32* @errno
%39 = load i32, i32* @ENETDOWN
%40 = icmp eq i32 %38, %39
%41 = load i32, i32* @stderr
br i1 %40, label %42, label %44
42: ; preds = %37
%43 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %70
44: ; preds = %37
%45 = call i8* @strerror(i32 %38)
%46 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %45)
br label %70
47: ; preds = %24
%48 = load i32, i32* @SOL_SOCKET
%49 = load i32, i32* @SO_ERROR
%50 = call i32 @getsockopt(i32 %0, i32 %48, i32 %49, i32* %5, i32* %6)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = load i32, i32* @stderr
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %55)
br label %70
57: ; preds = %47
%58 = load i32, i32* %5
%59 = load i32, i32* @ENETDOWN
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %70
64: ; preds = %57
%65 = icmp sgt i32 %58, 0
br i1 %65, label %66, label %70
66: ; preds = %64
%67 = load i32, i32* @stderr
%68 = call i8* @strerror(i32 %58)
%69 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %68)
br label %70
70: ; preds = %64, %66, %61, %52, %44, %42, %19
%71 = phi i32 [ -2, %19 ], [ -3, %42 ], [ -4, %44 ], [ -5, %52 ], [ -3, %61 ], [ -4, %66 ], [ 0, %64 ]
ret i32 %71
}