#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 */
typedef size_t uint32_t;
typedef scalar_t__ uint16_t;
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  struct addrinfo *ai_next;
};
typedef int /*<<< orphan*/ packet;
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(scalar_t__ *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
scalar_t__ *malloc(int);
int /*<<< orphan*/ memcpy(scalar_t__ *, scalar_t__ *, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sendto(int, scalar_t__ *, int, int /*<<< orphan*/, int /*<<< orphan*/,
           int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int main(void) {
  int sockfd;
  struct addrinfo hints, *servinfo, *p;
  int rv;
  int numbytes;
  uint16_t packet[1470 / 2];
  int i = 0;
  int k = 0;
  uint16_t p_count = 0;
  uint16_t *megadata;
  uint32_t m_ind = 0;
  megadata = malloc(5996544 * sizeof(uint16_t));
  if (megadata == NULL) {
    printf("MALLOC FAIL!\n");
    return -1;
  }
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  if ((rv = getaddrinfo("127.0.0.1", "60000", &hints, &servinfo)) != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
    return 1;
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      perror("talker: socket");
      continue;
    }
    break;
  }
  if (p == NULL) {
    fprintf(stderr, "talker: failed to bind socket\n");
    return 2;
  }
  printf("About to loop the datas\n");
  printf("PACKET ROWS:%i \n", 1470 / 2 / 3);
  for (k = 0; k < 244; k++) {
    for (i = 1; i < 16384; i += 2) {
      megadata[m_ind] = (uint16_t)i;
      m_ind++;
      megadata[m_ind] = (uint16_t)i;
      m_ind++;
      megadata[m_ind] = (uint16_t)k;
      m_ind++;
    }
  }
  printf("MEGADATA INDEX: %i\n", m_ind);
  printf("TOTAL PHOTONS: %i\n\n", m_ind / 3);
  printf("Sending packets...\n");
  for (i = 0; i < 8192; i++) {
    packet[0] = (uint16_t)244;
    packet[1] = p_count;
    packet[2] = (uint16_t)0x0000;
    p_count++;
    memcpy(&packet[3], &megadata[i * 732], sizeof(uint16_t) * 732);
    if ((numbytes = sendto(sockfd, packet, sizeof(packet), 0, p->ai_addr,
                           p->ai_addrlen)) == -1) {
      perror("talker: sendto");
      exit(1);
    }
    usleep(1000);
  }
  printf("All packets sent\n");
  free(megadata);
  freeaddrinfo(servinfo);
  printf("END OF LINE\n");
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1770,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1744(%rbp)
movl   $0x0,-0x1748(%rbp)
movq   $0x0,-0x1750(%rbp)
movq   $0x0,-0x1760(%rbp)
mov    $0x2dc0000,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x1758(%rbp)
cmpq   $0x0,-0x1758(%rbp)
jne    1265 <main+0x75>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15e8 <main+0x3f8>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
lea    0xd7a(%rip),%rdi
lea    0xd7d(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     12ee <main+0xfe>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1764(%rbp)
mov    -0x3c(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0x1764(%rbp),%edi
mov    %rax,%rdx
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15e8 <main+0x3f8>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     134e <main+0x15e>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1338 <main+0x148>
lea    0xd01(%rip),%rdi
call   10c0 <perror@plt>
jmp    133d <main+0x14d>
jmp    134e <main+0x15e>
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    12f6 <main+0x106>
cmpq   $0x0,-0x38(%rbp)
jne    137c <main+0x18c>
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
lea    0xcd5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    15e8 <main+0x3f8>
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xce5(%rip),%rdi
mov    $0xf5,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1748(%rbp)
cmpl   $0xf4,-0x1748(%rbp)
jge    147f <main+0x28f>
movl   $0x1,-0x1744(%rbp)
cmpl   $0x4000,-0x1744(%rbp)
jge    1466 <main+0x276>
movslq -0x1744(%rbp),%rdx
mov    -0x1758(%rbp),%rax
mov    -0x1760(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1760(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1760(%rbp)
movslq -0x1744(%rbp),%rdx
mov    -0x1758(%rbp),%rax
mov    -0x1760(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1760(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1760(%rbp)
movslq -0x1748(%rbp),%rdx
mov    -0x1758(%rbp),%rax
mov    -0x1760(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1760(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1760(%rbp)
mov    -0x1744(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1744(%rbp)
jmp    13c1 <main+0x1d1>
jmp    146b <main+0x27b>
mov    -0x1748(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1748(%rbp)
jmp    13a7 <main+0x1b7>
mov    -0x1760(%rbp),%rsi
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1760(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
lea    0xbec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1744(%rbp)
cmpl   $0x2000,-0x1744(%rbp)
jge    15a8 <main+0x3b8>
movq   $0xf4,-0x1740(%rbp)
mov    -0x1750(%rbp),%rax
mov    %rax,-0x1738(%rbp)
movq   $0x0,-0x1730(%rbp)
mov    -0x1750(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1750(%rbp)
lea    -0x1740(%rbp),%rdi
add    $0x18,%rdi
mov    -0x1758(%rbp),%rsi
imul   $0x2dc,-0x1744(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x16e0,%edx
call   10a0 <memcpy@plt>
mov    -0x8(%rbp),%edi
lea    -0x1740(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x38(%rbp),%rax
mov    (%rax),%r9d
mov    $0x16f8,%edx
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0x40(%rbp)
cmp    $0xffffffff,%eax
jne    158a <main+0x39a>
lea    0xb48(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    $0x3e8,%edi
call   10f0 <usleep@plt>
mov    -0x1744(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1744(%rbp)
jmp    14ce <main+0x2de>
lea    0xb23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1758(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
lea    0xb12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1770,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1728,%rsp
mov    $0x2dc0000,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     129d <main+0x9d>
mov    %rax,%r15
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
lea    0xda8(%rip),%rdi
lea    0xdab(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %rbp,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
je     12b3 <main+0xb3>
mov    0x2d59(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1060 <gai_strerror@plt>
lea    0xd89(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%eax
jmp    147a <main+0x27a>
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    147a <main+0x27a>
mov    0x8(%rsp),%r13
test   %r13,%r13
je     12eb <main+0xeb>
lea    0xd5d(%rip),%rbp
mov    0x10(%r13),%edi
mov    0x8(%r13),%edx
mov    0xc(%r13),%esi
call   1120 <socket@plt>
cmp    $0xffffffff,%eax
jne    130c <main+0x10c>
mov    %rbp,%rdi
call   10d0 <perror@plt>
mov    0x18(%r13),%r13
test   %r13,%r13
jne    12c4 <main+0xc4>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
lea    0xd35(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x2,%eax
jmp    147a <main+0x27a>
mov    %eax,%r12d
lea    0xd81(%rip),%rdi
call   1040 <puts@plt>
lea    0xd2d(%rip),%rdi
xor    %ebx,%ebx
mov    $0xf5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,(%r15,%rbp,8)
mov    %rax,0x8(%r15,%rbp,8)
mov    %rbx,0x10(%r15,%rbp,8)
lea    0x2(%rax),%rcx
mov    %rcx,0x18(%r15,%rbp,8)
mov    %rcx,0x20(%r15,%rbp,8)
mov    %rbx,0x28(%r15,%rbp,8)
add    $0x6,%rbp
lea    0x4(%rax),%rcx
cmp    $0x3ffc,%rax
mov    %rcx,%rax
jb     1350 <main+0x150>
add    $0x1,%rbx
cmp    $0xf4,%rbx
jne    1340 <main+0x140>
lea    0xcc8(%rip),%rdi
xor    %r14d,%r14d
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mov    %rbp,%rax
mul    %rcx
shr    %rdx
lea    0xcb5(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcdf(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rbx
mov    %r15,%rbp
nopl   (%rax)
movq   $0xf4,0x30(%rsp)
mov    %r14,0x38(%rsp)
movq   $0x0,0x40(%rsp)
lea    0x48(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x16e0,%edx
call   10b0 <memcpy@plt>
mov    0x0(%r13),%r9d
mov    0x4(%r13),%r8d
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x16f8,%edx
xor    %ecx,%ecx
call   1080 <sendto@plt>
cmp    $0xffffffff,%eax
je     148c <main+0x28c>
add    $0x1,%r14
mov    $0x3e8,%edi
call   1100 <usleep@plt>
add    $0x16e0,%rbp
cmp    $0x2000,%r14
jne    13e0 <main+0x1e0>
lea    0xc75(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1110 <freeaddrinfo@plt>
lea    0xc68(%rip),%rdi
call   1040 <puts@plt>
mov    %r12d,%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x1728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbf5(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo* }
@.str = [14 x i8] c"MALLOC FAIL!\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [6 x i8] c"60000\00"
@stderr = global i32 0
@.str.3 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.4 = [15 x i8] c"talker: socket\00"
@.str.5 = [31 x i8] c"talker: failed to bind socket\0A\00"
@.str.6 = [25 x i8] c"About to loop the datas\0A\00"
@.str.7 = [17 x i8] c"PACKET ROWS:%i \0A\00"
@.str.8 = [20 x i8] c"MEGADATA INDEX: %i\0A\00"
@.str.9 = [20 x i8] c"TOTAL PHOTONS: %i\0A\0A\00"
@.str.10 = [20 x i8] c"Sending packets...\0A\00"
@.str.11 = [15 x i8] c"talker: sendto\00"
@.str.12 = [18 x i8] c"All packets sent\0A\00"
@.str.13 = [13 x i8] c"END OF LINE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.addrinfo*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [735 x i64]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64*
%13 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %9
store i32 0, i32* %10
store i64 0, i64* %11
store i64 0, i64* %13
%14 = call i64* @malloc(i32 47972352)
store i64* %14, i64** %12
%15 = load i64*, i64** %12
%16 = icmp eq i64* %15, null
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %152
19: ; preds = %0
%20 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%21 = load i32, i32* @AF_UNSPEC
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i32 0, i32 4
store i32 %21, i32* %22
%23 = load i32, i32* @SOCK_DGRAM
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i32 0, i32 3
store i32 %23, i32* %24
%25 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
store i32 %25, i32* %6
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = load i32, i32* %6
%30 = call i8* @gai_strerror(i32 %29)
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %30)
store i32 1, i32* %1
br label %152
32: ; preds = %19
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
store %struct.addrinfo* %33, %struct.addrinfo** %5
br label %34
34: ; preds = %52, %32
%35 = load %struct.addrinfo*, %struct.addrinfo** %5
%36 = icmp ne %struct.addrinfo* %35, null
br i1 %36, label %37, label %56
37: ; preds = %34
%38 = load %struct.addrinfo*, %struct.addrinfo** %5
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i32 0, i32 4
%40 = load i32, i32* %39
%41 = load %struct.addrinfo*, %struct.addrinfo** %5
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i32 0, i32 3
%43 = load i32, i32* %42
%44 = load %struct.addrinfo*, %struct.addrinfo** %5
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %44, i32 0, i32 2
%46 = load i32, i32* %45
%47 = call i32 @socket(i32 %40, i32 %43, i32 %46)
store i32 %47, i32* %2
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %37
%50 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %52
51: ; preds = %37
br label %56
52: ; preds = %49
%53 = load %struct.addrinfo*, %struct.addrinfo** %5
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %53, i32 0, i32 5
%55 = load %struct.addrinfo*, %struct.addrinfo** %54
store %struct.addrinfo* %55, %struct.addrinfo** %5
br label %34
56: ; preds = %51, %34
%57 = load %struct.addrinfo*, %struct.addrinfo** %5
%58 = icmp eq %struct.addrinfo* %57, null
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %1
br label %152
62: ; preds = %56
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 245)
store i32 0, i32* %10
br label %65
65: ; preds = %98, %62
%66 = load i32, i32* %10
%67 = icmp slt i32 %66, 244
br i1 %67, label %68, label %101
68: ; preds = %65
store i32 1, i32* %9
br label %69
69: ; preds = %94, %68
%70 = load i32, i32* %9
%71 = icmp slt i32 %70, 16384
br i1 %71, label %72, label %97
72: ; preds = %69
%73 = load i32, i32* %9
%74 = sext i32 %73 to i64
%75 = load i64*, i64** %12
%76 = load i64, i64* %13
%77 = getelementptr inbounds i64, i64* %75, i64 %76
store i64 %74, i64* %77
%78 = load i64, i64* %13
%79 = add i64 %78, 1
store i64 %79, i64* %13
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = load i64*, i64** %12
%83 = load i64, i64* %13
%84 = getelementptr inbounds i64, i64* %82, i64 %83
store i64 %81, i64* %84
%85 = load i64, i64* %13
%86 = add i64 %85, 1
store i64 %86, i64* %13
%87 = load i32, i32* %10
%88 = sext i32 %87 to i64
%89 = load i64*, i64** %12
%90 = load i64, i64* %13
%91 = getelementptr inbounds i64, i64* %89, i64 %90
store i64 %88, i64* %91
%92 = load i64, i64* %13
%93 = add i64 %92, 1
store i64 %93, i64* %13
br label %94
94: ; preds = %72
%95 = load i32, i32* %9
%96 = add nsw i32 %95, 2
store i32 %96, i32* %9
br label %69
97: ; preds = %69
br label %98
98: ; preds = %97
%99 = load i32, i32* %10
%100 = add nsw i32 %99, 1
store i32 %100, i32* %10
br label %65
101: ; preds = %65
%102 = load i64, i64* %13
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i64 %102)
%104 = load i64, i64* %13
%105 = udiv i64 %104, 3
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i64 %105)
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %9
br label %108
108: ; preds = %140, %101
%109 = load i32, i32* %9
%110 = icmp slt i32 %109, 8192
br i1 %110, label %111, label %143
111: ; preds = %108
%112 = getelementptr inbounds [735 x i64], [735 x i64]* %8, i64 0, i64 0
store i64 244, i64* %112
%113 = load i64, i64* %11
%114 = getelementptr inbounds [735 x i64], [735 x i64]* %8, i64 0, i64 1
store i64 %113, i64* %114
%115 = getelementptr inbounds [735 x i64], [735 x i64]* %8, i64 0, i64 2
store i64 0, i64* %115
%116 = load i64, i64* %11
%117 = add nsw i64 %116, 1
store i64 %117, i64* %11
%118 = getelementptr inbounds [735 x i64], [735 x i64]* %8, i64 0, i64 3
%119 = load i64*, i64** %12
%120 = load i32, i32* %9
%121 = mul nsw i32 %120, 732
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i64, i64* %119, i64 %122
%124 = call i32 @memcpy(i64* %118, i64* %123, i32 5856)
%125 = load i32, i32* %2
%126 = getelementptr inbounds [735 x i64], [735 x i64]* %8, i64 0, i64 0
%127 = load %struct.addrinfo*, %struct.addrinfo** %5
%128 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %127, i32 0, i32 1
%129 = load i32, i32* %128
%130 = load %struct.addrinfo*, %struct.addrinfo** %5
%131 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %130, i32 0, i32 0
%132 = load i32, i32* %131
%133 = call i32 @sendto(i32 %125, i64* %126, i32 5880, i32 0, i32 %129, i32 %132)
store i32 %133, i32* %7
%134 = icmp eq i32 %133, -1
br i1 %134, label %135, label %138
135: ; preds = %111
%136 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %111
%139 = call i32 @usleep(i32 1000)
br label %140
140: ; preds = %138
%141 = load i32, i32* %9
%142 = add nsw i32 %141, 1
store i32 %142, i32* %9
br label %108
143: ; preds = %108
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%145 = load i64*, i64** %12
%146 = call i32 @free(i64* %145)
%147 = load %struct.addrinfo*, %struct.addrinfo** %4
%148 = call i32 @freeaddrinfo(%struct.addrinfo* %147)
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%150 = load i32, i32* %2
%151 = call i32 @close(i32 %150)
store i32 0, i32* %1
br label %152
152: ; preds = %143, %59, %27, %17
%153 = load i32, i32* %1
ret i32 %153
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo* }
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [6 x i8] c"60000\00"
@stderr = global i32 0
@.str.3 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.4 = [15 x i8] c"talker: socket\00"
@.str.5 = [31 x i8] c"talker: failed to bind socket\0A\00"
@.str.7 = [17 x i8] c"PACKET ROWS:%i \0A\00"
@.str.8 = [20 x i8] c"MEGADATA INDEX: %i\0A\00"
@.str.9 = [20 x i8] c"TOTAL PHOTONS: %i\0A\0A\00"
@.str.11 = [15 x i8] c"talker: sendto\00"
@str = [24 x i8] c"About to loop the datas\00"
@str.14 = [19 x i8] c"Sending packets...\00"
@str.15 = [17 x i8] c"All packets sent\00"
@str.16 = [12 x i8] c"END OF LINE\00"
@str.17 = [13 x i8] c"MALLOC FAIL!\00"
define i32 @main() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca [735 x i64]
%4 = bitcast %struct.addrinfo* %1 to i8*
%5 = bitcast %struct.addrinfo** %2 to i8*
%6 = bitcast [735 x i64]* %3 to i8*
%7 = tail call i64* @malloc(i32 47972352)
%8 = icmp eq i64* %7, null
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.17, i64 0, i64 0))
br label %105
11: ; preds = %0
%12 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 32)
%13 = load i32, i32* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 4
store i32 %13, i32* %14
%15 = load i32, i32* @SOCK_DGRAM
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 3
store i32 %15, i32* %16
%17 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load %struct.addrinfo*, %struct.addrinfo** %2
%21 = icmp eq %struct.addrinfo* %20, null
br i1 %21, label %41, label %26
22: ; preds = %11
%23 = load i32, i32* @stderr
%24 = call i8* @gai_strerror(i32 %17)
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %24)
br label %105
26: ; preds = %19, %36
%27 = phi %struct.addrinfo* [ %39, %36 ], [ %20, %19 ]
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 4
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 3
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 2
%33 = load i32, i32* %32
%34 = call i32 @socket(i32 %29, i32 %31, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %44
36: ; preds = %26
%37 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 5
%39 = load %struct.addrinfo*, %struct.addrinfo** %38
%40 = icmp eq %struct.addrinfo* %39, null
br i1 %40, label %41, label %26
41: ; preds = %36, %19
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %105
44: ; preds = %26
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 245)
br label %47
47: ; preds = %44, %68
%48 = phi i64 [ 0, %44 ], [ %69, %68 ]
%49 = phi i64 [ 0, %44 ], [ %65, %68 ]
br label %50
50: ; preds = %50, %47
%51 = phi i64 [ 1, %47 ], [ %66, %50 ]
%52 = phi i64 [ %49, %47 ], [ %65, %50 ]
%53 = getelementptr inbounds i64, i64* %7, i64 %52
store i64 %51, i64* %53
%54 = add i64 %52, 1
%55 = getelementptr inbounds i64, i64* %7, i64 %54
store i64 %51, i64* %55
%56 = add i64 %52, 2
%57 = getelementptr inbounds i64, i64* %7, i64 %56
store i64 %48, i64* %57
%58 = add i64 %52, 3
%59 = add nuw nsw i64 %51, 2
%60 = getelementptr inbounds i64, i64* %7, i64 %58
store i64 %59, i64* %60
%61 = add i64 %52, 4
%62 = getelementptr inbounds i64, i64* %7, i64 %61
store i64 %59, i64* %62
%63 = add i64 %52, 5
%64 = getelementptr inbounds i64, i64* %7, i64 %63
store i64 %48, i64* %64
%65 = add i64 %52, 6
%66 = add nuw nsw i64 %51, 4
%67 = icmp ult i64 %51, 16380
br i1 %67, label %50, label %68
68: ; preds = %50
%69 = add nuw nsw i64 %48, 1
%70 = icmp eq i64 %69, 244
br i1 %70, label %71, label %47
71: ; preds = %68
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i64 %65)
%73 = udiv i64 %65, 3
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i64 %73)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%76 = getelementptr inbounds [735 x i64], [735 x i64]* %3, i64 0, i64 0
%77 = getelementptr inbounds [735 x i64], [735 x i64]* %3, i64 0, i64 1
%78 = getelementptr inbounds [735 x i64], [735 x i64]* %3, i64 0, i64 2
%79 = getelementptr inbounds [735 x i64], [735 x i64]* %3, i64 0, i64 3
%80 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 1
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 0
br label %82
82: ; preds = %71, %94
%83 = phi i64 [ 0, %71 ], [ %95, %94 ]
store i64 244, i64* %76
store i64 %83, i64* %77
store i64 0, i64* %78
%84 = mul nuw nsw i64 %83, 732
%85 = getelementptr inbounds i64, i64* %7, i64 %84
%86 = call i32 @memcpy(i64* %79, i64* %85, i32 5856)
%87 = load i32, i32* %80
%88 = load i32, i32* %81
%89 = call i32 @sendto(i32 %34, i64* %76, i32 5880, i32 0, i32 %87, i32 %88)
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %94
91: ; preds = %82
%92 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %82
%95 = add nuw nsw i64 %83, 1
%96 = call i32 @usleep(i32 1000)
%97 = icmp eq i64 %95, 8192
br i1 %97, label %98, label %82
98: ; preds = %94
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%100 = call i32 @free(i64* %7)
%101 = load %struct.addrinfo*, %struct.addrinfo** %2
%102 = call i32 @freeaddrinfo(%struct.addrinfo* %101)
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.16, i64 0, i64 0))
%104 = call i32 @close(i32 %34)
br label %105
105: ; preds = %98, %41, %22, %9
%106 = phi i32 [ -1, %9 ], [ 1, %22 ], [ 2, %41 ], [ 0, %98 ]
ret i32 %106
}