#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_can {
  int /*<<< orphan*/ can_ifindex;
  int /*<<< orphan*/ can_family;
};
struct sockaddr {
  int dummy;
};
struct ifreq {
  int /*<<< orphan*/ ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ CAN_RAW;
int /*<<< orphan*/ PF_CAN;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SOCK_RAW;
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  int s[800];
  struct sockaddr_can addr;
  struct ifreq ifr;
  int i, numsock;
  if (argc != 2) {
    fprintf(stderr,
            "Error: Wrong number of arguments. Try %s <number of created "
            "sockets>.\n",
            argv[0]);
    exit(1);
  }
  numsock = atoi(argv[1]);
  if (numsock >= 800) {
    fprintf(stderr,
            "Error: more than %d sockets to open (see #define MAX_RAW).\n",
            800);
    exit(1);
  }
  printf("\ncreating %d raw sockets ... ", numsock);
  if (numsock) {
    for (i = 0; i < numsock; i++) {
      if ((s[i] = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
        perror("socket");
        return 1;
      }
      addr.can_family = PF_CAN;
      strcpy(ifr.ifr_name, "vcan2");
      ioctl(s[i], SIOCGIFINDEX, &ifr);
      addr.can_ifindex = ifr.ifr_ifindex;
      if (bind(s[i], (struct sockaddr *)&addr, sizeof(addr)) < 0) {
        perror("connect");
        return 1;
      }
    }
  }
  printf("done.\n");
  printf("Waiting for keyboard input ...");
  getchar();
  printf("closing %d raw sockets ... ", numsock);
  if (numsock)
    for (i = 0; i < numsock; i++)
      close(s[i]);
  printf("done.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xcb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11fb <main+0x4b>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0xca8(%rbp)
cmpl   $0x320,-0xca8(%rbp)
jl     1244 <main+0x94>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
mov    $0x320,%edx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0xca8(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0xca8(%rbp)
je     137f <main+0x1cf>
movl   $0x0,-0xca4(%rbp)
mov    -0xca4(%rbp),%eax
cmp    -0xca8(%rbp),%eax
jge    137a <main+0x1ca>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
movslq -0xca4(%rbp),%rcx
mov    %eax,-0xc90(%rbp,%rcx,4)
cmp    $0x0,%eax
jge    12d0 <main+0x120>
lea    0xde2(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1420 <main+0x270>
mov    0x2cf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc94(%rbp)
mov    -0xc9c(%rbp),%edi
lea    0xdbc(%rip),%rsi
call   1030 <strcpy@plt>
movslq -0xca4(%rbp),%rax
mov    -0xc90(%rbp,%rax,4),%edi
mov    0x2cb2(%rip),%rax
mov    (%rax),%esi
lea    -0xca0(%rbp),%rdx
call   1050 <ioctl@plt>
mov    -0xca0(%rbp),%eax
mov    %eax,-0xc98(%rbp)
movslq -0xca4(%rbp),%rax
mov    -0xc90(%rbp,%rax,4),%edi
lea    -0xc98(%rbp),%rsi
mov    $0x8,%edx
call   1090 <bind@plt>
cmp    $0x0,%rax
jge    1361 <main+0x1b1>
lea    0xd5e(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1420 <main+0x270>
jmp    1366 <main+0x1b6>
mov    -0xca4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xca4(%rbp)
jmp    126f <main+0xbf>
jmp    137f <main+0x1cf>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    -0xca8(%rbp),%esi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0xca8(%rbp)
je     140b <main+0x25b>
movl   $0x0,-0xca4(%rbp)
mov    -0xca4(%rbp),%eax
cmp    -0xca8(%rbp),%eax
jge    1406 <main+0x256>
movslq -0xca4(%rbp),%rax
mov    -0xc90(%rbp,%rax,4),%edi
call   1060 <close@plt>
mov    -0xca4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xca4(%rbp)
jmp    13cd <main+0x21d>
jmp    140b <main+0x25b>
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xcb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xca8,%rsp
cmp    $0x2,%edi
jne    139d <main+0x1dd>
mov    0x8(%rsi),%rdi
call   10c0 <atoi@plt>
cmp    $0x320,%eax
jge    13c1 <main+0x201>
mov    %eax,%ebx
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
je     1304 <main+0x144>
jle    1330 <main+0x170>
mov    %ebx,0xc(%rsp)
mov    %ebx,%ebx
xor    %r14d,%r14d
mov    0x2db2(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x18(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
mov    0x2d85(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
mov    %eax,0x20(%rsp,%r14,4)
test   %eax,%eax
js     1381 <main+0x1c1>
mov    %eax,%ebp
mov    (%r15),%eax
mov    %eax,0x1c(%rsp)
mov    0x14(%rsp),%edi
lea    0xe3d(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r12,%rdx
call   1060 <ioctl@plt>
mov    0x10(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x8,%edx
call   10a0 <bind@plt>
test   %rax,%rax
js     138a <main+0x1ca>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1230 <main+0x70>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xe01(%rip),%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
jle    1361 <main+0x1a1>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp,%rbp,4),%edi
call   1070 <close@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <main+0x130>
jmp    1361 <main+0x1a1>
lea    0xde6(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xda9(%rip),%rdi
xor    %esi,%esi
jmp    135a <main+0x19a>
lea    0xdba(%rip),%rdi
call   1040 <puts@plt>
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xd7d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd8f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xca8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd19(%rip),%rdi
jmp    1391 <main+0x1d1>
lea    0xd1d(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%eax
jmp    136f <main+0x1af>
mov    0x2c34(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xc50(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
lea    0xc76(%rip),%rsi
mov    $0x320,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_can = type { i32, i32 }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [71 x i8] c"Error: Wrong number of arguments. Try %s <number of created sockets>.\0A\00"
@.str.1 = [60 x i8] c"Error: more than %d sockets to open (see #define MAX_RAW).\0A\00"
@.str.2 = [30 x i8] c"\0Acreating %d raw sockets ... \00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [6 x i8] c"vcan2\00"
@SIOCGIFINDEX = global i32 0
@.str.5 = [8 x i8] c"connect\00"
@.str.6 = [7 x i8] c"done.\0A\00"
@.str.7 = [31 x i8] c"Waiting for keyboard input ...\00"
@.str.8 = [28 x i8] c"closing %d raw sockets ... \00"
@.str.9 = [8 x i8] c"done.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [800 x i32]
%7 = alloca %struct.sockaddr_can
%8 = alloca %struct.ifreq
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = icmp sge i32 %25, 800
br i1 %26, label %27, label %31
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 800)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %20
%32 = load i32, i32* %10
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %10
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %81
36: ; preds = %31
store i32 0, i32* %9
br label %37
37: ; preds = %77, %36
%38 = load i32, i32* %9
%39 = load i32, i32* %10
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %80
41: ; preds = %37
%42 = load i32, i32* @PF_CAN
%43 = load i32, i32* @SOCK_RAW
%44 = load i32, i32* @CAN_RAW
%45 = call i32 @socket(i32 %42, i32 %43, i32 %44)
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [800 x i32], [800 x i32]* %6, i64 0, i64 %47
store i32 %45, i32* %48
%49 = icmp slt i32 %45, 0
br i1 %49, label %50, label %52
50: ; preds = %41
%51 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %106
52: ; preds = %41
%53 = load i32, i32* @PF_CAN
%54 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 1
store i32 %53, i32* %54
%55 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 1
%56 = load i32, i32* %55
%57 = call i32 @strcpy(i32 %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [800 x i32], [800 x i32]* %6, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = load i32, i32* @SIOCGIFINDEX
%63 = call i32 @ioctl(i32 %61, i32 %62, %struct.ifreq* %8)
%64 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %8, i32 0, i32 0
%65 = load i32, i32* %64
%66 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 0
store i32 %65, i32* %66
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [800 x i32], [800 x i32]* %6, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = bitcast %struct.sockaddr_can* %7 to %struct.sockaddr*
%72 = call i64 @bind(i32 %70, %struct.sockaddr* %71, i32 8)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %52
%75 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %106
76: ; preds = %52
br label %77
77: ; preds = %76
%78 = load i32, i32* %9
%79 = add nsw i32 %78, 1
store i32 %79, i32* %9
br label %37
80: ; preds = %37
br label %81
81: ; preds = %80, %31
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%84 = call i32 (...) @getchar()
%85 = load i32, i32* %10
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %10
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %104
89: ; preds = %81
store i32 0, i32* %9
br label %90
90: ; preds = %100, %89
%91 = load i32, i32* %9
%92 = load i32, i32* %10
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %103
94: ; preds = %90
%95 = load i32, i32* %9
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [800 x i32], [800 x i32]* %6, i64 0, i64 %96
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
br label %100
100: ; preds = %94
%101 = load i32, i32* %9
%102 = add nsw i32 %101, 1
store i32 %102, i32* %9
br label %90
103: ; preds = %90
br label %104
104: ; preds = %103, %81
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %106
106: ; preds = %104, %74, %50
%107 = load i32, i32* %3
ret i32 %107
}

LLVM IR (-O2):
%struct.sockaddr_can = type { i32, i32 }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [71 x i8] c"Error: Wrong number of arguments. Try %s <number of created sockets>.\0A\00"
@.str.1 = [60 x i8] c"Error: more than %d sockets to open (see #define MAX_RAW).\0A\00"
@.str.2 = [30 x i8] c"\0Acreating %d raw sockets ... \00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [6 x i8] c"vcan2\00"
@SIOCGIFINDEX = global i32 0
@.str.5 = [8 x i8] c"connect\00"
@.str.7 = [31 x i8] c"Waiting for keyboard input ...\00"
@.str.8 = [28 x i8] c"closing %d raw sockets ... \00"
@str = [6 x i8] c"done.\00"
@str.10 = [7 x i8] c"done.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [800 x i32]
%4 = alloca %struct.sockaddr_can
%5 = alloca %struct.ifreq
%6 = bitcast [800 x i32]* %3 to i8*
%7 = bitcast %struct.sockaddr_can* %4 to i8*
%8 = bitcast %struct.ifreq* %5 to i8*
%9 = icmp eq i32 %0, 2
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = icmp sgt i32 %18, 799
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 800)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %15
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%26 = icmp eq i32 %18, 0
br i1 %26, label %74, label %27
27: ; preds = %24
%28 = icmp sgt i32 %18, 0
br i1 %28, label %29, label %79
29: ; preds = %27
%30 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %4, i64 0, i32 1
%31 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %5, i64 0, i32 1
%32 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %5, i64 0, i32 0
%33 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %4, i64 0, i32 0
%34 = bitcast %struct.sockaddr_can* %4 to %struct.sockaddr*
%35 = zext i32 %18 to i64
br label %38
36: ; preds = %48
%37 = icmp eq i64 %57, %35
br i1 %37, label %60, label %38
38: ; preds = %29, %36
%39 = phi i64 [ 0, %29 ], [ %57, %36 ]
%40 = load i32, i32* @PF_CAN
%41 = load i32, i32* @SOCK_RAW
%42 = load i32, i32* @CAN_RAW
%43 = call i32 @socket(i32 %40, i32 %41, i32 %42)
%44 = getelementptr inbounds [800 x i32], [800 x i32]* %3, i64 0, i64 %39
store i32 %43, i32* %44
%45 = icmp slt i32 %43, 0
br i1 %45, label %46, label %48
46: ; preds = %38
%47 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %86
48: ; preds = %38
%49 = load i32, i32* @PF_CAN
store i32 %49, i32* %30
%50 = load i32, i32* %31
%51 = call i32 @strcpy(i32 %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* @SIOCGIFINDEX
%53 = call i32 @ioctl(i32 %43, i32 %52, %struct.ifreq* %5)
%54 = load i32, i32* %32
store i32 %54, i32* %33
%55 = call i64 @bind(i32 %43, %struct.sockaddr* %34, i32 8)
%56 = icmp slt i64 %55, 0
%57 = add nuw nsw i64 %39, 1
br i1 %56, label %58, label %36
58: ; preds = %48
%59 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %86
60: ; preds = %36
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%63 = call i32 (...) @getchar()
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %18)
br i1 %28, label %65, label %84
65: ; preds = %60
%66 = zext i32 %18 to i64
br label %67
67: ; preds = %65, %67
%68 = phi i64 [ 0, %65 ], [ %72, %67 ]
%69 = getelementptr inbounds [800 x i32], [800 x i32]* %3, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = call i32 @close(i32 %70)
%72 = add nuw nsw i64 %68, 1
%73 = icmp eq i64 %72, %66
br i1 %73, label %84, label %67
74: ; preds = %24
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%77 = tail call i32 (...) @getchar()
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 0)
br label %84
79: ; preds = %27
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%82 = call i32 (...) @getchar()
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %18)
br label %84
84: ; preds = %67, %79, %74, %60
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
br label %86
86: ; preds = %84, %58, %46
%87 = phi i32 [ 1, %46 ], [ 1, %58 ], [ 0, %84 ]
ret i32 %87
}