#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;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct iphdr {
  int /*<<< orphan*/ saddr;
};
struct icmphdr {
  int checksum;
  scalar_t__ type;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ IPPROTO_ICMP;
int O_NONBLOCK;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_RAW;
int checksum(unsigned short *, int);
int fcntl(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int sendto(int, struct icmphdr *, int, int /*<<< orphan*/, struct sockaddr *,
           int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int sockfd;
  int flags;
  char in_buf[1024];
  char out_buf[64];
  unsigned int out_size;
  int nbytes;
  struct iphdr *ip;
  struct icmphdr *icmp;
  char *data;
  struct sockaddr_in addr;
  printf("icmpsh - master\n");
  sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
  if (sockfd == -1) {
    perror("socket");
    return -1;
  }
  flags = fcntl(0, F_GETFL, 0);
  flags |= O_NONBLOCK;
  fcntl(0, F_SETFL, flags);
  printf("running...\n");
  while (1) {
    memset(in_buf, 0x00, 1024);
    nbytes = read(sockfd, in_buf, 1024 - 1);
    if (nbytes > 0) {
      ip = (struct iphdr *)in_buf;
      if (nbytes > sizeof(struct iphdr)) {
        nbytes -= sizeof(struct iphdr);
        icmp = (struct icmphdr *)(ip + 1);
        if (nbytes > sizeof(struct icmphdr)) {
          nbytes -= sizeof(struct icmphdr);
          data = (char *)(icmp + 1);
          data[nbytes] = '\0';
          printf("%s", data);
          fflush(stdout);
        }
        icmp->type = 0;
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = ip->saddr;
        nbytes = read(0, out_buf, 64);
        if (nbytes > -1) {
          memcpy((char *)(icmp + 1), out_buf, nbytes);
          out_size = nbytes;
        } else {
          out_size = 0;
        }
        icmp->checksum = 0x00;
        icmp->checksum =
            checksum((unsigned short *)icmp, sizeof(struct icmphdr) + out_size);
        nbytes = sendto(sockfd, icmp, sizeof(struct icmphdr) + out_size, 0,
                        (struct sockaddr *)&addr, sizeof(addr));
        if (nbytes == -1) {
          perror("sendto");
          return -1;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    120c <main+0x6c>
lea    0xe16(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1455 <main+0x2b5>
mov    0x2da5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %edx,%edi
call   1030 <fcntl@plt>
mov    %eax,-0x18(%rbp)
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d89(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
xor    %edi,%edi
call   1030 <fcntl@plt>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x3ff,%edx
call   1080 <read@plt>
mov    %eax,-0x468(%rbp)
cmpl   $0x0,-0x468(%rbp)
jle    1450 <main+0x2b0>
lea    -0x420(%rbp),%rax
mov    %rax,-0x470(%rbp)
movslq -0x468(%rbp),%rax
cmp    $0x4,%rax
jbe    144b <main+0x2ab>
movslq -0x468(%rbp),%rax
sub    $0x4,%rax
mov    %eax,-0x468(%rbp)
mov    -0x470(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x478(%rbp)
movslq -0x468(%rbp),%rax
cmp    $0x10,%rax
jbe    1336 <main+0x196>
movslq -0x468(%rbp),%rax
sub    $0x10,%rax
mov    %eax,-0x468(%rbp)
mov    -0x478(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x480(%rbp)
mov    -0x480(%rbp),%rax
movslq -0x468(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x480(%rbp),%rsi
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    -0x478(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    0x2c9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x484(%rbp)
mov    -0x470(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x488(%rbp)
lea    -0x460(%rbp),%rsi
xor    %edi,%edi
mov    $0x40,%edx
call   1080 <read@plt>
mov    %eax,-0x468(%rbp)
cmpl   $0xffffffff,-0x468(%rbp)
jle    13b7 <main+0x217>
mov    -0x478(%rbp),%rdi
add    $0x10,%rdi
lea    -0x460(%rbp),%rsi
mov    -0x468(%rbp),%edx
call   1090 <memcpy@plt>
mov    -0x468(%rbp),%eax
mov    %eax,-0x464(%rbp)
jmp    13c1 <main+0x221>
movl   $0x0,-0x464(%rbp)
mov    -0x478(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x478(%rbp),%rdi
mov    -0x464(%rbp),%eax
add    $0x10,%rax
mov    %eax,%esi
call   1050 <checksum@plt>
mov    %eax,%ecx
mov    -0x478(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%edi
mov    -0x478(%rbp),%rsi
mov    -0x464(%rbp),%eax
add    $0x10,%rax
mov    %eax,%edx
lea    -0x488(%rbp),%r8
xor    %ecx,%ecx
mov    $0x8,%r9d
call   1070 <sendto@plt>
mov    %eax,-0x468(%rbp)
cmpl   $0xffffffff,-0x468(%rbp)
jne    1446 <main+0x2a6>
lea    0xbf2(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1455 <main+0x2b5>
jmp    144b <main+0x2ab>
jmp    1450 <main+0x2b0>
jmp    1251 <main+0xb1>
mov    -0x4(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
mov    0x2dfb(%rip),%rax
mov    (%rax),%esi
mov    0x2dea(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
cmp    $0xffffffff,%eax
jne    11fe <main+0x4e>
lea    0xe07(%rip),%rdi
jmp    133b <main+0x18b>
mov    %eax,%ebx
mov    0x2db1(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    0x2dc7(%rip),%rcx
or     (%rcx),%eax
mov    0x2d9e(%rip),%rcx
mov    (%rcx),%esi
xor    %edi,%edi
mov    %eax,%edx
call   1040 <fcntl@plt>
lea    0xded(%rip),%rdi
call   1030 <puts@plt>
lea    0x54(%rsp),%r14
lea    0x50(%rsp),%r12
lea    0x10(%rsp),%rbp
jmp    128e <main+0xde>
nopw   0x0(%rax,%rax,1)
movl   $0x0,0x54(%rsp)
add    $0x10,%r13d
mov    %r14,%rdi
mov    %r13d,%esi
call   1060 <checksum@plt>
mov    %eax,0x54(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
lea    0x8(%rsp),%r8
mov    $0x8,%r9d
call   1080 <sendto@plt>
cmp    $0xffffffff,%eax
je     1334 <main+0x184>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x3ff,%edx
call   1090 <read@plt>
cmp    $0x5,%eax
jl     128e <main+0xde>
lea    -0x15(%rax),%ecx
cmp    $0xffffffee,%ecx
ja     12e2 <main+0x132>
add    $0xffffffec,%eax
movb   $0x0,0x64(%rsp,%rax,1)
lea    0xd3f(%rip),%rdi
lea    0x64(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
movq   $0x0,0x5c(%rsp)
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x50(%rsp),%eax
mov    %eax,0x8(%rsp)
xor    %r13d,%r13d
xor    %edi,%edi
mov    %rbp,%rsi
mov    $0x40,%edx
call   1090 <read@plt>
test   %eax,%eax
js     1250 <main+0xa0>
mov    %eax,%r15d
lea    0x64(%rsp),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   10a0 <memcpy@plt>
mov    %r15d,%r13d
jmp    1250 <main+0xa0>
lea    0xccf(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xffffffff,%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.iphdr = type { i32 }
%struct.icmphdr = type { i32, i64 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [17 x i8] c"icmpsh - master\0A\00"
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_ICMP = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.2 = [12 x i8] c"running...\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@stdout = global i32 0
@AF_INET = global i32 0
@.str.4 = [7 x i8] c"sendto\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca [64 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.iphdr*
%13 = alloca %struct.icmphdr*
%14 = alloca i8*
%15 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @PF_INET
%18 = load i32, i32* @SOCK_RAW
%19 = load i32, i32* @IPPROTO_ICMP
%20 = call i32 @socket(i32 %17, i32 %18, i32 %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %126
25: ; preds = %2
%26 = load i32, i32* @F_GETFL
%27 = call i32 @fcntl(i32 0, i32 %26, i32 0)
store i32 %27, i32* %7
%28 = load i32, i32* @O_NONBLOCK
%29 = load i32, i32* %7
%30 = or i32 %29, %28
store i32 %30, i32* %7
%31 = load i32, i32* @F_SETFL
%32 = load i32, i32* %7
%33 = call i32 @fcntl(i32 0, i32 %31, i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %25, %125
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%37 = call i32 @memset(i8* %36, i32 0, i32 1024)
%38 = load i32, i32* %6
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%40 = call i32 @read(i32 %38, i8* %39, i32 1023)
store i32 %40, i32* %11
%41 = load i32, i32* %11
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %125
43: ; preds = %35
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%45 = bitcast i8* %44 to %struct.iphdr*
store %struct.iphdr* %45, %struct.iphdr** %12
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = icmp ugt i64 %47, 4
br i1 %48, label %49, label %124
49: ; preds = %43
%50 = load i32, i32* %11
%51 = sext i32 %50 to i64
%52 = sub i64 %51, 4
%53 = trunc i64 %52 to i32
store i32 %53, i32* %11
%54 = load %struct.iphdr*, %struct.iphdr** %12
%55 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %54, i64 1
%56 = bitcast %struct.iphdr* %55 to %struct.icmphdr*
store %struct.icmphdr* %56, %struct.icmphdr** %13
%57 = load i32, i32* %11
%58 = sext i32 %57 to i64
%59 = icmp ugt i64 %58, 16
br i1 %59, label %60, label %76
60: ; preds = %49
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = sub i64 %62, 16
%64 = trunc i64 %63 to i32
store i32 %64, i32* %11
%65 = load %struct.icmphdr*, %struct.icmphdr** %13
%66 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %65, i64 1
%67 = bitcast %struct.icmphdr* %66 to i8*
store i8* %67, i8** %14
%68 = load i8*, i8** %14
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8 0, i8* %71
%72 = load i8*, i8** %14
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %72)
%74 = load i32, i32* @stdout
%75 = call i32 @fflush(i32 %74)
br label %76
76: ; preds = %60, %49
%77 = load %struct.icmphdr*, %struct.icmphdr** %13
%78 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %77, i32 0, i32 1
store i64 0, i64* %78
%79 = load i32, i32* @AF_INET
%80 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 1
store i32 %79, i32* %80
%81 = load %struct.iphdr*, %struct.iphdr** %12
%82 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %81, i32 0, i32 0
%83 = load i32, i32* %82
%84 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 0
%85 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %84, i32 0, i32 0
store i32 %83, i32* %85
%86 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%87 = call i32 @read(i32 0, i8* %86, i32 64)
store i32 %87, i32* %11
%88 = load i32, i32* %11
%89 = icmp sgt i32 %88, -1
br i1 %89, label %90, label %98
90: ; preds = %76
%91 = load %struct.icmphdr*, %struct.icmphdr** %13
%92 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %91, i64 1
%93 = bitcast %struct.icmphdr* %92 to i8*
%94 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%95 = load i32, i32* %11
%96 = call i32 @memcpy(i8* %93, i8* %94, i32 %95)
%97 = load i32, i32* %11
store i32 %97, i32* %10
br label %99
98: ; preds = %76
store i32 0, i32* %10
br label %99
99: ; preds = %98, %90
%100 = load %struct.icmphdr*, %struct.icmphdr** %13
%101 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %100, i32 0, i32 0
store i32 0, i32* %101
%102 = load %struct.icmphdr*, %struct.icmphdr** %13
%103 = bitcast %struct.icmphdr* %102 to i16*
%104 = load i32, i32* %10
%105 = zext i32 %104 to i64
%106 = add i64 16, %105
%107 = trunc i64 %106 to i32
%108 = call i32 @checksum(i16* %103, i32 %107)
%109 = load %struct.icmphdr*, %struct.icmphdr** %13
%110 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %109, i32 0, i32 0
store i32 %108, i32* %110
%111 = load i32, i32* %6
%112 = load %struct.icmphdr*, %struct.icmphdr** %13
%113 = load i32, i32* %10
%114 = zext i32 %113 to i64
%115 = add i64 16, %114
%116 = trunc i64 %115 to i32
%117 = bitcast %struct.sockaddr_in* %15 to %struct.sockaddr*
%118 = call i32 @sendto(i32 %111, %struct.icmphdr* %112, i32 %116, i32 0, %struct.sockaddr* %117, i32 8)
store i32 %118, i32* %11
%119 = load i32, i32* %11
%120 = icmp eq i32 %119, -1
br i1 %120, label %121, label %123
121: ; preds = %99
%122 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %126
123: ; preds = %99
br label %124
124: ; preds = %123, %43
br label %125
125: ; preds = %124, %35
br label %35
126: ; preds = %121, %23
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.icmphdr = type { i32, i64 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_ICMP = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.3 = [3 x i8] c"%s\00"
@stdout = global i32 0
@AF_INET = global i32 0
@.str.4 = [7 x i8] c"sendto\00"
@str = [16 x i8] c"icmpsh - master\00"
@str.5 = [11 x i8] c"running...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca [64 x i8]
%5 = alloca %struct.sockaddr_in
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%8 = bitcast %struct.sockaddr_in* %5 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @PF_INET
%11 = load i32, i32* @SOCK_RAW
%12 = load i32, i32* @IPPROTO_ICMP
%13 = tail call i32 @socket(i32 %10, i32 %11, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %66
17: ; preds = %2
%18 = load i32, i32* @F_GETFL
%19 = tail call i32 @fcntl(i32 0, i32 %18, i32 0)
%20 = load i32, i32* @O_NONBLOCK
%21 = or i32 %20, %19
%22 = load i32, i32* @F_SETFL
%23 = tail call i32 @fcntl(i32 0, i32 %22, i32 %21)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 4
%26 = bitcast i8* %25 to %struct.icmphdr*
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 20
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 12
%29 = bitcast i8* %28 to i64*
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
%31 = bitcast [1024 x i8]* %3 to i32*
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
%33 = bitcast i8* %25 to i32*
%34 = bitcast i8* %25 to i16*
%35 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
br label %36
36: ; preds = %63, %17
%37 = call i32 @memset(i8* %6, i32 0, i32 1024)
%38 = call i32 @read(i32 %13, i8* %6, i32 1023)
%39 = icmp sgt i32 %38, 4
br i1 %39, label %40, label %63
40: ; preds = %36
%41 = add nsw i32 %38, -21
%42 = icmp ult i32 %41, -17
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = add nsw i32 %38, -20
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %27, i64 %45
store i8 0, i8* %46
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%48 = load i32, i32* @stdout
%49 = call i32 @fflush(i32 %48)
br label %50
50: ; preds = %43, %40
store i64 0, i64* %29
%51 = load i32, i32* @AF_INET
store i32 %51, i32* %30
%52 = load i32, i32* %31
store i32 %52, i32* %32
%53 = call i32 @read(i32 0, i8* %7, i32 64)
%54 = icmp sgt i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 @memcpy(i8* %27, i8* %7, i32 %53)
br label %57
57: ; preds = %50, %55
%58 = phi i32 [ %53, %55 ], [ 0, %50 ]
store i32 0, i32* %33
%59 = add nuw i32 %58, 16
%60 = call i32 @checksum(i16* %34, i32 %59)
store i32 %60, i32* %33
%61 = call i32 @sendto(i32 %13, %struct.icmphdr* %26, i32 %59, i32 0, %struct.sockaddr* %35, i32 8)
%62 = icmp eq i32 %61, -1
br i1 %62, label %64, label %63
63: ; preds = %57, %36
br label %36
64: ; preds = %57
%65 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %64, %15
ret i32 -1
}