#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 */
typedef int uint;
struct timeval {
  double tv_sec;
  double tv_usec;
};
struct stat {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct ifreq {
  int /*<<< orphan*/ ifr_flags;
  int /*<<< orphan*/ ifr_name;
};
typedef int /*<<< orphan*/ servaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int /*<<< orphan*/ IFF_PROMISC;
int IFNAMSIZ;
int O_CREAT;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ PF_PACKET;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCSIFFLAGS;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BINDTODEVICE;
int /*<<< orphan*/ SO_REUSEADDR;
int atoi(char *);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ memset(struct ifreq *, int /*<<< orphan*/, int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/ *,
             int /*<<< orphan*/ *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  uint total_bytes_recv = 0;
  double elapsedTime;
  struct timeval t_start, t_end, t_now;
  int i, j, fd;
  int sockfd;
  int sockopt;
  char recvbuf[65535];
  struct ifreq ifopts;
  struct ifreq if_mac;
  struct sockaddr_in servaddr;
  char ifName[IFNAMSIZ];
  int ret;
  int recvsize = 1500;
  int bytes2send = 0;
  struct stat st;
  unsigned char my_dest_mac[6];
  if (argc < 3) {
    printf("Usage: %s <ip> <port> <[optional] recvsize (bytes)> <[optional] "
           "interface> <[optional] filepath>\n",
           argv[0]);
    exit(0);
  }
  if (argc > 3)
    recvsize = atoi(argv[3]);
  if (argc > 4) {
    strcpy(ifName, argv[4]);
  } else {
    strcpy(ifName, "wlan0");
  }
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = inet_addr(argv[1]);
  servaddr.sin_port = htons(atoi(argv[2]));
  ret = sendto(sockfd, "!?=\n", 4, 0, (struct sockaddr *)&servaddr,
               sizeof(servaddr));
  if (ret <= 0) {
    printf("! Trigger the initialization");
  }
  if ((sockfd = socket(PF_PACKET, SOCK_RAW, htons(0x0003))) == -1) {
    fprintf(stderr, "! raw socket error.\n");
    exit(1);
  }
  memset(&ifopts, 0, sizeof(struct ifreq));
  strncpy(ifopts.ifr_name, ifName, IFNAMSIZ - 1);
  if (ioctl(sockfd, SIOCGIFFLAGS, &ifopts) < 0) {
    fprintf(stderr, "! SIOCGIFFLAGS error. Check permission.\n");
    exit(EXIT_FAILURE);
  }
  ifopts.ifr_flags |= IFF_PROMISC;
  if (ioctl(sockfd, SIOCSIFFLAGS, &ifopts) < 0) {
    fprintf(stderr, "! SIOCSIFFLAGS error. Check permission.\n");
    exit(EXIT_FAILURE);
  }
  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof sockopt) ==
      -1) {
    fprintf(stderr, "! setsockopt error. \n");
    close(sockfd);
    exit(EXIT_FAILURE);
  }
  if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, ifName, IFNAMSIZ - 1) ==
      -1) {
    fprintf(stderr, "! SO_BINDTODEVICE error. \n");
    close(sockfd);
    exit(EXIT_FAILURE);
  }
  if (argc > 5) {
    fd = open(argv[5], O_WRONLY | O_CREAT | O_TRUNC);
    if (fd == -1) {
      fprintf(stderr, "! Unable to open file %s.\n", argv[5]);
      close(sockfd);
      exit(1);
    }
  }
  gettimeofday(&t_start, NULL);
  for (;;) {
    ret = recvfrom(sockfd, recvbuf, recvsize, 0, NULL, NULL);
    if (ret <= 0) {
      if (errno == 0)
        break;
      fprintf(stderr, "! Fail to recv: ret:%d, err:%d; quiting..\n", ret,
              errno);
      exit(1);
    }
    if ((recvbuf[0] == '=') && (recvbuf[1] == '?') && (recvbuf[2] == '!'))
      break;
    if (argc > 5)
      write(fd, recvbuf, ret);
    total_bytes_recv += ret;
    printf("after: total_bytes_recv %d\n", total_bytes_recv);
  }
  gettimeofday(&t_end, NULL);
  elapsedTime = (t_end.tv_sec - t_start.tv_sec) +
                (t_end.tv_usec - t_start.tv_usec) / 1000000.0;
  printf("sent(bytes):%d\nduration(s):%lf\nthroughput(bps):%lf\n",
         total_bytes_recv, elapsedTime, total_bytes_recv * 8 / elapsedTime);
  close(sockfd);
  if (argc > 5)
    close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10098(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x100c0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x100a0(%rbp)
movl   $0x5dc,-0x100a8(%rbp)
movl   $0x0,-0x100ac(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    12bf <main+0x8f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1140 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jle    12dc <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x100a8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jle    12ff <main+0xcf>
mov    -0x100c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1040 <strcpy@plt>
jmp    1312 <main+0xe2>
mov    -0x100c0(%rbp),%rdi
lea    0xd5d(%rip),%rsi
call   1040 <strcpy@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
mov    0x2c8e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,-0x60(%rbp)
lea    -0x10090(%rbp),%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    0x2c7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10088(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <inet_addr@plt>
mov    %eax,-0x1008c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x10090(%rbp)
mov    -0x60(%rbp),%edi
lea    -0x10090(%rbp),%r8
lea    0xce4(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10c0 <sendto@plt>
mov    %eax,-0x100a4(%rbp)
cmpl   $0x0,-0x100a4(%rbp)
jg     13bf <main+0x18f>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    0x2c12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x100c8(%rbp)
mov    0x2be3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x100c4(%rbp)
mov    $0x3,%edi
call   1070 <htons@plt>
mov    -0x100c8(%rbp),%edi
mov    -0x100c4(%rbp),%esi
mov    %eax,%edx
call   1150 <socket@plt>
mov    %eax,-0x60(%rbp)
cmp    $0xffffffff,%eax
jne    1427 <main+0x1f7>
mov    0x2b8b(%rip),%rax
mov    (%rax),%edi
lea    0xc7c(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
lea    -0x10078(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    -0x100c0(%rbp),%rsi
mov    -0x10074(%rbp),%edi
mov    0x2b42(%rip),%rax
mov    (%rax),%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x60(%rbp),%edi
mov    0x2b46(%rip),%rax
mov    (%rax),%esi
lea    -0x10078(%rbp),%rdx
call   10b0 <ioctl@plt>
cmp    $0x0,%rax
jge    149f <main+0x26f>
mov    0x2b17(%rip),%rax
mov    (%rax),%edi
lea    0xc1d(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x2ae8(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2ad2(%rip),%rax
mov    (%rax),%eax
or     -0x10078(%rbp),%eax
mov    %eax,-0x10078(%rbp)
mov    -0x60(%rbp),%edi
mov    0x2b32(%rip),%rax
mov    (%rax),%esi
lea    -0x10078(%rbp),%rdx
call   10b0 <ioctl@plt>
cmp    $0x0,%rax
jge    14fb <main+0x2cb>
mov    0x2abb(%rip),%rax
mov    (%rax),%edi
lea    0xbea(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x60(%rbp),%edi
mov    0x2ac3(%rip),%rax
mov    (%rax),%esi
mov    0x2a62(%rip),%rax
mov    (%rax),%edx
lea    -0x64(%rbp),%rcx
mov    $0x4,%r8d
mov    $0x0,%al
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1557 <main+0x327>
mov    0x2a67(%rip),%rax
mov    (%rax),%edi
lea    0xbbf(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x60(%rbp),%edi
call   10d0 <close@plt>
mov    0x2a30(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x100c0(%rbp),%rcx
mov    -0x60(%rbp),%edi
mov    0x2a60(%rip),%rax
mov    (%rax),%esi
mov    0x29f7(%rip),%rax
mov    (%rax),%edx
mov    0x2a16(%rip),%rax
mov    (%rax),%r8d
sub    $0x1,%r8d
mov    $0x0,%al
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    15be <main+0x38e>
mov    0x2a00(%rip),%rax
mov    (%rax),%edi
lea    0xb6e(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x60(%rbp),%edi
call   10d0 <close@plt>
mov    0x29c9(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
jle    1633 <main+0x403>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
mov    0x2981(%rip),%rax
mov    (%rax),%esi
mov    0x2a18(%rip),%rax
or     (%rax),%esi
mov    0x29ff(%rip),%rax
or     (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
jne    162e <main+0x3fe>
mov    0x2994(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0xb15(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x60(%rbp),%edi
call   10d0 <close@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
jmp    1633 <main+0x403>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <gettimeofday@plt>
mov    -0x60(%rbp),%edi
lea    -0x10070(%rbp),%rsi
mov    -0x100a8(%rbp),%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1100 <recvfrom@plt>
mov    %eax,-0x100a4(%rbp)
cmpl   $0x0,-0x100a4(%rbp)
jg     16b9 <main+0x489>
mov    0x290f(%rip),%rax
cmpq   $0x0,(%rax)
jne    1688 <main+0x458>
jmp    172f <main+0x4ff>
mov    0x2909(%rip),%rax
mov    (%rax),%edi
mov    -0x100a4(%rbp),%edx
mov    0x28ea(%rip),%rax
mov    (%rax),%rcx
lea    0xa9d(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
movsbl -0x10070(%rbp),%eax
cmp    $0x3d,%eax
jne    16ee <main+0x4be>
movsbl -0x1006f(%rbp),%eax
cmp    $0x3f,%eax
jne    16ee <main+0x4be>
movsbl -0x1006e(%rbp),%eax
cmp    $0x21,%eax
jne    16ee <main+0x4be>
jmp    172f <main+0x4ff>
cmpl   $0x5,-0x8(%rbp)
jle    170d <main+0x4dd>
mov    -0x5c(%rbp),%edi
lea    -0x10070(%rbp),%rsi
mov    -0x100a4(%rbp),%edx
call   1060 <write@plt>
mov    -0x100a4(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xa4d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1640 <main+0x410>
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <gettimeofday@plt>
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0x8a8(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mov    -0x14(%rbp),%eax
shl    $0x3,%eax
cvtsi2sd %eax,%xmm1
divsd  -0x20(%rbp),%xmm1
lea    0xa09(%rip),%rdi
mov    $0x2,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x5,-0x8(%rbp)
jle    17a4 <main+0x574>
mov    -0x5c(%rbp),%edi
call   10d0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10098(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10058,%rsp
mov    %rsi,%r14
mov    %rsp,%rcx
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmp    $0x2,%edi
jle    15a4 <main+0x374>
mov    %edi,%ebx
mov    %rcx,-0x58(%rbp)
movl   $0x5dc,-0x2c(%rbp)
lea    0xde9(%rip),%r15
cmp    $0x3,%edi
mov    %edi,-0x30(%rbp)
je     129e <main+0x6e>
mov    0x18(%r14),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x5,%ebx
jb     129e <main+0x6e>
mov    0x20(%r14),%r15
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    0x2d10(%rip),%r12
mov    (%r12),%edi
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,%ebx
lea    -0x50(%rbp),%r15
mov    %r15,%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    (%r12),%eax
mov    %eax,-0x48(%rbp)
mov    0x8(%r14),%rdi
call   10e0 <inet_addr@plt>
mov    %eax,-0x4c(%rbp)
mov    0x10(%r14),%rdi
call   1130 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x50(%rbp)
lea    0xd6c(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    $0xc,%r9d
call   10c0 <sendto@plt>
test   %eax,%eax
jg     132d <main+0xfd>
lea    0xd4f(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2ca4(%rip),%rax
mov    (%rax),%r15d
mov    0x2c7a(%rip),%rax
mov    (%rax),%ebx
mov    $0x3,%edi
call   1070 <htons@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1150 <socket@plt>
cmp    $0xffffffff,%eax
je     15bc <main+0x38c>
mov    %eax,%ebx
lea    -0x40(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    -0x3c(%rbp),%edi
mov    0x2c12(%rip),%rax
mov    (%rax),%edx
add    $0xffffffff,%edx
mov    %r13,%rsi
call   1030 <strncpy@plt>
mov    0x2c16(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r15,%rdx
call   10b0 <ioctl@plt>
test   %rax,%rax
mov    -0x30(%rbp),%r15d
js     15dd <main+0x3ad>
mov    0x2bc6(%rip),%rax
mov    (%rax),%eax
or     %eax,-0x40(%rbp)
mov    0x2c32(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
mov    %ebx,%edi
call   10b0 <ioctl@plt>
test   %rax,%rax
js     15ef <main+0x3bf>
mov    0x2bed(%rip),%r12
mov    (%r12),%esi
mov    0x2b8a(%rip),%rax
mov    (%rax),%edx
lea    -0x5c(%rbp),%rcx
mov    $0x4,%r8d
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     1608 <main+0x3d8>
mov    (%r12),%esi
mov    0x2b59(%rip),%rax
mov    (%rax),%edx
mov    0x2b78(%rip),%rax
mov    (%rax),%r8d
add    $0xffffffff,%r8d
mov    %ebx,%edi
mov    %r13,%rcx
xor    %eax,%eax
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     161a <main+0x3ea>
cmp    $0x6,%r15d
jb     146a <main+0x23a>
mov    0x2b17(%rip),%rax
mov    0x2bb0(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x28(%r14),%rdi
mov    0x2b91(%rip),%rax
or     (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
je     1669 <main+0x439>
xor    %r13d,%r13d
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
call   1090 <gettimeofday@plt>
lea    -0x10080(%rbp),%rsi
mov    %ebx,%r12d
mov    %ebx,%edi
mov    -0x2c(%rbp),%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1100 <recvfrom@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1516 <main+0x2e6>
lea    -0x10080(%rbp),%r15
xor    %r14d,%r14d
jmp    14e6 <main+0x2b6>
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%r13d
add    %r14d,%r13d
lea    0xcb3(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    -0x2c(%rbp),%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1100 <recvfrom@plt>
mov    %eax,%ebx
mov    %r13d,%r14d
test   %eax,%eax
jle    1516 <main+0x2e6>
cmpb   $0x3d,-0x10080(%rbp)
jne    1501 <main+0x2d1>
cmpb   $0x3f,-0x1007f(%rbp)
jne    1501 <main+0x2d1>
cmpb   $0x21,-0x1007e(%rbp)
je     152c <main+0x2fc>
cmpl   $0x6,-0x30(%rbp)
jb     14b0 <main+0x280>
mov    -0x34(%rbp),%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1060 <write@plt>
jmp    14b0 <main+0x280>
mov    0x2a6b(%rip),%rax
mov    (%rax),%rcx
mov    %r13d,%r14d
test   %rcx,%rcx
jne    1646 <main+0x416>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
call   1090 <gettimeofday@plt>
movapd -0x70(%rbp),%xmm1
subpd  -0x80(%rbp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  0xaaf(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0x0(,%r14,8),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm0,%xmm1
lea    0xc1d(%rip),%rdi
mov    %r14d,%esi
mov    $0x2,%al
call   1080 <printf@plt>
mov    %r12d,%edi
call   10d0 <close@plt>
cmpl   $0x6,-0x30(%rbp)
jb     158f <main+0x35f>
mov    -0x34(%rbp),%edi
call   10d0 <close@plt>
mov    -0x58(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rsi
lea    0xa5a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
call   1140 <exit@plt>
mov    0x29d5(%rip),%rax
mov    (%rax),%edi
lea    0xac6(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    0x29b4(%rip),%rax
mov    (%rax),%edi
lea    0xaba(%rip),%rsi
jmp    15ff <main+0x3cf>
mov    0x29a2(%rip),%rax
mov    (%rax),%edi
lea    0xad1(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    1638 <main+0x408>
mov    0x2989(%rip),%rax
mov    (%rax),%edi
lea    0xae1(%rip),%rsi
jmp    162a <main+0x3fa>
mov    0x2977(%rip),%rax
mov    (%rax),%edi
lea    0xae5(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    0x2941(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x294b(%rip),%rax
mov    (%rax),%edi
lea    0xaef(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    0x2928(%rip),%rax
mov    (%rax),%edi
mov    0x28(%r14),%rdx
lea    0xaad(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    $0x1,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { double, double }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.stat = type { i32 }
%struct.sockaddr = type { i32 }
@IFNAMSIZ = global i32 0
@.str = [98 x i8] c"Usage: %s <ip> <port> <[optional] recvsize (bytes)> <[optional] interface> <[optional] filepath>\0A\00"
@.str.1 = [6 x i8] c"wlan0\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [5 x i8] c"!?=\0A\00"
@.str.3 = [29 x i8] c"! Trigger the initialization\00"
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"! raw socket error.\0A\00"
@SIOCGIFFLAGS = global i32 0
@.str.5 = [41 x i8] c"! SIOCGIFFLAGS error. Check permission.\0A\00"
@EXIT_FAILURE = global i32 0
@IFF_PROMISC = global i32 0
@SIOCSIFFLAGS = global i32 0
@.str.6 = [41 x i8] c"! SIOCSIFFLAGS error. Check permission.\0A\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.7 = [22 x i8] c"! setsockopt error. \0A\00"
@SO_BINDTODEVICE = global i32 0
@.str.8 = [27 x i8] c"! SO_BINDTODEVICE error. \0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.9 = [27 x i8] c"! Unable to open file %s.\0A\00"
@errno = global i64 0
@.str.10 = [43 x i8] c"! Fail to recv: ret:%d, err:%d; quiting..\0A\00"
@.str.11 = [28 x i8] c"after: total_bytes_recv %d\0A\00"
@.str.12 = [52 x i8] c"sent(bytes):%d\0Aduration(s):%lf\0Athroughput(bps):%lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca %struct.timeval
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [65535 x i8]
%17 = alloca %struct.ifreq
%18 = alloca %struct.ifreq
%19 = alloca %struct.sockaddr_in
%20 = alloca i8*
%21 = alloca i64
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca %struct.stat
%26 = alloca [6 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%27 = load i32, i32* @IFNAMSIZ
%28 = zext i32 %27 to i64
%29 = call i8* @llvm.stacksave()
store i8* %29, i8** %20
%30 = alloca i8, i64 %28
store i64 %28, i64* %21
store i32 1500, i32* %23
store i32 0, i32* %24
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 3
br i1 %32, label %33, label %39
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %2
%40 = load i32, i32* %4
%41 = icmp sgt i32 %40, 3
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %23
br label %47
47: ; preds = %42, %39
%48 = load i32, i32* %4
%49 = icmp sgt i32 %48, 4
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 4
%53 = load i8*, i8** %52
%54 = call i32 @strcpy(i8* %30, i8* %53)
br label %57
55: ; preds = %47
%56 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %57
57: ; preds = %55, %50
%58 = load i32, i32* @AF_INET
%59 = load i32, i32* @SOCK_DGRAM
%60 = call i32 @socket(i32 %58, i32 %59, i32 0)
store i32 %60, i32* %14
%61 = call i32 @bzero(%struct.sockaddr_in* %19, i32 12)
%62 = load i32, i32* @AF_INET
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 2
store i32 %62, i32* %63
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i32 @inet_addr(i8* %66)
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 1
%69 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %68, i32 0, i32 0
store i32 %67, i32* %69
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = call i32 @atoi(i8* %72)
%74 = call i32 @htons(i32 %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 0
store i32 %74, i32* %75
%76 = load i32, i32* %14
%77 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%78 = call i32 @sendto(i32 %76, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 0, %struct.sockaddr* %77, i32 12)
store i32 %78, i32* %22
%79 = load i32, i32* %22
%80 = icmp sle i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %57
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %83
83: ; preds = %81, %57
%84 = load i32, i32* @PF_PACKET
%85 = load i32, i32* @SOCK_RAW
%86 = call i32 @htons(i32 3)
%87 = call i32 @socket(i32 %84, i32 %85, i32 %86)
store i32 %87, i32* %14
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %93
89: ; preds = %83
%90 = load i32, i32* @stderr
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %83
%94 = call i32 @memset(%struct.ifreq* %17, i32 0, i32 8)
%95 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %17, i32 0, i32 1
%96 = load i32, i32* %95
%97 = load i32, i32* @IFNAMSIZ
%98 = sub nsw i32 %97, 1
%99 = call i32 @strncpy(i32 %96, i8* %30, i32 %98)
%100 = load i32, i32* %14
%101 = load i32, i32* @SIOCGIFFLAGS
%102 = call i64 @ioctl(i32 %100, i32 %101, %struct.ifreq* %17)
%103 = icmp slt i64 %102, 0
br i1 %103, label %104, label %109
104: ; preds = %93
%105 = load i32, i32* @stderr
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%107 = load i32, i32* @EXIT_FAILURE
%108 = call i32 @exit(i32 %107)
unreachable
109: ; preds = %93
%110 = load i32, i32* @IFF_PROMISC
%111 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %17, i32 0, i32 0
%112 = load i32, i32* %111
%113 = or i32 %112, %110
store i32 %113, i32* %111
%114 = load i32, i32* %14
%115 = load i32, i32* @SIOCSIFFLAGS
%116 = call i64 @ioctl(i32 %114, i32 %115, %struct.ifreq* %17)
%117 = icmp slt i64 %116, 0
br i1 %117, label %118, label %123
118: ; preds = %109
%119 = load i32, i32* @stderr
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%121 = load i32, i32* @EXIT_FAILURE
%122 = call i32 @exit(i32 %121)
unreachable
123: ; preds = %109
%124 = load i32, i32* %14
%125 = load i32, i32* @SOL_SOCKET
%126 = load i32, i32* @SO_REUSEADDR
%127 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %124, i32 %125, i32 %126, i32* %15, i64 4)
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %136
129: ; preds = %123
%130 = load i32, i32* @stderr
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%132 = load i32, i32* %14
%133 = call i32 @close(i32 %132)
%134 = load i32, i32* @EXIT_FAILURE
%135 = call i32 @exit(i32 %134)
unreachable
136: ; preds = %123
%137 = load i32, i32* %14
%138 = load i32, i32* @SOL_SOCKET
%139 = load i32, i32* @SO_BINDTODEVICE
%140 = load i32, i32* @IFNAMSIZ
%141 = sub nsw i32 %140, 1
%142 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %137, i32 %138, i32 %139, i8* %30, i32 %141)
%143 = icmp eq i32 %142, -1
br i1 %143, label %144, label %151
144: ; preds = %136
%145 = load i32, i32* @stderr
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %145, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%147 = load i32, i32* %14
%148 = call i32 @close(i32 %147)
%149 = load i32, i32* @EXIT_FAILURE
%150 = call i32 @exit(i32 %149)
unreachable
151: ; preds = %136
%152 = load i32, i32* %4
%153 = icmp sgt i32 %152, 5
br i1 %153, label %154, label %176
154: ; preds = %151
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 5
%157 = load i8*, i8** %156
%158 = load i32, i32* @O_WRONLY
%159 = load i32, i32* @O_CREAT
%160 = or i32 %158, %159
%161 = load i32, i32* @O_TRUNC
%162 = or i32 %160, %161
%163 = call i32 @open(i8* %157, i32 %162)
store i32 %163, i32* %13
%164 = load i32, i32* %13
%165 = icmp eq i32 %164, -1
br i1 %165, label %166, label %175
166: ; preds = %154
%167 = load i32, i32* @stderr
%168 = load i8**, i8*** %5
%169 = getelementptr inbounds i8*, i8** %168, i64 5
%170 = load i8*, i8** %169
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %170)
%172 = load i32, i32* %14
%173 = call i32 @close(i32 %172)
%174 = call i32 @exit(i32 1)
unreachable
175: ; preds = %154
br label %176
176: ; preds = %175, %151
%177 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
br label %178
178: ; preds = %219, %176
%179 = load i32, i32* %14
%180 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 0
%181 = load i32, i32* %23
%182 = call i32 @recvfrom(i32 %179, i8* %180, i32 %181, i32 0, i32* null, i32* null)
store i32 %182, i32* %22
%183 = load i32, i32* %22
%184 = icmp sle i32 %183, 0
br i1 %184, label %185, label %195
185: ; preds = %178
%186 = load i64, i64* @errno
%187 = icmp eq i64 %186, 0
br i1 %187, label %188, label %189
188: ; preds = %185
br label %225
189: ; preds = %185
%190 = load i32, i32* @stderr
%191 = load i32, i32* %22
%192 = load i64, i64* @errno
%193 = call i32 (i32, i8*, ...) @fprintf(i32 %190, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %191, i64 %192)
%194 = call i32 @exit(i32 1)
unreachable
195: ; preds = %178
%196 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 0
%197 = load i8, i8* %196
%198 = sext i8 %197 to i32
%199 = icmp eq i32 %198, 61
br i1 %199, label %200, label %211
200: ; preds = %195
%201 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 1
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = icmp eq i32 %203, 63
br i1 %204, label %205, label %211
205: ; preds = %200
%206 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 2
%207 = load i8, i8* %206
%208 = sext i8 %207 to i32
%209 = icmp eq i32 %208, 33
br i1 %209, label %210, label %211
210: ; preds = %205
br label %225
211: ; preds = %205, %200, %195
%212 = load i32, i32* %4
%213 = icmp sgt i32 %212, 5
br i1 %213, label %214, label %219
214: ; preds = %211
%215 = load i32, i32* %13
%216 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 0
%217 = load i32, i32* %22
%218 = call i32 @write(i32 %215, i8* %216, i32 %217)
br label %219
219: ; preds = %214, %211
%220 = load i32, i32* %22
%221 = load i32, i32* %6
%222 = add nsw i32 %221, %220
store i32 %222, i32* %6
%223 = load i32, i32* %6
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %223)
br label %178
225: ; preds = %210, %188
%226 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%227 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%228 = load double, double* %227
%229 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%230 = load double, double* %229
%231 = fsub double %228, %230
%232 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%233 = load double, double* %232
%234 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%235 = load double, double* %234
%236 = fsub double %233, %235
%237 = fdiv double %236, 1.000000e+06
%238 = fadd double %231, %237
store double %238, double* %7
%239 = load i32, i32* %6
%240 = load double, double* %7
%241 = load i32, i32* %6
%242 = mul nsw i32 %241, 8
%243 = sitofp i32 %242 to double
%244 = load double, double* %7
%245 = fdiv double %243, %244
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0), i32 %239, double %240, double %245)
%247 = load i32, i32* %14
%248 = call i32 @close(i32 %247)
%249 = load i32, i32* %4
%250 = icmp sgt i32 %249, 5
br i1 %250, label %251, label %254
251: ; preds = %225
%252 = load i32, i32* %13
%253 = call i32 @close(i32 %252)
br label %254
254: ; preds = %251, %225
store i32 0, i32* %3
%255 = load i8*, i8** %20
%256 = load i32, i32* %3
ret i32 %256
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@IFNAMSIZ = global i32 0
@.str = [98 x i8] c"Usage: %s <ip> <port> <[optional] recvsize (bytes)> <[optional] interface> <[optional] filepath>\0A\00"
@.str.1 = [6 x i8] c"wlan0\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [5 x i8] c"!?=\0A\00"
@.str.3 = [29 x i8] c"! Trigger the initialization\00"
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"! raw socket error.\0A\00"
@SIOCGIFFLAGS = global i32 0
@.str.5 = [41 x i8] c"! SIOCGIFFLAGS error. Check permission.\0A\00"
@EXIT_FAILURE = global i32 0
@IFF_PROMISC = global i32 0
@SIOCSIFFLAGS = global i32 0
@.str.6 = [41 x i8] c"! SIOCSIFFLAGS error. Check permission.\0A\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.7 = [22 x i8] c"! setsockopt error. \0A\00"
@SO_BINDTODEVICE = global i32 0
@.str.8 = [27 x i8] c"! SO_BINDTODEVICE error. \0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.9 = [27 x i8] c"! Unable to open file %s.\0A\00"
@errno = global i64 0
@.str.10 = [43 x i8] c"! Fail to recv: ret:%d, err:%d; quiting..\0A\00"
@.str.11 = [28 x i8] c"after: total_bytes_recv %d\0A\00"
@.str.12 = [52 x i8] c"sent(bytes):%d\0Aduration(s):%lf\0Athroughput(bps):%lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca <2 x double>
%4 = bitcast <2 x double>* %3 to %struct.timeval*
%5 = alloca <2 x double>
%6 = bitcast <2 x double>* %5 to %struct.timeval*
%7 = alloca i32
%8 = alloca [65535 x i8]
%9 = alloca %struct.ifreq
%10 = alloca %struct.sockaddr_in
%11 = bitcast <2 x double>* %3 to i8*
%12 = bitcast <2 x double>* %5 to i8*
%13 = bitcast i32* %7 to i8*
%14 = getelementptr inbounds [65535 x i8], [65535 x i8]* %8, i64 0, i64 0
%15 = bitcast %struct.ifreq* %9 to i8*
%16 = bitcast %struct.sockaddr_in* %10 to i8*
%17 = load i32, i32* @IFNAMSIZ
%18 = zext i32 %17 to i64
%19 = tail call i8* @llvm.stacksave()
%20 = alloca i8, i64 %18
%21 = icmp slt i32 %0, 3
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load i8*, i8** %1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = tail call i32 @exit(i32 0)
unreachable
26: ; preds = %2
%27 = icmp eq i32 %0, 3
br i1 %27, label %36, label %28
28: ; preds = %26
%29 = getelementptr inbounds i8*, i8** %1, i64 3
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = icmp ugt i32 %0, 4
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = getelementptr inbounds i8*, i8** %1, i64 4
%35 = load i8*, i8** %34
br label %36
36: ; preds = %28, %26, %33
%37 = phi i8* [ %35, %33 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %26 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %28 ]
%38 = phi i32 [ %31, %33 ], [ 1500, %26 ], [ %31, %28 ]
%39 = call i32 @strcpy(i8* %20, i8* %37)
%40 = load i32, i32* @AF_INET
%41 = load i32, i32* @SOCK_DGRAM
%42 = call i32 @socket(i32 %40, i32 %41, i32 0)
%43 = call i32 @bzero(%struct.sockaddr_in* %10, i32 12)
%44 = load i32, i32* @AF_INET
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 2
store i32 %44, i32* %45
%46 = getelementptr inbounds i8*, i8** %1, i64 1
%47 = load i8*, i8** %46
%48 = call i32 @inet_addr(i8* %47)
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 1, i32 0
store i32 %48, i32* %49
%50 = getelementptr inbounds i8*, i8** %1, i64 2
%51 = load i8*, i8** %50
%52 = call i32 @atoi(i8* %51)
%53 = call i32 @htons(i32 %52)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 0
store i32 %53, i32* %54
%55 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%56 = call i32 @sendto(i32 %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 0, %struct.sockaddr* %55, i32 12)
%57 = icmp slt i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %36
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %58, %36
%61 = load i32, i32* @PF_PACKET
%62 = load i32, i32* @SOCK_RAW
%63 = call i32 @htons(i32 3)
%64 = call i32 @socket(i32 %61, i32 %62, i32 %63)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %70
66: ; preds = %60
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %60
%71 = call i32 @memset(%struct.ifreq* %9, i32 0, i32 8)
%72 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %9, i64 0, i32 1
%73 = load i32, i32* %72
%74 = load i32, i32* @IFNAMSIZ
%75 = add nsw i32 %74, -1
%76 = call i32 @strncpy(i32 %73, i8* %20, i32 %75)
%77 = load i32, i32* @SIOCGIFFLAGS
%78 = call i64 @ioctl(i32 %64, i32 %77, %struct.ifreq* %9)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %70
%81 = load i32, i32* @stderr
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%83 = load i32, i32* @EXIT_FAILURE
%84 = call i32 @exit(i32 %83)
unreachable
85: ; preds = %70
%86 = load i32, i32* @IFF_PROMISC
%87 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %9, i64 0, i32 0
%88 = load i32, i32* %87
%89 = or i32 %88, %86
store i32 %89, i32* %87
%90 = load i32, i32* @SIOCSIFFLAGS
%91 = call i64 @ioctl(i32 %64, i32 %90, %struct.ifreq* %9)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %85
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%96 = load i32, i32* @EXIT_FAILURE
%97 = call i32 @exit(i32 %96)
unreachable
98: ; preds = %85
%99 = load i32, i32* @SOL_SOCKET
%100 = load i32, i32* @SO_REUSEADDR
%101 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %64, i32 %99, i32 %100, i32* %7, i64 4)
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %109
103: ; preds = %98
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%106 = call i32 @close(i32 %64)
%107 = load i32, i32* @EXIT_FAILURE
%108 = call i32 @exit(i32 %107)
unreachable
109: ; preds = %98
%110 = load i32, i32* @SOL_SOCKET
%111 = load i32, i32* @SO_BINDTODEVICE
%112 = load i32, i32* @IFNAMSIZ
%113 = add nsw i32 %112, -1
%114 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %64, i32 %110, i32 %111, i8* %20, i32 %113)
%115 = icmp eq i32 %114, -1
br i1 %115, label %116, label %122
116: ; preds = %109
%117 = load i32, i32* @stderr
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%119 = call i32 @close(i32 %64)
%120 = load i32, i32* @EXIT_FAILURE
%121 = call i32 @exit(i32 %120)
unreachable
122: ; preds = %109
%123 = icmp ugt i32 %0, 5
br i1 %123, label %124, label %140
124: ; preds = %122
%125 = getelementptr inbounds i8*, i8** %1, i64 5
%126 = load i8*, i8** %125
%127 = load i32, i32* @O_WRONLY
%128 = load i32, i32* @O_CREAT
%129 = or i32 %128, %127
%130 = load i32, i32* @O_TRUNC
%131 = or i32 %129, %130
%132 = call i32 @open(i8* %126, i32 %131)
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %140
134: ; preds = %124
%135 = load i32, i32* @stderr
%136 = load i8*, i8** %125
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %136)
%138 = call i32 @close(i32 %64)
%139 = call i32 @exit(i32 1)
unreachable
140: ; preds = %124, %122
%141 = phi i32 [ %132, %124 ], [ undef, %122 ]
%142 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%143 = call i32 @recvfrom(i32 %64, i8* %14, i32 %38, i32 0, i32* null, i32* null)
%144 = icmp slt i32 %143, 1
br i1 %144, label %148, label %145
145: ; preds = %140
%146 = getelementptr inbounds [65535 x i8], [65535 x i8]* %8, i64 0, i64 1
%147 = getelementptr inbounds [65535 x i8], [65535 x i8]* %8, i64 0, i64 2
br label %157
148: ; preds = %171, %140
%149 = phi i32 [ 0, %140 ], [ %172, %171 ]
%150 = phi i32 [ %143, %140 ], [ %174, %171 ]
%151 = load i64, i64* @errno
%152 = icmp eq i64 %151, 0
br i1 %152, label %176, label %153
153: ; preds = %148
%154 = load i32, i32* @stderr
%155 = call i32 (i32, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %150, i64 %151)
%156 = call i32 @exit(i32 1)
unreachable
157: ; preds = %145, %171
%158 = phi i32 [ %143, %145 ], [ %174, %171 ]
%159 = phi i32 [ 0, %145 ], [ %172, %171 ]
%160 = load i8, i8* %14
%161 = icmp eq i8 %160, 61
%162 = load i8, i8* %146
%163 = icmp eq i8 %162, 63
%164 = select i1 %161, i1 %163, i1 false
%165 = load i8, i8* %147
%166 = icmp eq i8 %165, 33
%167 = select i1 %164, i1 %166, i1 false
br i1 %167, label %176, label %168
168: ; preds = %157
br i1 %123, label %169, label %171
169: ; preds = %168
%170 = call i32 @write(i32 %141, i8* %14, i32 %158)
br label %171
171: ; preds = %169, %168
%172 = add nsw i32 %158, %159
%173 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %172)
%174 = call i32 @recvfrom(i32 %64, i8* %14, i32 %38, i32 0, i32* null, i32* null)
%175 = icmp slt i32 %174, 1
br i1 %175, label %148, label %157
176: ; preds = %157, %148
%177 = phi i32 [ %149, %148 ], [ %159, %157 ]
%178 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%179 = load <2 x double>, <2 x double>* %5
%180 = load <2 x double>, <2 x double>* %3
%181 = fsub <2 x double> %179, %180
%182 = extractelement <2 x double> %181, i64 1
%183 = fdiv double %182, 1.000000e+06
%184 = extractelement <2 x double> %181, i64 0
%185 = fadd double %184, %183
%186 = shl nsw i32 %177, 3
%187 = sitofp i32 %186 to double
%188 = fdiv double %187, %185
%189 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0), i32 %177, double %185, double %188)
%190 = call i32 @close(i32 %64)
br i1 %123, label %191, label %193
191: ; preds = %176
%192 = call i32 @close(i32 %141)
br label %193
193: ; preds = %191, %176
ret i32 0
}