#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 /*<<< orphan*/ turn_on;
struct utsname {
  int dummy;
};
struct TYPE_2__ {
  void *s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  scalar_t__ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct iphdr {
  int ihl;
  int version;
  int ttl;
  int protocol;
  void *daddr;
  void *saddr;
  scalar_t__ frag_off;
  void *id;
  void *tot_len;
  scalar_t__ tos;
};
struct in_addr {
  int dummy;
};
typedef int /*<<< orphan*/ iphdr;
typedef int /*<<< orphan*/ din;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_HDRINCL;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ close(int);
void *htons(int);
void *inet_addr(char *);
int /*<<< orphan*/ memset(char *, int, int);
int open(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int read(int, char *, int);
scalar_t__ sendto(int, struct iphdr *, int, int /*<<< orphan*/,
                  struct sockaddr *, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int);
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int /*<<< orphan*/ system(char *);
scalar_t__ uname(struct utsname *);
int main(int argc, char *args[]) {
  if (argc != 2) {
    printf("usage: ./ipPacketGenerator [Website]\n");
    return -1;
  }
  struct utsname myname;
  if (uname(&myname) < 0)
    return 0;
  struct in_addr in;
  char **addr;
  int type;
  int fd;
  int readn = 0;
  char buf[1024];
  char src_ip[1024] = " ";
  int num = 0;
  char *dest_ip;
  char *split_buf[30];
  int split_buf_num = 0;
  char name[20];
  system("ip addr | grep \"inet\" | grep \"brd\" >> temp.txt");
  fd = open("temp.txt", O_RDONLY, 0644);
  if (fd == -1) {
    printf("File open failed \n");
    return 1;
  }
  memset(buf, 0x00, 1024);
  readn = read(fd, buf, 1024 - 1);
  close(fd);
  system("rm temp.txt");
  printf(" %s\n", buf);
  split_buf[split_buf_num] = strtok(buf, " ");
  while (split_buf[split_buf_num] != NULL) {
    split_buf_num++;
    split_buf[split_buf_num] = strtok(NULL, " ");
  }
  strcpy(buf, split_buf[1]);
  while (1) {
    if (buf[num] == '/') {
      src_ip[num] = '\0';
      break;
    } else {
      src_ip[num] = buf[num];
      num++;
    }
  }
  num = 0;
  strcpy(buf, split_buf[6]);
  while (1) {
    if (buf[num] == '-') {
      name[num] = '\0';
      break;
    } else {
      name[num] = buf[num];
      num++;
    }
  }
  if (strcasecmp(args[1], "FACEBOOK") == 0)
    dest_ip = "10.0.0.201";
  else if (strcasecmp(args[1], "GOOGLE") == 0)
    dest_ip = "10.0.0.202";
  else if (strcasecmp(args[1], "NAVER") == 0)
    dest_ip = "10.0.0.203";
  else
    dest_ip = "10.0.0.204";
  char *srcIP = src_ip;
  ;
  char *destIP = dest_ip;
  printf("%s\n", srcIP);
  printf("%s\n", destIP);
  printf("%s\n", name);
  int sd = socket(PF_INET, SOCK_RAW, 145);
  if (sd < 0) {
    printf("socket() error\n");
    return -1;
  }
  int turn_on = 1;
  int turn_off = 0;
  if (setsockopt(sd, IPPROTO_IP, IP_HDRINCL, &turn_on, sizeof(turn_on)) < 0) {
    printf("setsockopt() error\n");
    return -1;
  }
  struct iphdr iphdr;
  struct sockaddr_in din;
  din.sin_family = AF_INET;
  din.sin_port = 0;
  din.sin_addr.s_addr = inet_addr(destIP);
  iphdr.ihl = 5;
  iphdr.version = 4;
  iphdr.tos = 0;
  iphdr.tot_len = htons(sizeof(struct iphdr));
  iphdr.id = htons(rand() % 65535);
  iphdr.frag_off = 0;
  iphdr.ttl = 64;
  iphdr.protocol = 145;
  iphdr.saddr = inet_addr(srcIP);
  iphdr.daddr = inet_addr(destIP);
  while (1) {
    if (sendto(sd, &iphdr, sizeof(iphdr), 0, (struct sockaddr *)&din,
               sizeof(din)) < 0) {
      printf("sendto() error\n");
      return -1;
    } else {
      printf("%s is trying to access www.%s.com\n", name, args[1]);
    }
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     124d <main+0x3d>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1780 <main+0x570>
lea    -0x18(%rbp),%rdi
call   1090 <uname@plt>
cmp    $0x0,%rax
jge    126c <main+0x5c>
movl   $0x0,-0x4(%rbp)
jmp    1780 <main+0x570>
movl   $0x0,-0x34(%rbp)
lea    -0x840(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
movb   $0x20,-0x840(%rbp)
movl   $0x0,-0x844(%rbp)
movl   $0x0,-0x944(%rbp)
lea    0xd7e(%rip),%rdi
call   1060 <system@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
lea    0xd8f(%rip),%rdi
mov    $0x1a4,%edx
call   10f0 <open@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    12ee <main+0xde>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1780 <main+0x570>
lea    -0x440(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x30(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x3ff,%edx
call   10d0 <read@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%edi
call   10c0 <close@plt>
lea    0xd41(%rip),%rdi
call   1060 <system@plt>
lea    -0x440(%rbp),%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x440(%rbp),%rdi
lea    0xd2a(%rip),%rsi
call   1100 <strtok@plt>
mov    %rax,%rcx
movslq -0x944(%rbp),%rax
mov    %rcx,-0x940(%rbp,%rax,8)
ff
movslq -0x944(%rbp),%rax
cmpq   $0x0,-0x940(%rbp,%rax,8)
je     13b2 <main+0x1a2>
mov    -0x944(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x944(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xce3(%rip),%rsi
call   1100 <strtok@plt>
mov    %rax,%rcx
movslq -0x944(%rbp),%rax
mov    %rcx,-0x940(%rbp,%rax,8)
ff
jmp    1366 <main+0x156>
lea    -0x440(%rbp),%rdi
mov    -0x938(%rbp),%rsi
call   1040 <strcpy@plt>
movslq -0x844(%rbp),%rax
movsbl -0x440(%rbp,%rax,1),%eax
ff
cmp    $0x2f,%eax
jne    13f1 <main+0x1e1>
movslq -0x844(%rbp),%rax
movb   $0x0,-0x840(%rbp,%rax,1)
jmp    1421 <main+0x211>
movslq -0x844(%rbp),%rax
mov    -0x440(%rbp,%rax,1),%cl
movslq -0x844(%rbp),%rax
mov    %cl,-0x840(%rbp,%rax,1)
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    13c5 <main+0x1b5>
movl   $0x0,-0x844(%rbp)
lea    -0x440(%rbp),%rdi
mov    -0x910(%rbp),%rsi
call   1040 <strcpy@plt>
movslq -0x844(%rbp),%rax
movsbl -0x440(%rbp,%rax,1),%eax
ff
cmp    $0x2d,%eax
jne    146a <main+0x25a>
movslq -0x844(%rbp),%rax
movb   $0x0,-0x960(%rbp,%rax,1)
jmp    149a <main+0x28a>
movslq -0x844(%rbp),%rax
mov    -0x440(%rbp,%rax,1),%cl
movslq -0x844(%rbp),%rax
mov    %cl,-0x960(%rbp,%rax,1)
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    143e <main+0x22e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xbd2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    14cb <main+0x2bb>
lea    0xbc5(%rip),%rax
mov    %rax,-0x850(%rbp)
jmp    1545 <main+0x335>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xbb5(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    14fc <main+0x2ec>
lea    0xba6(%rip),%rax
mov    %rax,-0x850(%rbp)
jmp    1540 <main+0x330>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xb96(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    152d <main+0x31d>
lea    0xb86(%rip),%rax
mov    %rax,-0x850(%rbp)
jmp    153b <main+0x32b>
lea    0xb7e(%rip),%rax
mov    %rax,-0x850(%rbp)
jmp    1540 <main+0x330>
jmp    1545 <main+0x335>
lea    -0x840(%rbp),%rax
mov    %rax,-0x968(%rbp)
mov    -0x850(%rbp),%rax
mov    %rax,-0x970(%rbp)
mov    -0x968(%rbp),%rsi
lea    0xb06(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x970(%rbp),%rsi
lea    0xaf1(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x960(%rbp),%rsi
lea    0xadc(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    0x2a11(%rip),%rax
mov    (%rax),%edi
mov    0x2a28(%rip),%rax
mov    (%rax),%esi
mov    $0x91,%edx
call   1130 <socket@plt>
mov    %eax,-0x974(%rbp)
cmpl   $0x0,-0x974(%rbp)
jge    15e9 <main+0x3d9>
lea    0xae7(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1780 <main+0x570>
movl   $0x1,-0x978(%rbp)
movl   $0x0,-0x97c(%rbp)
mov    -0x974(%rbp),%edi
mov    0x29be(%rip),%rax
mov    (%rax),%esi
mov    0x29dd(%rip),%rax
mov    (%rax),%edx
lea    -0x978(%rbp),%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
cmp    $0x0,%rax
jge    164b <main+0x43b>
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1780 <main+0x570>
mov    0x298e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c8(%rbp)
movq   $0x0,-0x9d0(%rbp)
mov    -0x970(%rbp),%rdi
call   10e0 <inet_addr@plt>
mov    %rax,-0x9d8(%rbp)
movl   $0x5,-0x9c0(%rbp)
movl   $0x4,-0x9bc(%rbp)
movq   $0x0,-0x988(%rbp)
mov    $0x40,%edi
call   1070 <htons@plt>
mov    %rax,-0x990(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0xffff,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1070 <htons@plt>
mov    %rax,-0x998(%rbp)
movq   $0x0,-0x9a0(%rbp)
movl   $0x40,-0x9b8(%rbp)
movl   $0x91,-0x9b4(%rbp)
mov    -0x968(%rbp),%rdi
call   10e0 <inet_addr@plt>
mov    %rax,-0x9a8(%rbp)
mov    -0x970(%rbp),%rdi
call   10e0 <inet_addr@plt>
mov    %rax,-0x9b0(%rbp)
mov    -0x974(%rbp),%edi
lea    -0x9d8(%rbp),%r8
lea    -0x9c0(%rbp),%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
mov    $0x18,%r9d
call   10b0 <sendto@plt>
cmp    $0x0,%rax
jge    1754 <main+0x544>
lea    0x9a0(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1780 <main+0x570>
lea    -0x960(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0x987(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1110 <sleep@plt>
jmp    170a <main+0x4fa>
mov    -0x4(%rbp),%eax
add    $0x9e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x988,%rsp
cmp    $0x2,%edi
jne    134a <main+0x12a>
mov    %rsi,%r15
lea    0x10(%rsp),%rdi
call   10a0 <uname@plt>
test   %rax,%rax
js     135d <main+0x13d>
lea    0x580(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   10b0 <memset@plt>
movb   $0x20,0x580(%rsp)
20
lea    0xd8d(%rip),%rdi
call   1070 <system@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
lea    0xd9e(%rip),%rdi
mov    $0x1a4,%edx
call   1100 <open@plt>
cmp    $0xffffffff,%eax
je     1361 <main+0x141>
mov    %eax,%ebp
lea    0x180(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
call   10e0 <read@plt>
mov    %ebp,%edi
call   10d0 <close@plt>
lea    0xd5e(%rip),%rdi
call   1070 <system@plt>
lea    0xd5e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xdf8(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1110 <strtok@plt>
mov    %rax,0x90(%rsp)
lea    0x98(%rsp),%rbx
nopl   0x0(%rax)
xor    %edi,%edi
mov    %rbp,%rsi
call   1110 <strtok@plt>
mov    %rax,(%rbx)
add    $0x8,%rbx
test   %rax,%rax
jne    1310 <main+0xf0>
mov    0x98(%rsp),%rsi
lea    0x180(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x180(%rsp),%al
cmp    $0x2f,%al
jne    1384 <main+0x164>
xor    %eax,%eax
jmp    13a9 <main+0x189>
lea    0xd97(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%eax
jmp    1372 <main+0x152>
xor    %eax,%eax
jmp    1372 <main+0x152>
lea    0xd6e(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
add    $0x988,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %al,0x580(%rsp,%rcx,1)
movzbl 0x181(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x2f,%al
jne    1390 <main+0x170>
mov    %ecx,%eax
movb   $0x0,0x580(%rsp,%rax,1)
mov    0xc0(%rsp),%rsi
lea    0x180(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x180(%rsp),%al
cmp    $0x2d,%al
jne    13d5 <main+0x1b5>
xor    %eax,%eax
jmp    13f6 <main+0x1d6>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %al,0x30(%rsp,%rcx,1)
movzbl 0x181(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x2d,%al
jne    13e0 <main+0x1c0>
mov    %ecx,%eax
movb   $0x0,0x30(%rsp,%rax,1)
mov    0x8(%r15),%rbx
lea    0xc3a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     144d <main+0x22d>
lea    0xc3a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1456 <main+0x236>
lea    0xc38(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xc2c(%rip),%rax
lea    0xc30(%rip),%r14
cmove  %rax,%r14
jmp    145d <main+0x23d>
lea    0xbf5(%rip),%r14
jmp    145d <main+0x23d>
lea    0xbfe(%rip),%r14
lea    0x580(%rsp),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
lea    0x30(%rsp),%rdi
call   1050 <puts@plt>
mov    0x2b35(%rip),%rax
mov    (%rax),%edi
mov    0x2b4c(%rip),%rax
mov    (%rax),%esi
mov    $0x91,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     1617 <main+0x3f7>
mov    %eax,%r12d
movl   $0x1,0xc(%rsp)
mov    0x2b16(%rip),%rax
mov    (%rax),%esi
mov    0x2b35(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r12d,%edi
mov    $0x4,%r8d
call   1060 <setsockopt@plt>
test   %rax,%rax
js     1623 <main+0x403>
mov    0x2b00(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
movq   $0x0,0x20(%rsp)
mov    %r14,%rdi
call   10f0 <inet_addr@plt>
mov    %rax,0x18(%rsp)
movabs $0x400000005,%rax
mov    %rax,0x50(%rsp)
movq   $0x0,0x88(%rsp)
mov    $0x40,%edi
call   1080 <htons@plt>
mov    %rax,0x80(%rsp)
xor    %eax,%eax
call   1130 <rand@plt>
cltq
imul   $0xffffffff80008001,%rax,%rdi
shr    $0x20,%rdi
add    %eax,%edi
mov    %edi,%ecx
shr    $0x1f,%ecx
sar    $0xf,%edi
add    %ecx,%edi
mov    %edi,%ecx
shl    $0x10,%ecx
sub    %ecx,%edi
add    %eax,%edi
call   1080 <htons@plt>
mov    %rax,0x78(%rsp)
movq   $0x0,0x70(%rsp)
movabs $0x9100000040,%rax
mov    %rax,0x58(%rsp)
lea    0x580(%rsp),%rdi
call   10f0 <inet_addr@plt>
mov    %rax,0x68(%rsp)
mov    %r14,%rdi
call   10f0 <inet_addr@plt>
mov    %rax,0x60(%rsp)
lea    0x50(%rsp),%rsi
lea    0x18(%rsp),%r8
mov    %r12d,%edi
mov    $0x40,%edx
xor    %ecx,%ecx
mov    $0x18,%r9d
call   10c0 <sendto@plt>
test   %rax,%rax
js     160b <main+0x3eb>
lea    0xac4(%rip),%r14
lea    0x30(%rsp),%r13
lea    0x50(%rsp),%rbx
lea    0x18(%rsp),%rbp
nopl   (%rax)
mov    0x8(%r15),%rdx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
mov    $0x18,%r9d
call   10c0 <sendto@plt>
test   %rax,%rax
jns    15d0 <main+0x3b0>
lea    0xa93(%rip),%rdi
jmp    1351 <main+0x131>
lea    0xaa9(%rip),%rdi
jmp    1351 <main+0x131>
lea    0xa8a(%rip),%rdi
jmp    1351 <main+0x131>

LLVM IR (-O0):
%struct.utsname = type { i32 }
%struct.in_addr = type { i32 }
%struct.iphdr = type { i32, i32, i32, i32, i8*, i8*, i64, i8*, i8*, i64 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@.str = [38 x i8] c"usage: ./ipPacketGenerator [Website]\0A\00"
@.str.1 = [47 x i8] c"ip addr | grep \22inet\22 | grep \22brd\22 >> temp.txt\00"
@.str.2 = [9 x i8] c"temp.txt\00"
@O_RDONLY = global i32 0
@.str.3 = [19 x i8] c"File open failed \0A\00"
@.str.4 = [12 x i8] c"rm temp.txt\00"
@.str.5 = [5 x i8] c" %s\0A\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [9 x i8] c"FACEBOOK\00"
@.str.8 = [11 x i8] c"10.0.0.201\00"
@.str.9 = [7 x i8] c"GOOGLE\00"
@.str.10 = [11 x i8] c"10.0.0.202\00"
@.str.11 = [6 x i8] c"NAVER\00"
@.str.12 = [11 x i8] c"10.0.0.203\00"
@.str.13 = [11 x i8] c"10.0.0.204\00"
@.str.14 = [4 x i8] c"%s\0A\00"
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@.str.15 = [16 x i8] c"socket() error\0A\00"
@IPPROTO_IP = global i32 0
@IP_HDRINCL = global i32 0
@.str.16 = [20 x i8] c"setsockopt() error\0A\00"
@AF_INET = global i32 0
@.str.17 = [16 x i8] c"sendto() error\0A\00"
@.str.18 = [35 x i8] c"%s is trying to access www.%s.com\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.utsname
%7 = alloca %struct.in_addr
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca [1024 x i8]
%14 = alloca i32
%15 = alloca i8*
%16 = alloca [30 x i8*]
%17 = alloca i32
%18 = alloca [20 x i8]
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca %struct.iphdr
%25 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 2
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %217
30: ; preds = %2
%31 = call i64 @uname(%struct.utsname* %6)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 0, i32* %3
br label %217
34: ; preds = %30
store i32 0, i32* %11
%35 = bitcast [1024 x i8]* %13 to i8*
%36 = bitcast i8* %35 to [1024 x i8]*
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %36, i32 0, i32 0
store i8 32, i8* %37
store i32 0, i32* %14
store i32 0, i32* %17
%38 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* @O_RDONLY
%40 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %39, i32 420)
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %45
43: ; preds = %34
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %217
45: ; preds = %34
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%47 = call i32 @memset(i8* %46, i32 0, i32 1024)
%48 = load i32, i32* %10
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%50 = call i32 @read(i32 %48, i8* %49, i32 1023)
store i32 %50, i32* %11
%51 = load i32, i32* %10
%52 = call i32 @close(i32 %51)
%53 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %54)
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%57 = call i8* @strtok(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%58 = load i32, i32* %17
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [30 x i8*], [30 x i8*]* %16, i64 0, i64 %59
store i8* %57, i8** %60
br label %61
61: ; preds = %67, %45
%62 = load i32, i32* %17
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [30 x i8*], [30 x i8*]* %16, i64 0, i64 %63
%65 = load i8*, i8** %64
%66 = icmp ne i8* %65, null
br i1 %66, label %67, label %74
67: ; preds = %61
%68 = load i32, i32* %17
%69 = add nsw i32 %68, 1
store i32 %69, i32* %17
%70 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%71 = load i32, i32* %17
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [30 x i8*], [30 x i8*]* %16, i64 0, i64 %72
store i8* %70, i8** %73
br label %61
74: ; preds = %61
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%76 = getelementptr inbounds [30 x i8*], [30 x i8*]* %16, i64 0, i64 1
%77 = load i8*, i8** %76
%78 = call i32 @strcpy(i8* %75, i8* %77)
br label %79
79: ; preds = %74, %100
%80 = load i32, i32* %14
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 47
br i1 %85, label %86, label %90
86: ; preds = %79
%87 = load i32, i32* %14
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 %88
store i8 0, i8* %89
br label %101
90: ; preds = %79
%91 = load i32, i32* %14
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %92
%94 = load i8, i8* %93
%95 = load i32, i32* %14
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 %96
store i8 %94, i8* %97
%98 = load i32, i32* %14
%99 = add nsw i32 %98, 1
store i32 %99, i32* %14
br label %100
100: ; preds = %90
br label %79
101: ; preds = %86
store i32 0, i32* %14
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%103 = getelementptr inbounds [30 x i8*], [30 x i8*]* %16, i64 0, i64 6
%104 = load i8*, i8** %103
%105 = call i32 @strcpy(i8* %102, i8* %104)
br label %106
106: ; preds = %101, %127
%107 = load i32, i32* %14
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %108
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 45
br i1 %112, label %113, label %117
113: ; preds = %106
%114 = load i32, i32* %14
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 %115
store i8 0, i8* %116
br label %128
117: ; preds = %106
%118 = load i32, i32* %14
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %119
%121 = load i8, i8* %120
%122 = load i32, i32* %14
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 %123
store i8 %121, i8* %124
%125 = load i32, i32* %14
%126 = add nsw i32 %125, 1
store i32 %126, i32* %14
br label %127
127: ; preds = %117
br label %106
128: ; preds = %113
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = call i64 @strcasecmp(i8* %131, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %135
134: ; preds = %128
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8** %15
br label %152
135: ; preds = %128
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 1
%138 = load i8*, i8** %137
%139 = call i64 @strcasecmp(i8* %138, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %142
141: ; preds = %135
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8** %15
br label %151
142: ; preds = %135
%143 = load i8**, i8*** %5
%144 = getelementptr inbounds i8*, i8** %143, i64 1
%145 = load i8*, i8** %144
%146 = call i64 @strcasecmp(i8* %145, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %149
148: ; preds = %142
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8** %15
br label %150
149: ; preds = %142
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8** %15
br label %150
150: ; preds = %149, %148
br label %151
151: ; preds = %150, %141
br label %152
152: ; preds = %151, %134
%153 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
store i8* %153, i8** %19
%154 = load i8*, i8** %15
store i8* %154, i8** %20
%155 = load i8*, i8** %19
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %155)
%157 = load i8*, i8** %20
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %157)
%159 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %159)
%161 = load i32, i32* @PF_INET
%162 = load i32, i32* @SOCK_RAW
%163 = call i32 @socket(i32 %161, i32 %162, i32 145)
store i32 %163, i32* %21
%164 = load i32, i32* %21
%165 = icmp slt i32 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %152
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
store i32 -1, i32* %3
br label %217
168: ; preds = %152
store i32 1, i32* %22
store i32 0, i32* %23
%169 = load i32, i32* %21
%170 = load i32, i32* @IPPROTO_IP
%171 = load i32, i32* @IP_HDRINCL
%172 = call i64 @setsockopt(i32 %169, i32 %170, i32 %171, i32* %22, i32 4)
%173 = icmp slt i64 %172, 0
br i1 %173, label %174, label %176
174: ; preds = %168
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
store i32 -1, i32* %3
br label %217
176: ; preds = %168
%177 = load i32, i32* @AF_INET
%178 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %25, i32 0, i32 2
store i32 %177, i32* %178
%179 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %25, i32 0, i32 1
store i64 0, i64* %179
%180 = load i8*, i8** %20
%181 = call i8* @inet_addr(i8* %180)
%182 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %25, i32 0, i32 0
%183 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %182, i32 0, i32 0
store i8* %181, i8** %183
%184 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 0
store i32 5, i32* %184
%185 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 1
store i32 4, i32* %185
%186 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 9
store i64 0, i64* %186
%187 = call i8* @htons(i32 64)
%188 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 8
store i8* %187, i8** %188
%189 = call i32 (...) @rand()
%190 = srem i32 %189, 65535
%191 = call i8* @htons(i32 %190)
%192 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 7
store i8* %191, i8** %192
%193 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 6
store i64 0, i64* %193
%194 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 2
store i32 64, i32* %194
%195 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 3
store i32 145, i32* %195
%196 = load i8*, i8** %19
%197 = call i8* @inet_addr(i8* %196)
%198 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 5
store i8* %197, i8** %198
%199 = load i8*, i8** %20
%200 = call i8* @inet_addr(i8* %199)
%201 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 4
store i8* %200, i8** %201
br label %202
202: ; preds = %176, %215
%203 = load i32, i32* %21
%204 = bitcast %struct.sockaddr_in* %25 to %struct.sockaddr*
%205 = call i64 @sendto(i32 %203, %struct.iphdr* %24, i32 64, i32 0, %struct.sockaddr* %204, i32 24)
%206 = icmp slt i64 %205, 0
br i1 %206, label %207, label %209
207: ; preds = %202
%208 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0))
store i32 -1, i32* %3
br label %217
209: ; preds = %202
%210 = getelementptr inbounds [20 x i8], [20 x i8]* %18, i64 0, i64 0
%211 = load i8**, i8*** %5
%212 = getelementptr inbounds i8*, i8** %211, i64 1
%213 = load i8*, i8** %212
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i8* %210, i8* %213)
br label %215
215: ; preds = %209
%216 = call i32 @sleep(i32 1)
br label %202
217: ; preds = %207, %174, %166, %43, %33, %28
%218 = load i32, i32* %3
ret i32 %218
}

LLVM IR (-O2):
%struct.utsname = type { i32 }
%struct.iphdr = type { i32, i32, i32, i32, i8*, i8*, i64, i8*, i8*, i64 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@.str.1 = [47 x i8] c"ip addr | grep \22inet\22 | grep \22brd\22 >> temp.txt\00"
@.str.2 = [9 x i8] c"temp.txt\00"
@O_RDONLY = global i32 0
@.str.4 = [12 x i8] c"rm temp.txt\00"
@.str.5 = [5 x i8] c" %s\0A\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [9 x i8] c"FACEBOOK\00"
@.str.8 = [11 x i8] c"10.0.0.201\00"
@.str.9 = [7 x i8] c"GOOGLE\00"
@.str.10 = [11 x i8] c"10.0.0.202\00"
@.str.11 = [6 x i8] c"NAVER\00"
@.str.12 = [11 x i8] c"10.0.0.203\00"
@.str.13 = [11 x i8] c"10.0.0.204\00"
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_IP = global i32 0
@IP_HDRINCL = global i32 0
@AF_INET = global i32 0
@.str.18 = [35 x i8] c"%s is trying to access www.%s.com\0A\00"
@str = [15 x i8] c"sendto() error\00"
@str.19 = [19 x i8] c"setsockopt() error\00"
@str.20 = [15 x i8] c"socket() error\00"
@str.21 = [18 x i8] c"File open failed \00"
@str.22 = [37 x i8] c"usage: ./ipPacketGenerator [Website]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.utsname
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [30 x i8*]
%7 = alloca [20 x i8]
%8 = alloca i32
%9 = alloca %struct.iphdr
%10 = alloca %struct.sockaddr_in
%11 = icmp eq i32 %0, 2
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.22, i64 0, i64 0))
br label %151
14: ; preds = %2
%15 = bitcast %struct.utsname* %3 to i8*
%16 = call i64 @uname(%struct.utsname* %3)
%17 = icmp slt i64 %16, 0
br i1 %17, label %149, label %18
18: ; preds = %14
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
store i8 32, i8* %20
%21 = bitcast [30 x i8*]* %6 to i8*
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%23 = tail call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @O_RDONLY
%25 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 420)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %18
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.21, i64 0, i64 0))
br label %147
29: ; preds = %18
%30 = call i32 @memset(i8* %19, i32 0, i32 1024)
%31 = call i32 @read(i32 %25, i8* %19, i32 1023)
%32 = call i32 @close(i32 %25)
%33 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%35 = call i8* @strtok(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%36 = getelementptr inbounds [30 x i8*], [30 x i8*]* %6, i64 0, i64 0
store i8* %35, i8** %36
%37 = icmp ne i8* %35, null
br label %38
38: ; preds = %29, %38
%39 = phi i64 [ %40, %38 ], [ 0, %29 ]
%40 = add nuw nsw i64 %39, 1
%41 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%42 = getelementptr inbounds [30 x i8*], [30 x i8*]* %6, i64 0, i64 %40
store i8* %41, i8** %42
%43 = icmp eq i8* %41, null
br i1 %43, label %44, label %38
44: ; preds = %38
%45 = getelementptr inbounds [30 x i8*], [30 x i8*]* %6, i64 0, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @strcpy(i8* %19, i8* %46)
%48 = load i8, i8* %19
%49 = icmp eq i8 %48, 47
br i1 %49, label %52, label %60
50: ; preds = %60
%51 = and i64 %64, 4294967295
br label %52
52: ; preds = %50, %44
%53 = phi i64 [ 0, %44 ], [ %51, %50 ]
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %53
store i8 0, i8* %54
%55 = getelementptr inbounds [30 x i8*], [30 x i8*]* %6, i64 0, i64 6
%56 = load i8*, i8** %55
%57 = call i32 @strcpy(i8* %19, i8* %56)
%58 = load i8, i8* %19
%59 = icmp eq i8 %58, 45
br i1 %59, label %70, label %77
60: ; preds = %44, %60
%61 = phi i64 [ %64, %60 ], [ 0, %44 ]
%62 = phi i8 [ %66, %60 ], [ %48, %44 ]
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %61
store i8 %62, i8* %63
%64 = add nuw nsw i64 %61, 1
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 47
br i1 %67, label %50, label %60
68: ; preds = %77
%69 = and i64 %81, 4294967295
br label %70
70: ; preds = %68, %52
%71 = phi i64 [ 0, %52 ], [ %69, %68 ]
%72 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %71
store i8 0, i8* %72
%73 = getelementptr inbounds i8*, i8** %1, i64 1
%74 = load i8*, i8** %73
%75 = call i64 @strcasecmp(i8* %74, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %92, label %85
77: ; preds = %52, %77
%78 = phi i64 [ %81, %77 ], [ 0, %52 ]
%79 = phi i8 [ %83, %77 ], [ %58, %52 ]
%80 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %78
store i8 %79, i8* %80
%81 = add nuw nsw i64 %78, 1
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = icmp eq i8 %83, 45
br i1 %84, label %68, label %77
85: ; preds = %70
%86 = call i64 @strcasecmp(i8* %74, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %85
%89 = call i64 @strcasecmp(i8* %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
%91 = select i1 %90, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0)
br label %92
92: ; preds = %88, %85, %70
%93 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), %70 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %85 ], [ %91, %88 ]
%94 = call i32 @puts(i8* %20)
%95 = call i32 @puts(i8* dereferenceable(1) %93)
%96 = call i32 @puts(i8* %22)
%97 = load i32, i32* @PF_INET
%98 = load i32, i32* @SOCK_RAW
%99 = call i32 @socket(i32 %97, i32 %98, i32 145)
%100 = icmp slt i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %92
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
br label %147
103: ; preds = %92
%104 = bitcast i32* %8 to i8*
store i32 1, i32* %8
%105 = load i32, i32* @IPPROTO_IP
%106 = load i32, i32* @IP_HDRINCL
%107 = call i64 @setsockopt(i32 %99, i32 %105, i32 %106, i32* %8, i32 4)
%108 = icmp slt i64 %107, 0
br i1 %108, label %109, label %111
109: ; preds = %103
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0))
br label %146
111: ; preds = %103
%112 = bitcast %struct.iphdr* %9 to i8*
%113 = bitcast %struct.sockaddr_in* %10 to i8*
%114 = load i32, i32* @AF_INET
%115 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 2
store i32 %114, i32* %115
%116 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 1
store i64 0, i64* %116
%117 = call i8* @inet_addr(i8* %93)
%118 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 0, i32 0
store i8* %117, i8** %118
%119 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 0
store i32 5, i32* %119
%120 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 1
store i32 4, i32* %120
%121 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 9
store i64 0, i64* %121
%122 = call i8* @htons(i32 64)
%123 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 8
store i8* %122, i8** %123
%124 = call i32 (...) @rand()
%125 = srem i32 %124, 65535
%126 = call i8* @htons(i32 %125)
%127 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 7
store i8* %126, i8** %127
%128 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 6
store i64 0, i64* %128
%129 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 2
store i32 64, i32* %129
%130 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 3
store i32 145, i32* %130
%131 = call i8* @inet_addr(i8* %20)
%132 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 5
store i8* %131, i8** %132
%133 = call i8* @inet_addr(i8* %93)
%134 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %9, i64 0, i32 4
store i8* %133, i8** %134
%135 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%136 = call i64 @sendto(i32 %99, %struct.iphdr* %9, i32 64, i32 0, %struct.sockaddr* %135, i32 24)
%137 = icmp slt i64 %136, 0
br i1 %137, label %138, label %140
138: ; preds = %140, %111
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %146
140: ; preds = %111, %140
%141 = load i8*, i8** %73
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i8* %22, i8* %141)
%143 = call i32 @sleep(i32 1)
%144 = call i64 @sendto(i32 %99, %struct.iphdr* %9, i32 64, i32 0, %struct.sockaddr* %135, i32 24)
%145 = icmp slt i64 %144, 0
br i1 %145, label %138, label %140
146: ; preds = %138, %109
br label %147
147: ; preds = %101, %146, %27
%148 = phi i32 [ 1, %27 ], [ -1, %146 ], [ -1, %101 ]
br label %149
149: ; preds = %14, %147
%150 = phi i32 [ %148, %147 ], [ 0, %14 ]
br label %151
151: ; preds = %149, %12
%152 = phi i32 [ -1, %12 ], [ %150, %149 ]
ret i32 %152
}