#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  scalar_t__ sin_port;
  int /*<<< orphan*/ sin_family;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EINTR;
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ IPPROTO_ICMP;
int /*<<< orphan*/ SOCK_RAW;
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int get_icmp(int, unsigned char *, int, struct sockaddr_in *, int *);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int read(int, unsigned char *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ send_icmp(int, unsigned char *, int, struct sockaddr_in *,
                             int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(unsigned char *, char *, char *, char *, char *,
                           char *);
scalar_t__ system(unsigned char *);
int tun_open(unsigned char *);
int /*<<< orphan*/ write(int, unsigned char *, int);
int main() {
  unsigned char buff[4096];
  fd_set rset;
  struct sockaddr_in addr;
  struct sockaddr_in addr_recv;
  int sock;
  int ret;
  socklen_t len = sizeof(struct sockaddr_in);
  socklen_t len_recv = sizeof(struct sockaddr_in);
  unsigned char dev[] = "tun0";
  int tunfd;
  if ((tunfd = tun_open(dev)) < 0) {
    perror("error: tun_open");
    exit(1);
  }
  sprintf(buff, "%s %s %s pointopoint %s", "/sbin/ifconfig", "tun0",
          "10.95.1.2", "10.95.1.1");
  if (system(buff) < 0) {
    perror("error: fork");
    exit(1);
  }
  if ((sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0) {
    perror("error: socket\n");
    exit(1);
  }
  memset(&addr, 0, sizeof(struct sockaddr_in));
  addr.sin_family = AF_INET;
  addr.sin_port = 0;
  addr.sin_addr.s_addr = inet_addr("195.24.141.97");
  while (1) {
    FD_ZERO(&rset);
    FD_SET(sock, &rset);
    FD_SET(tunfd, &rset);
    while ((ret = select(sock + 1, &rset, NULL, NULL, NULL)) < 0 &&
           errno == EINTR)
      ;
    if (ret < 0) {
      perror("error: select");
      exit(1);
    }
    if (FD_ISSET(sock, &rset)) {
      if ((ret = get_icmp(sock, buff, sizeof(buff), &addr_recv, &len_recv)) >
          0) {
        write(tunfd, buff, ret);
      }
    }
    if (FD_ISSET(tunfd, &rset)) {
      ret = read(tunfd, buff, sizeof(buff));
      send_icmp(sock, buff, ret, &addr, len);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1070,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x18,-0x1054(%rbp)
movl   $0x18,-0x1058(%rbp)
mov    0xdd4(%rip),%eax
mov    %eax,-0x105d(%rbp)
mov    0xdcc(%rip),%al
mov    %al,-0x1059(%rbp)
lea    -0x105d(%rbp),%rdi
call   10d0 <tun_open@plt>
mov    %eax,-0x1064(%rbp)
cmp    $0x0,%eax
jge    126f <main+0x6f>
lea    0xda5(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x1010(%rbp),%rdi
lea    0xd98(%rip),%rsi
lea    0xda9(%rip),%rdx
lea    0xd75(%rip),%rcx
lea    0xdaa(%rip),%r8
lea    0xdad(%rip),%r9
call   10f0 <sprintf@plt>
lea    -0x1010(%rbp),%rdi
call   1060 <system@plt>
cmp    $0x0,%rax
jge    12ca <main+0xca>
lea    0xd95(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
mov    0x2d06(%rip),%rax
mov    (%rax),%esi
mov    0x2cf5(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x104c(%rbp)
cmp    $0x0,%eax
jge    130f <main+0x10f>
lea    0xd5c(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1020(%rbp)
movq   $0x0,-0x1028(%rbp)
lea    0xd28(%rip),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,-0x1030(%rbp)
lea    -0x1014(%rbp),%rdi
call   10b0 <FD_ZERO@plt>
mov    -0x104c(%rbp),%edi
lea    -0x1014(%rbp),%rsi
call   1110 <FD_SET@plt>
mov    -0x1064(%rbp),%edi
lea    -0x1014(%rbp),%rsi
call   1110 <FD_SET@plt>
mov    -0x104c(%rbp),%edi
add    $0x1,%edi
lea    -0x1014(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10c0 <select@plt>
mov    %eax,%ecx
mov    %ecx,-0x1050(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1065(%rbp)
jge    13d4 <main+0x1d4>
mov    0x2c0a(%rip),%rax
mov    (%rax),%rax
mov    0x2bf8(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1065(%rbp)
mov    -0x1065(%rbp),%al
test   $0x1,%al
jne    13e7 <main+0x1e7>
jmp    13ec <main+0x1ec>
jmp    137e <main+0x17e>
cmpl   $0x0,-0x1050(%rbp)
jge    140f <main+0x20f>
lea    0xc79(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x104c(%rbp),%edi
lea    -0x1014(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     147c <main+0x27c>
mov    -0x104c(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
lea    -0x1048(%rbp),%rcx
lea    -0x1058(%rbp),%r8
call   1070 <get_icmp@plt>
mov    %eax,-0x1050(%rbp)
cmp    $0x0,%eax
jle    1477 <main+0x277>
mov    -0x1064(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    -0x1050(%rbp),%edx
call   1040 <write@plt>
jmp    147c <main+0x27c>
mov    -0x1064(%rbp),%edi
lea    -0x1014(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     14db <main+0x2db>
mov    -0x1064(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
call   1090 <read@plt>
mov    %eax,-0x1050(%rbp)
mov    -0x104c(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    -0x1050(%rbp),%edx
mov    -0x1054(%rbp),%r8d
lea    -0x1030(%rbp),%rcx
call   1030 <send_icmp@plt>
jmp    134e <main+0x14e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1058,%rsp
movl   $0x18,0x18(%rsp)
movb   $0x0,0x10(%rsp)
movl   $0x306e7574,0xc(%rsp)
30
lea    0xc(%rsp),%rdi
call   10d0 <tun_open@plt>
test   %eax,%eax
jns    1240 <main+0x40>
lea    0xdc5(%rip),%rdi
jmp    13e7 <main+0x1e7>
mov    %eax,%r15d
lea    0xdc6(%rip),%rsi
lea    0xdd7(%rip),%rdx
lea    0xddf(%rip),%rcx
lea    0xddd(%rip),%r8
lea    0xde0(%rip),%r9
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
test   %rax,%rax
jns    128c <main+0x8c>
lea    0xdc9(%rip),%rdi
jmp    13e7 <main+0x1e7>
mov    0x2d55(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
mov    0x2d33(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
test   %eax,%eax
jns    12bc <main+0xbc>
lea    0xda5(%rip),%rdi
jmp    13e7 <main+0x1e7>
mov    %eax,%r12d
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    (%rbx),%eax
mov    %eax,0x30(%rsp)
movq   $0x0,0x28(%rsp)
lea    0xd85(%rip),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,0x20(%rsp)
mov    %r12d,%ebp
add    $0x1,%ebp
lea    0x1c(%rsp),%rbx
mov    0x2cc7(%rip),%r14
mov    0x2cb8(%rip),%r13
mov    %r15d,0x14(%rsp)
nopl   (%rax)
mov    %rbx,%rdi
call   10b0 <FD_ZERO@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1110 <FD_SET@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1110 <FD_SET@plt>
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10c0 <select@plt>
test   %eax,%eax
jns    134e <main+0x14e>
mov    0x0(%r13),%rcx
cmp    %rcx,(%r14)
je     1330 <main+0x130>
test   %eax,%eax
js     13e0 <main+0x1e0>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1395 <main+0x195>
mov    %r12d,%edi
lea    0x50(%rsp),%rsi
mov    $0x1000,%edx
lea    0x38(%rsp),%rcx
lea    0x18(%rsp),%r8
call   1070 <get_icmp@plt>
test   %eax,%eax
jle    1395 <main+0x195>
mov    %r15d,%edi
lea    0x50(%rsp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1310 <main+0x110>
mov    %r15d,%edi
lea    0x50(%rsp),%r15
mov    %r15,%rsi
mov    $0x1000,%edx
call   1090 <read@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    0x14(%rsp),%r15d
mov    %eax,%edx
lea    0x20(%rsp),%rcx
mov    $0x18,%r8d
call   1030 <send_icmp@plt>
jmp    1310 <main+0x110>
lea    0xc92(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i32 }
@__const.main.dev = [5 x i8] c"tun0\00"
@.str = [16 x i8] c"error: tun_open\00"
@.str.1 = [24 x i8] c"%s %s %s pointopoint %s\00"
@.str.2 = [15 x i8] c"/sbin/ifconfig\00"
@.str.3 = [5 x i8] c"tun0\00"
@.str.4 = [10 x i8] c"10.95.1.2\00"
@.str.5 = [10 x i8] c"10.95.1.1\00"
@.str.6 = [12 x i8] c"error: fork\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_ICMP = global i32 0
@.str.7 = [15 x i8] c"error: socket\0A\00"
@.str.8 = [14 x i8] c"195.24.141.97\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.9 = [14 x i8] c"error: select\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [5 x i8]
%11 = alloca i32
store i32 0, i32* %1
store i32 24, i32* %8
store i32 24, i32* %9
%12 = bitcast [5 x i8]* %10 to i8*
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%14 = call i32 @tun_open(i8* %13)
store i32 %14, i32* %11
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %0
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%23 = call i64 @system(i8* %22)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = load i32, i32* @AF_INET
%30 = load i32, i32* @SOCK_RAW
%31 = load i32, i32* @IPPROTO_ICMP
%32 = call i32 @socket(i32 %29, i32 %30, i32 %31)
store i32 %32, i32* %6
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %28
%38 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 24)
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %39, i32* %40
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i64 0, i64* %41
%42 = call i32 @inet_addr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%44 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %43, i32 0, i32 0
store i32 %42, i32* %44
br label %45
45: ; preds = %37, %97
%46 = call i32 @FD_ZERO(i32* %3)
%47 = load i32, i32* %6
%48 = call i32 @FD_SET(i32 %47, i32* %3)
%49 = load i32, i32* %11
%50 = call i32 @FD_SET(i32 %49, i32* %3)
br label %51
51: ; preds = %62, %45
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
%54 = call i32 @select(i32 %53, i32* %3, i32* null, i32* null, i32* null)
store i32 %54, i32* %7
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = load i64, i64* @errno
%58 = load i64, i64* @EINTR
%59 = icmp eq i64 %57, %58
br label %60
60: ; preds = %56, %51
%61 = phi i1 [ false, %51 ], [ %59, %56 ]
br i1 %61, label %62, label %63
62: ; preds = %60
br label %51
63: ; preds = %60
%64 = load i32, i32* %7
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %63
%70 = load i32, i32* %6
%71 = call i64 @FD_ISSET(i32 %70, i32* %3)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %84
73: ; preds = %69
%74 = load i32, i32* %6
%75 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%76 = call i32 @get_icmp(i32 %74, i8* %75, i32 4096, %struct.sockaddr_in* %5, i32* %9)
store i32 %76, i32* %7
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %83
78: ; preds = %73
%79 = load i32, i32* %11
%80 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%81 = load i32, i32* %7
%82 = call i32 @write(i32 %79, i8* %80, i32 %81)
br label %83
83: ; preds = %78, %73
br label %84
84: ; preds = %83, %69
%85 = load i32, i32* %11
%86 = call i64 @FD_ISSET(i32 %85, i32* %3)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %97
88: ; preds = %84
%89 = load i32, i32* %11
%90 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%91 = call i32 @read(i32 %89, i8* %90, i32 4096)
store i32 %91, i32* %7
%92 = load i32, i32* %6
%93 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%94 = load i32, i32* %7
%95 = load i32, i32* %8
%96 = call i32 @send_icmp(i32 %92, i8* %93, i32 %94, %struct.sockaddr_in* %4, i32 %95)
br label %97
97: ; preds = %88, %84
br label %45
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i32 }
@.str = [16 x i8] c"error: tun_open\00"
@.str.1 = [24 x i8] c"%s %s %s pointopoint %s\00"
@.str.2 = [15 x i8] c"/sbin/ifconfig\00"
@.str.3 = [5 x i8] c"tun0\00"
@.str.4 = [10 x i8] c"10.95.1.2\00"
@.str.5 = [10 x i8] c"10.95.1.1\00"
@.str.6 = [12 x i8] c"error: fork\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_ICMP = global i32 0
@.str.7 = [15 x i8] c"error: socket\0A\00"
@.str.8 = [14 x i8] c"195.24.141.97\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.9 = [14 x i8] c"error: select\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [5 x i8]
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%8 = bitcast i32* %2 to i8*
%9 = bitcast %struct.sockaddr_in* %3 to i8*
%10 = bitcast %struct.sockaddr_in* %4 to i8*
%11 = bitcast i32* %5 to i8*
store i32 24, i32* %5
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%13 = call i32 @tun_open(i8* %12)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%20 = call i64 @system(i8* %7)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %18
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_RAW
%28 = load i32, i32* @IPPROTO_ICMP
%29 = call i32 @socket(i32 %26, i32 %27, i32 %28)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %25
%35 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 24)
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %36, i32* %37
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i64 0, i64* %38
%39 = call i32 @inet_addr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %39, i32* %40
%41 = add nuw nsw i32 %29, 1
br label %42
42: ; preds = %71, %34
%43 = call i32 @FD_ZERO(i32* %2)
%44 = call i32 @FD_SET(i32 %29, i32* %2)
%45 = call i32 @FD_SET(i32 %13, i32* %2)
br label %46
46: ; preds = %46, %42
%47 = call i32 @select(i32 %41, i32* %2, i32* null, i32* null, i32* null)
%48 = icmp slt i32 %47, 0
%49 = load i64, i64* @errno
%50 = load i64, i64* @EINTR
%51 = icmp eq i64 %49, %50
%52 = select i1 %48, i1 %51, i1 false
br i1 %52, label %46, label %53
53: ; preds = %46
br i1 %48, label %54, label %57
54: ; preds = %53
%55 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %53
%58 = call i64 @FD_ISSET(i32 %29, i32* %2)
%59 = icmp eq i64 %58, 0
br i1 %59, label %65, label %60
60: ; preds = %57
%61 = call i32 @get_icmp(i32 %29, i8* %7, i32 4096, %struct.sockaddr_in* %4, i32* %5)
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @write(i32 %13, i8* %7, i32 %61)
br label %65
65: ; preds = %60, %63, %57
%66 = call i64 @FD_ISSET(i32 %13, i32* %2)
%67 = icmp eq i64 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = call i32 @read(i32 %13, i8* %7, i32 4096)
%70 = call i32 @send_icmp(i32 %29, i8* %7, i32 %69, %struct.sockaddr_in* %3, i32 24)
br label %71
71: ; preds = %68, %65
br label %42
}