#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 msghdr {
  int msg_iovlen;
  char *msg_control;
  int msg_controllen;
  struct iovec *msg_iov;
  scalar_t__ msg_namelen;
  int /*<<< orphan*/ *msg_name;
};
struct ip {
  int ip_hl;
  int /*<<< orphan*/ ip_src;
};
struct iovec {
  char *iov_base;
  int iov_len;
};
struct icmp {
  int icmp_id;
  scalar_t__ icmp_cksum;
  scalar_t__ icmp_seq;
  scalar_t__ icmp_code;
  int /*<<< orphan*/ icmp_type;
};
struct addrinfo {
  char *ai_canonname;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ ICMP_ECHO;
int /*<<< orphan*/ SOCK_RAW;
scalar_t__ checksum(unsigned short *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ getaddrinfo(char *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *, struct addrinfo **);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvmsg(int, struct msghdr *, int /*<<< orphan*/);
scalar_t__ sendto(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/,
                  int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int);
int main(int argc, char *argv[]) {
  char sendbuf[1500], recvbuf[1500], controlbuf[1500];
  struct icmp *icmp;
  struct ip *ip;
  int sockfd;
  int packet_len, recv_len, ip_len, data_len;
  struct addrinfo *ai;
  struct iovec iov;
  struct msghdr msg;
  getaddrinfo(argv[1], NULL, NULL, &ai);
  printf("Dest: %s\n", ai->ai_canonname ? ai->ai_canonname : argv[1]);
  if ((sockfd = socket(AF_INET, SOCK_RAW, 1)) < 0) {
    perror("socket");
    exit(1);
  }
  icmp = (struct icmp *)sendbuf;
  icmp->icmp_type = ICMP_ECHO;
  icmp->icmp_code = 0;
  icmp->icmp_id = 42;
  icmp->icmp_seq = 0;
  icmp->icmp_cksum = 0;
  icmp->icmp_cksum = checksum((unsigned short *)icmp, sizeof(struct icmp));
  packet_len = sizeof(struct icmp);
  if (sendto(sockfd, sendbuf, packet_len, 0, ai->ai_addr, ai->ai_addrlen) < 0) {
    perror("sendto");
    exit(1);
  }
  iov.iov_base = recvbuf;
  iov.iov_len = 1500;
  msg.msg_name = NULL;
  msg.msg_namelen = 0;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  msg.msg_control = controlbuf;
  msg.msg_controllen = 1500;
  if ((recv_len = recvmsg(sockfd, &msg, 0)) < 0) {
    perror("recvmsg");
    exit(1);
  }
  printf("%d\n", recv_len);
  ip = (struct ip *)recvbuf;
  ip_len = ip->ip_hl << 2;
  icmp = (struct icmp *)(recvbuf + ip_len);
  data_len = (recv_len - ip_len);
  printf("%d bytes from %s\n", data_len, inet_ntoa(ip->ip_src));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x11e0(%rbp),%rcx
mov    %rdx,%rsi
call   10a0 <getaddrinfo@plt>
mov    -0x11e0(%rbp),%rax
cmpq   $0x0,(%rax)
je     11eb <main+0x5b>
mov    -0x11e0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x1228(%rbp)
jmp    11fa <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x1228(%rbp)
mov    -0x1228(%rbp),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    0x2dc1(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
call   10b0 <socket@plt>
mov    %eax,-0x11c4(%rbp)
cmp    $0x0,%eax
jge    1250 <main+0xc0>
lea    0xdc9(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x5f0(%rbp),%rax
mov    %rax,-0x11b8(%rbp)
mov    0x2d6b(%rip),%rax
mov    (%rax),%ecx
mov    -0x11b8(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x11b8(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x11b8(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x11b8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x11b8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x11b8(%rbp),%rdi
mov    $0x28,%esi
call   1050 <checksum@plt>
mov    %rax,%rcx
mov    -0x11b8(%rbp),%rax
mov    %rcx,0x8(%rax)
movl   $0x28,-0x11c8(%rbp)
mov    -0x11c4(%rbp),%edi
lea    -0x5f0(%rbp),%rsi
mov    -0x11c8(%rbp),%edx
mov    -0x11e0(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x11e0(%rbp),%rax
mov    0x8(%rax),%r9d
xor    %ecx,%ecx
call   1060 <sendto@plt>
cmp    $0x0,%rax
jge    1324 <main+0x194>
lea    0xcfc(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0xbd0(%rbp),%rax
mov    %rax,-0x11f0(%rbp)
movl   $0x5dc,-0x11e8(%rbp)
movq   $0x0,-0x11f8(%rbp)
movq   $0x0,-0x1200(%rbp)
lea    -0x11f0(%rbp),%rax
mov    %rax,-0x1208(%rbp)
movl   $0x1,-0x1220(%rbp)
lea    -0x11b0(%rbp),%rax
mov    %rax,-0x1218(%rbp)
movl   $0x5dc,-0x1210(%rbp)
mov    -0x11c4(%rbp),%edi
lea    -0x1220(%rbp),%rsi
xor    %edx,%edx
call   1070 <recvmsg@plt>
mov    %eax,-0x11cc(%rbp)
cmp    $0x0,%eax
jge    13bb <main+0x22b>
lea    0xc6c(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x11cc(%rbp),%esi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xbd0(%rbp),%rax
mov    %rax,-0x11c0(%rbp)
mov    -0x11c0(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    %eax,-0x11d0(%rbp)
lea    -0xbd0(%rbp),%rax
movslq -0x11d0(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x11b8(%rbp)
mov    -0x11cc(%rbp),%eax
sub    -0x11d0(%rbp),%eax
mov    %eax,-0x11d4(%rbp)
mov    -0x11d4(%rbp),%eax
mov    %eax,-0x122c(%rbp)
mov    -0x11c0(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <inet_ntoa@plt>
mov    -0x122c(%rbp),%esi
mov    %rax,%rdx
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x11f8,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rcx
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <getaddrinfo@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
test   %rsi,%rsi
jne    11c0 <main+0x30>
mov    0x8(%rbx),%rsi
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
call   10b0 <socket@plt>
test   %eax,%eax
js     12f8 <main+0x168>
mov    %eax,%ebx
mov    0x2dd5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x70(%rsp)
movq   $0x0,0x68(%rsp)
movl   $0x2a,0x50(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x58(%rsp)
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x28,%esi
call   1050 <checksum@plt>
mov    %rax,0x58(%rsp)
mov    0x8(%rsp),%rax
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r8d
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x28,%edx
xor    %ecx,%ecx
call   1060 <sendto@plt>
test   %rax,%rax
js     1301 <main+0x171>
lea    0x630(%rsp),%rax
mov    %rax,0x10(%rsp)
movl   $0x5dc,0x18(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x40(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,0x38(%rsp)
movl   $0x1,0x20(%rsp)
lea    0xc10(%rsp),%rax
mov    %rax,0x28(%rsp)
movl   $0x5dc,0x30(%rsp)
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1070 <recvmsg@plt>
test   %eax,%eax
js     130a <main+0x17a>
mov    %eax,%ebx
lea    0xd79(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x630(%rsp),%eax
mov    0x634(%rsp),%edi
shl    $0x2,%eax
sub    %eax,%ebx
call   1030 <inet_ntoa@plt>
lea    0xd55(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x11f8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd1b(%rip),%rdi
jmp    1311 <main+0x181>
lea    0xd19(%rip),%rdi
jmp    1311 <main+0x181>
lea    0xd17(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.icmp = type { i32, i64, i64, i64, i32 }
%struct.ip = type { i32, i32 }
%struct.addrinfo = type { i8*, i32, i32 }
%struct.iovec = type { i8*, i32 }
%struct.msghdr = type { i32, i8*, i32, %struct.iovec*, i64, i32* }
@.str = [10 x i8] c"Dest: %s\0A\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@ICMP_ECHO = global i32 0
@.str.2 = [7 x i8] c"sendto\00"
@.str.3 = [8 x i8] c"recvmsg\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [18 x i8] c"%d bytes from %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1500 x i8]
%7 = alloca [1500 x i8]
%8 = alloca [1500 x i8]
%9 = alloca %struct.icmp*
%10 = alloca %struct.ip*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.addrinfo*
%17 = alloca %struct.iovec
%18 = alloca %struct.msghdr
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @getaddrinfo(i8* %21, i32* null, i32* null, %struct.addrinfo** %16)
%23 = load %struct.addrinfo*, %struct.addrinfo** %16
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i32 0, i32 0
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %31
27: ; preds = %2
%28 = load %struct.addrinfo*, %struct.addrinfo** %16
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i32 0, i32 0
%30 = load i8*, i8** %29
br label %35
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
br label %35
35: ; preds = %31, %27
%36 = phi i8* [ %30, %27 ], [ %34, %31 ]
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @AF_INET
%39 = load i32, i32* @SOCK_RAW
%40 = call i32 @socket(i32 %38, i32 %39, i32 1)
store i32 %40, i32* %11
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %35
%46 = getelementptr inbounds [1500 x i8], [1500 x i8]* %6, i64 0, i64 0
%47 = bitcast i8* %46 to %struct.icmp*
store %struct.icmp* %47, %struct.icmp** %9
%48 = load i32, i32* @ICMP_ECHO
%49 = load %struct.icmp*, %struct.icmp** %9
%50 = getelementptr inbounds %struct.icmp, %struct.icmp* %49, i32 0, i32 4
store i32 %48, i32* %50
%51 = load %struct.icmp*, %struct.icmp** %9
%52 = getelementptr inbounds %struct.icmp, %struct.icmp* %51, i32 0, i32 3
store i64 0, i64* %52
%53 = load %struct.icmp*, %struct.icmp** %9
%54 = getelementptr inbounds %struct.icmp, %struct.icmp* %53, i32 0, i32 0
store i32 42, i32* %54
%55 = load %struct.icmp*, %struct.icmp** %9
%56 = getelementptr inbounds %struct.icmp, %struct.icmp* %55, i32 0, i32 2
store i64 0, i64* %56
%57 = load %struct.icmp*, %struct.icmp** %9
%58 = getelementptr inbounds %struct.icmp, %struct.icmp* %57, i32 0, i32 1
store i64 0, i64* %58
%59 = load %struct.icmp*, %struct.icmp** %9
%60 = bitcast %struct.icmp* %59 to i16*
%61 = call i64 @checksum(i16* %60, i32 40)
%62 = load %struct.icmp*, %struct.icmp** %9
%63 = getelementptr inbounds %struct.icmp, %struct.icmp* %62, i32 0, i32 1
store i64 %61, i64* %63
store i32 40, i32* %12
%64 = load i32, i32* %11
%65 = getelementptr inbounds [1500 x i8], [1500 x i8]* %6, i64 0, i64 0
%66 = load i32, i32* %12
%67 = load %struct.addrinfo*, %struct.addrinfo** %16
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 2
%69 = load i32, i32* %68
%70 = load %struct.addrinfo*, %struct.addrinfo** %16
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i32 0, i32 1
%72 = load i32, i32* %71
%73 = call i64 @sendto(i32 %64, i8* %65, i32 %66, i32 0, i32 %69, i32 %72)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %45
%76 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %45
%79 = getelementptr inbounds [1500 x i8], [1500 x i8]* %7, i64 0, i64 0
%80 = getelementptr inbounds %struct.iovec, %struct.iovec* %17, i32 0, i32 0
store i8* %79, i8** %80
%81 = getelementptr inbounds %struct.iovec, %struct.iovec* %17, i32 0, i32 1
store i32 1500, i32* %81
%82 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 5
store i32* null, i32** %82
%83 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 4
store i64 0, i64* %83
%84 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 3
store %struct.iovec* %17, %struct.iovec** %84
%85 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 0
store i32 1, i32* %85
%86 = getelementptr inbounds [1500 x i8], [1500 x i8]* %8, i64 0, i64 0
%87 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 1
store i8* %86, i8** %87
%88 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %18, i32 0, i32 2
store i32 1500, i32* %88
%89 = load i32, i32* %11
%90 = call i32 @recvmsg(i32 %89, %struct.msghdr* %18, i32 0)
store i32 %90, i32* %13
%91 = icmp slt i32 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %78
%93 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %78
%96 = load i32, i32* %13
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %96)
%98 = getelementptr inbounds [1500 x i8], [1500 x i8]* %7, i64 0, i64 0
%99 = bitcast i8* %98 to %struct.ip*
store %struct.ip* %99, %struct.ip** %10
%100 = load %struct.ip*, %struct.ip** %10
%101 = getelementptr inbounds %struct.ip, %struct.ip* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = shl i32 %102, 2
store i32 %103, i32* %14
%104 = getelementptr inbounds [1500 x i8], [1500 x i8]* %7, i64 0, i64 0
%105 = load i32, i32* %14
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %104, i64 %106
%108 = bitcast i8* %107 to %struct.icmp*
store %struct.icmp* %108, %struct.icmp** %9
%109 = load i32, i32* %13
%110 = load i32, i32* %14
%111 = sub nsw i32 %109, %110
store i32 %111, i32* %15
%112 = load i32, i32* %15
%113 = load %struct.ip*, %struct.ip** %10
%114 = getelementptr inbounds %struct.ip, %struct.ip* %113, i32 0, i32 1
%115 = load i32, i32* %114
%116 = call i8* @inet_ntoa(i32 %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %112, i8* %116)
ret i32 0
}

LLVM IR (-O2):
%struct.addrinfo = type { i8*, i32, i32 }
%struct.iovec = type { i8*, i32 }
%struct.msghdr = type { i32, i8*, i32, %struct.iovec*, i64, i32* }
@.str = [10 x i8] c"Dest: %s\0A\00"
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@ICMP_ECHO = global i32 0
@.str.2 = [7 x i8] c"sendto\00"
@.str.3 = [8 x i8] c"recvmsg\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [18 x i8] c"%d bytes from %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1500 x i8]
%4 = alloca [1500 x i8]
%5 = alloca [1500 x i8]
%6 = alloca %struct.addrinfo*
%7 = alloca %struct.iovec
%8 = alloca %struct.msghdr
%9 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1500 x i8], [1500 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1500 x i8], [1500 x i8]* %5, i64 0, i64 0
%12 = bitcast %struct.addrinfo** %6 to i8*
%13 = bitcast %struct.iovec* %7 to i8*
%14 = bitcast %struct.msghdr* %8 to i8*
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @getaddrinfo(i8* %16, i32* null, i32* null, %struct.addrinfo** %6)
%18 = load %struct.addrinfo*, %struct.addrinfo** %6
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %18, i64 0, i32 0
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = load i8*, i8** %15
br label %24
24: ; preds = %2, %22
%25 = phi i8* [ %23, %22 ], [ %20, %2 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_RAW
%29 = call i32 @socket(i32 %27, i32 %28, i32 1)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %24
%35 = load i32, i32* @ICMP_ECHO
%36 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 32
%37 = bitcast i8* %36 to i32*
store i32 %35, i32* %37
%38 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 24
%39 = bitcast i8* %38 to i64*
store i64 0, i64* %39
%40 = bitcast [1500 x i8]* %3 to i32*
store i32 42, i32* %40
%41 = getelementptr inbounds [1500 x i8], [1500 x i8]* %3, i64 0, i64 8
%42 = bitcast i8* %41 to i64*
%43 = bitcast [1500 x i8]* %3 to i16*
%44 = call i64 @checksum(i16* %43, i32 40)
store i64 %44, i64* %42
%45 = load %struct.addrinfo*, %struct.addrinfo** %6
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i64 0, i32 2
%47 = load i32, i32* %46
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i64 0, i32 1
%49 = load i32, i32* %48
%50 = call i64 @sendto(i32 %29, i8* %9, i32 40, i32 0, i32 %47, i32 %49)
%51 = icmp slt i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %34
%53 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %34
%56 = getelementptr inbounds %struct.iovec, %struct.iovec* %7, i64 0, i32 0
store i8* %10, i8** %56
%57 = getelementptr inbounds %struct.iovec, %struct.iovec* %7, i64 0, i32 1
store i32 1500, i32* %57
%58 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %8, i64 0, i32 4
%59 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %8, i64 0, i32 3
%60 = bitcast i64* %58 to i8*
store %struct.iovec* %7, %struct.iovec** %59
%61 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %8, i64 0, i32 0
store i32 1, i32* %61
%62 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %8, i64 0, i32 1
store i8* %11, i8** %62
%63 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %8, i64 0, i32 2
store i32 1500, i32* %63
%64 = call i32 @recvmsg(i32 %29, %struct.msghdr* %8, i32 0)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %55
%67 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %55
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %64)
%71 = bitcast [1500 x i8]* %4 to i32*
%72 = load i32, i32* %71
%73 = mul i32 %72, -4
%74 = add i32 %73, %64
%75 = getelementptr inbounds [1500 x i8], [1500 x i8]* %4, i64 0, i64 4
%76 = bitcast i8* %75 to i32*
%77 = load i32, i32* %76
%78 = call i8* @inet_ntoa(i32 %77)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %74, i8* %78)
ret i32 0
}