#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ navdata_receiver;
typedef int /*<<< orphan*/ navdata_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ assert(int);
scalar_t__ bind(int, struct sockaddr *, int);
int errno;
int /*<<< orphan*/ exit(int);
int extractHeader(int /*<<< orphan*/ *, char *, int, int *);
int extractMetadata(char *, int *, int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char *argv[]) {
  fprintf(stderr, "STARTED\n");
  char blackbox_file[128] =
      "/data/ftp/internal_000/Debug/current/blackbox/light_run_0";
  FILE *blackbox;
  char *header;
  int header_length = -1;
  int err;
  int datakey_number = -1;
  int datakey_length = -1;
  int packet_length = -1;
  int data_start_location;
  long current_data_size;
  int latest_navdata_packet_beginning;
  int navdata_socket;
  struct sockaddr_in navdata_addr;
  struct sockaddr_in navdata_receiver;
  socklen_t navdata_receiver_size = sizeof(navdata_receiver);
  char recv_buf[1024];
  int recv_len;
  char *navdata_buf;
  fprintf(stderr, "ALL VARIABLES OK\n");
  if (argc == 2) {
    assert(strlen(argv[1]) <= 128);
    strcpy(blackbox_file, argv[1]);
  }
  errno = 0;
  blackbox = fopen(blackbox_file, "rb");
  if (blackbox == NULL) {
    fprintf(stderr, "Error opening blackbox file: %s. Error number %i.\n",
            blackbox_file, errno);
    exit(1);
  }
  fprintf(stderr, "BLACKBOX OK\n");
  header = (char *)malloc(4096 * 4);
  if (header == NULL) {
    fprintf(stderr, "malloc failed !... don't know what to do.\n");
    exit(1);
  }
  err = extractHeader(blackbox, header, 4096 * 4, &header_length);
  if (err != 0) {
    if (err == 1) {
      fprintf(stderr, "Blackbox header too long! Must be shorter than %i.",
              4096 * 4);
    } else {
      fprintf(stderr, "Unknown error occurred extracting header!");
    }
    exit(1);
  }
  fprintf(stderr, "HEADER OK\n");
  data_start_location = header_length + (int)strlen("-- Data\n");
  printf("Data starts at byte %i.\n", data_start_location);
  err = extractMetadata(header, &datakey_number, &datakey_length);
  if (err != 0) {
    fprintf(stderr, "Could not extract metadata from header!");
    exit(1);
  }
  packet_length = datakey_length * datakey_number;
  printf("Data composed of packets with %i %i-byte datakeys; packet length is "
         "%i.\n",
         datakey_number, datakey_length, packet_length);
  assert(datakey_length == sizeof(double));
  navdata_socket = socket(AF_INET, SOCK_DGRAM, 0);
  if (navdata_socket < 0) {
    fprintf(stderr, "Error creating UDP socket. Error number %i.\n", errno);
    fclose(blackbox);
    exit(1);
  }
  memset((char *)&navdata_addr, 0, sizeof(navdata_addr));
  navdata_addr.sin_family = AF_INET;
  navdata_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  navdata_addr.sin_port = htons(56789);
  if (bind(navdata_socket, (struct sockaddr *)&navdata_addr,
           sizeof(navdata_addr)) < 0) {
    fprintf(stderr, "Error binding UDP socket on port %i. Error number %i.\n",
            56789, errno);
    fclose(blackbox);
    exit(1);
  }
  printf("Waiting for packet on port %i.\n", 56789);
  recv_len =
      recvfrom(navdata_socket, recv_buf, 1024, 0,
               (struct sockaddr *)&navdata_receiver, &navdata_receiver_size);
  printf("Got packet. Sending navdata!\n");
  navdata_buf = (char *)malloc(packet_length);
  while (1) {
    fseek(blackbox, 0L, SEEK_END);
    current_data_size = ftell(blackbox) - data_start_location;
    latest_navdata_packet_beginning =
        data_start_location +
        (current_data_size / packet_length) * packet_length - packet_length;
    fseek(blackbox, latest_navdata_packet_beginning, SEEK_SET);
    int read = fread(navdata_buf, packet_length, 1, blackbox);
    sendto(navdata_socket, navdata_buf, packet_length, 0,
           (struct sockaddr *)&navdata_receiver, sizeof(navdata_receiver));
    usleep(25 * 1000);
  }
  fclose(blackbox);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x530,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x90(%rbp),%rdi
lea    0xf82(%rip),%rsi
mov    $0x80,%edx
call   10f0 <memcpy@plt>
movl   $0xffffffff,-0xa4(%rbp)
ff ff ff
movl   $0xffffffff,-0xac(%rbp)
ff ff ff
movl   $0xffffffff,-0xb0(%rbp)
ff ff ff
movl   $0xffffffff,-0xb4(%rbp)
ff ff ff
movl   $0xc,-0xec(%rbp)
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    133e <main+0xce>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
cmp    $0x80,%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    0x2c73(%rip),%rax
movl   $0x0,(%rax)
lea    -0x90(%rbp),%rdi
lea    0xcc2(%rip),%rsi
call   1160 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    13a4 <main+0x134>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rdx
mov    0x2c2e(%rip),%rax
mov    (%rax),%ecx
lea    0xc8b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
lea    0xc9d(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x4000,%edi
call   1100 <malloc@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    13fb <main+0x18b>
mov    0x2bdf(%rip),%rax
mov    (%rax),%edi
lea    0xc74(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x98(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    $0x4000,%edx
lea    -0xa4(%rbp),%rcx
call   1150 <extractHeader@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
je     147c <main+0x20c>
cmpl   $0x1,-0xa8(%rbp)
jne    145b <main+0x1eb>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
lea    0xc3f(%rip),%rsi
mov    $0x4000,%edx
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1472 <main+0x202>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
lea    0xc51(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x2b3d(%rip),%rax
mov    (%rax),%edi
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0xa4(%rbp),%eax
mov    %eax,-0x508(%rbp)
lea    0xc4b(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x508(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%esi
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xa0(%rbp),%rdi
lea    -0xac(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1140 <extractMetadata@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
je     151d <main+0x2ad>
mov    0x2abd(%rip),%rax
mov    (%rax),%edi
lea    0xc07(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0xb0(%rbp),%eax
imul   -0xac(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xac(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0xb4(%rbp),%ecx
lea    0xbf2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movslq -0xb0(%rbp),%rax
cmp    $0x8,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
mov    0x2a71(%rip),%rax
mov    (%rax),%edi
mov    0x2a58(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1190 <socket@plt>
mov    %eax,-0xc8(%rbp)
cmpl   $0x0,-0xc8(%rbp)
jge    15ca <main+0x35a>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
mov    0x2a14(%rip),%rax
mov    (%rax),%edx
lea    0xbd7(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x98(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
lea    -0xd8(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x29fc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
mov    0x29e5(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0xd4(%rbp)
mov    $0xddd5,%edi
call   1070 <htons@plt>
mov    %eax,-0xd8(%rbp)
mov    -0xc8(%rbp),%edi
lea    -0xd8(%rbp),%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
cmp    $0x0,%rax
jge    166c <main+0x3fc>
mov    0x2988(%rip),%rax
mov    (%rax),%edi
mov    0x2977(%rip),%rax
mov    (%rax),%ecx
lea    0xb67(%rip),%rsi
mov    $0xddd5,%edx
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x98(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
lea    0xb75(%rip),%rdi
mov    $0xddd5,%esi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xc8(%rbp),%edi
lea    -0x4f0(%rbp),%rsi
lea    -0xe8(%rbp),%r8
mov    $0x400,%edx
xor    %ecx,%ecx
lea    -0xec(%rbp),%r9
call   1110 <recvfrom@plt>
mov    %eax,-0x4f4(%rbp)
lea    0xb55(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xb4(%rbp),%edi
call   1100 <malloc@plt>
mov    %rax,-0x500(%rbp)
mov    -0x98(%rbp),%rdi
mov    0x290e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1120 <fseek@plt>
mov    -0x98(%rbp),%rdi
call   10e0 <ftell@plt>
sub    -0xb8(%rbp),%eax
mov    %eax,-0x52c(%rbp)
cltq
mov    %rax,-0xc0(%rbp)
movslq -0xb8(%rbp),%rax
mov    %rax,-0x528(%rbp)
mov    -0xc0(%rbp),%rax
movslq -0xb4(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x528(%rbp),%rax
movslq -0xb4(%rbp),%rdx
imul   %rdx,%rcx
mov    %rcx,-0x520(%rbp)
add    %rcx,%rax
mov    %rax,-0x518(%rbp)
movslq -0xb4(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x510(%rbp)
mov    %eax,-0xc4(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0xc4(%rbp),%esi
mov    0x283a(%rip),%rax
mov    (%rax),%edx
call   1120 <fseek@plt>
mov    -0x500(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    -0x98(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    %eax,-0x504(%rbp)
mov    -0xc8(%rbp),%edi
mov    -0x500(%rbp),%rsi
mov    -0xb4(%rbp),%edx
lea    -0xe8(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10b0 <sendto@plt>
mov    $0x61a8,%edi
call   1180 <usleep@plt>
jmp    16cc <main+0x45c>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4b8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2d33(%rip),%r14
mov    (%r14),%edi
lea    0xd69(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
movaps 0xffb(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xfdc(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xfbd(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xf9e(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xf82(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf66(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf4a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf2e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
movl   $0xffffffff,0x4(%rsp)
ff
movl   $0xffffffff,(%rsp)
movl   $0xc,0xc(%rsp)
mov    (%r14),%edi
lea    0xcd9(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
cmp    $0x2,%ebp
jne    1363 <main+0xf3>
mov    0x8(%rbx),%rdi
call   1070 <strlen@plt>
xor    %edi,%edi
cmp    $0x81,%eax
setl   %dil
call   10d0 <assert@plt>
mov    0x8(%rbx),%rsi
lea    0x30(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x2c4e(%rip),%rbx
movl   $0x0,(%rbx)
lea    0xca4(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1160 <fopen@plt>
mov    (%r14),%edi
test   %rax,%rax
je     15dc <main+0x36c>
mov    %rax,%r13
lea    0xcba(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x4000,%edi
call   1100 <malloc@plt>
test   %rax,%rax
je     15fb <main+0x38b>
mov    %rax,%rbx
lea    0x8(%rsp),%rcx
mov    %r13,%rdi
mov    %rax,%rsi
mov    $0x4000,%edx
call   1150 <extractHeader@plt>
test   %eax,%eax
jne    15b3 <main+0x343>
mov    (%r14),%edi
lea    0xd0b(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    0x8(%rsp),%ebp
lea    0xd04(%rip),%rdi
call   1070 <strlen@plt>
mov    %eax,%r14d
add    %ebp,%r14d
lea    0xcfb(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1140 <extractMetadata@plt>
test   %eax,%eax
jne    1607 <main+0x397>
mov    (%rsp),%edx
mov    0x4(%rsp),%esi
mov    %esi,%ebp
imul   %edx,%ebp
lea    0xd07(%rip),%rdi
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <printf@plt>
xor    %edi,%edi
cmpl   $0x8,(%rsp)
sete   %dil
call   10d0 <assert@plt>
mov    0x2b8d(%rip),%r12
mov    (%r12),%edi
mov    0x2b72(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1190 <socket@plt>
test   %eax,%eax
js     1619 <main+0x3a9>
mov    %eax,%r15d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    (%r12),%eax
mov    %eax,0x18(%rsp)
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    $0xddd5,%edi
call   1080 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
test   %rax,%rax
js     163b <main+0x3cb>
lea    0xd1a(%rip),%rdi
mov    $0xddd5,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xb0(%rsp),%rsi
lea    0x20(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r15d,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1110 <recvfrom@plt>
lea    0xd06(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   1100 <malloc@plt>
mov    %rax,%rbx
movslq %ebp,%r12
jmp    1575 <main+0x305>
cs nopw 0x0(%rax,%rax,1)
cqto
idiv   %r12
add    %ebp,%edx
mov    %r14d,%esi
sub    %edx,%esi
add    %ecx,%esi
mov    0x2a7b(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
call   1120 <fseek@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fread@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
xor    %ecx,%ecx
lea    0x20(%rsp),%r8
mov    $0xc,%r9d
call   10c0 <sendto@plt>
mov    $0x61a8,%edi
call   1180 <usleep@plt>
mov    0x2a6c(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1120 <fseek@plt>
mov    %r13,%rdi
call   10f0 <ftell@plt>
mov    %eax,%ecx
sub    %r14d,%ecx
movslq %ecx,%rax
mov    %rax,%rdx
or     %r12,%rdx
shr    $0x20,%rdx
jne    1520 <main+0x2b0>
mov    %ecx,%eax
xor    %edx,%edx
div    %ebp
jmp    1525 <main+0x2b5>
cmp    $0x1,%eax
jne    1672 <main+0x402>
mov    (%r14),%edi
lea    0xac3(%rip),%rsi
mov    $0x4000,%edx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    (%rbx),%ecx
lea    0xa39(%rip),%rsi
lea    0x30(%rsp),%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    (%r14),%edi
lea    0xa59(%rip),%rsi
jmp    167c <main+0x40c>
mov    0x29b2(%rip),%rax
mov    (%rax),%edi
lea    0xafc(%rip),%rsi
jmp    167c <main+0x40c>
mov    0x29a0(%rip),%rax
mov    (%rax),%edi
mov    0x298f(%rip),%rax
mov    (%rax),%edx
lea    0xb52(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
jmp    1660 <main+0x3f0>
mov    0x297e(%rip),%rax
mov    (%rax),%edi
mov    0x296d(%rip),%rax
mov    (%rax),%ecx
lea    0xb5d(%rip),%rsi
mov    $0xddd5,%edx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    (%r14),%edi
lea    0xa40(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [9 x i8] c"STARTED\0A\00"
@__const.main.blackbox_file = [128 x i8] c"/data/ftp/internal_000/Debug/current/blackbox/light_run_0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [18 x i8] c"ALL VARIABLES OK\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [51 x i8] c"Error opening blackbox file: %s. Error number %i.\0A\00"
@.str.4 = [13 x i8] c"BLACKBOX OK\0A\00"
@.str.5 = [43 x i8] c"malloc failed !... don't know what to do.\0A\00"
@.str.6 = [51 x i8] c"Blackbox header too long! Must be shorter than %i.\00"
@.str.7 = [42 x i8] c"Unknown error occurred extracting header!\00"
@.str.8 = [11 x i8] c"HEADER OK\0A\00"
@.str.9 = [9 x i8] c"-- Data\0A\00"
@.str.10 = [25 x i8] c"Data starts at byte %i.\0A\00"
@.str.11 = [40 x i8] c"Could not extract metadata from header!\00"
@.str.12 = [73 x i8] c"Data composed of packets with %i %i-byte datakeys; packet length is %i.\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.13 = [45 x i8] c"Error creating UDP socket. Error number %i.\0A\00"
@INADDR_ANY = global i32 0
@.str.14 = [55 x i8] c"Error binding UDP socket on port %i. Error number %i.\0A\00"
@.str.15 = [32 x i8] c"Waiting for packet on port %i.\0A\00"
@.str.16 = [30 x i8] c"Got packet. Sending navdata!\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.sockaddr_in
%19 = alloca %struct.sockaddr_in
%20 = alloca i32
%21 = alloca [1024 x i8]
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%27 = bitcast [128 x i8]* %6 to i8*
store i32 -1, i32* %9
store i32 -1, i32* %11
store i32 -1, i32* %12
store i32 -1, i32* %13
store i32 12, i32* %20
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %45
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strlen(i8* %35)
%37 = icmp sle i32 %36, 128
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @strcpy(i8* %40, i8* %43)
br label %45
45: ; preds = %32, %2
store i32 0, i32* @errno
%46 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%47 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %47, i32** %7
%48 = load i32*, i32** %7
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* @stderr
%52 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%53 = load i32, i32* @errno
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %52, i32 %53)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %45
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%59 = call i64 @malloc(i32 16384)
%60 = inttoptr i64 %59 to i8*
store i8* %60, i8** %8
%61 = load i8*, i8** %8
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %67
63: ; preds = %56
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %56
%68 = load i32*, i32** %7
%69 = load i8*, i8** %8
%70 = call i32 @extractHeader(i32* %68, i8* %69, i32 16384, i32* %9)
store i32 %70, i32* %10
%71 = load i32, i32* %10
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %84
73: ; preds = %67
%74 = load i32, i32* %10
%75 = icmp eq i32 %74, 1
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 16384)
br label %82
79: ; preds = %73
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %82
82: ; preds = %79, %76
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %67
%85 = load i32, i32* @stderr
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%87 = load i32, i32* %9
%88 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%89 = add nsw i32 %87, %88
store i32 %89, i32* %14
%90 = load i32, i32* %14
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %90)
%92 = load i8*, i8** %8
%93 = call i32 @extractMetadata(i8* %92, i32* %11, i32* %12)
store i32 %93, i32* %10
%94 = load i32, i32* %10
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %84
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0))
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %84
%101 = load i32, i32* %12
%102 = load i32, i32* %11
%103 = mul nsw i32 %101, %102
store i32 %103, i32* %13
%104 = load i32, i32* %11
%105 = load i32, i32* %12
%106 = load i32, i32* %13
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.12, i64 0, i64 0), i32 %104, i32 %105, i32 %106)
%108 = load i32, i32* %12
%109 = sext i32 %108 to i64
%110 = icmp eq i64 %109, 8
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
%113 = load i32, i32* @AF_INET
%114 = load i32, i32* @SOCK_DGRAM
%115 = call i32 @socket(i32 %113, i32 %114, i32 0)
store i32 %115, i32* %17
%116 = load i32, i32* %17
%117 = icmp slt i32 %116, 0
br i1 %117, label %118, label %125
118: ; preds = %100
%119 = load i32, i32* @stderr
%120 = load i32, i32* @errno
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %120)
%122 = load i32*, i32** %7
%123 = call i32 @fclose(i32* %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %100
%126 = bitcast %struct.sockaddr_in* %18 to i8*
%127 = call i32 @memset(i8* %126, i32 0, i32 12)
%128 = load i32, i32* @AF_INET
%129 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 2
store i32 %128, i32* %129
%130 = load i32, i32* @INADDR_ANY
%131 = call i32 @htonl(i32 %130)
%132 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 1
%133 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %132, i32 0, i32 0
store i32 %131, i32* %133
%134 = call i32 @htons(i32 56789)
%135 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 0
store i32 %134, i32* %135
%136 = load i32, i32* %17
%137 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%138 = call i64 @bind(i32 %136, %struct.sockaddr* %137, i32 12)
%139 = icmp slt i64 %138, 0
br i1 %139, label %140, label %147
140: ; preds = %125
%141 = load i32, i32* @stderr
%142 = load i32, i32* @errno
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0), i32 56789, i32 %142)
%144 = load i32*, i32** %7
%145 = call i32 @fclose(i32* %144)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %125
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i32 56789)
%149 = load i32, i32* %17
%150 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%151 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%152 = call i32 @recvfrom(i32 %149, i8* %150, i32 1024, i32 0, %struct.sockaddr* %151, i32* %20)
store i32 %152, i32* %22
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%154 = load i32, i32* %13
%155 = call i64 @malloc(i32 %154)
%156 = inttoptr i64 %155 to i8*
store i8* %156, i8** %23
br label %157
157: ; preds = %147, %157
%158 = load i32*, i32** %7
%159 = load i32, i32* @SEEK_END
%160 = call i32 @fseek(i32* %158, i32 0, i32 %159)
%161 = load i32*, i32** %7
%162 = call i32 @ftell(i32* %161)
%163 = load i32, i32* %14
%164 = sub nsw i32 %162, %163
%165 = sext i32 %164 to i64
store i64 %165, i64* %15
%166 = load i32, i32* %14
%167 = sext i32 %166 to i64
%168 = load i64, i64* %15
%169 = load i32, i32* %13
%170 = sext i32 %169 to i64
%171 = sdiv i64 %168, %170
%172 = load i32, i32* %13
%173 = sext i32 %172 to i64
%174 = mul nsw i64 %171, %173
%175 = add nsw i64 %167, %174
%176 = load i32, i32* %13
%177 = sext i32 %176 to i64
%178 = sub nsw i64 %175, %177
%179 = trunc i64 %178 to i32
store i32 %179, i32* %16
%180 = load i32*, i32** %7
%181 = load i32, i32* %16
%182 = load i32, i32* @SEEK_SET
%183 = call i32 @fseek(i32* %180, i32 %181, i32 %182)
%184 = load i8*, i8** %23
%185 = load i32, i32* %13
%186 = load i32*, i32** %7
%187 = call i32 @fread(i8* %184, i32 %185, i32 1, i32* %186)
store i32 %187, i32* %24
%188 = load i32, i32* %17
%189 = load i8*, i8** %23
%190 = load i32, i32* %13
%191 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%192 = call i32 @sendto(i32 %188, i8* %189, i32 %190, i32 0, %struct.sockaddr* %191, i32 12)
%193 = call i32 @usleep(i32 25000)
br label %157
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [9 x i8] c"STARTED\0A\00"
@__const.main.blackbox_file = [128 x i8] c"/data/ftp/internal_000/Debug/current/blackbox/light_run_0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [18 x i8] c"ALL VARIABLES OK\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [51 x i8] c"Error opening blackbox file: %s. Error number %i.\0A\00"
@.str.4 = [13 x i8] c"BLACKBOX OK\0A\00"
@.str.5 = [43 x i8] c"malloc failed !... don't know what to do.\0A\00"
@.str.6 = [51 x i8] c"Blackbox header too long! Must be shorter than %i.\00"
@.str.7 = [42 x i8] c"Unknown error occurred extracting header!\00"
@.str.8 = [11 x i8] c"HEADER OK\0A\00"
@.str.9 = [9 x i8] c"-- Data\0A\00"
@.str.10 = [25 x i8] c"Data starts at byte %i.\0A\00"
@.str.11 = [40 x i8] c"Could not extract metadata from header!\00"
@.str.12 = [73 x i8] c"Data composed of packets with %i %i-byte datakeys; packet length is %i.\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.13 = [45 x i8] c"Error creating UDP socket. Error number %i.\0A\00"
@INADDR_ANY = global i32 0
@.str.14 = [55 x i8] c"Error binding UDP socket on port %i. Error number %i.\0A\00"
@.str.15 = [32 x i8] c"Waiting for packet on port %i.\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@str = [29 x i8] c"Got packet. Sending navdata!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%14 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%15 = bitcast i32* %5 to i8*
store i32 -1, i32* %5
%16 = bitcast i32* %6 to i8*
store i32 -1, i32* %6
%17 = bitcast %struct.sockaddr_in* %7 to i8*
%18 = bitcast %struct.sockaddr_in* %8 to i8*
%19 = bitcast i32* %9 to i8*
store i32 12, i32* %9
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32 %0, 2
br i1 %23, label %24, label %33
24: ; preds = %2
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i32 @strlen(i8* %26)
%28 = icmp slt i32 %27, 129
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = load i8*, i8** %25
%32 = call i32 @strcpy(i8* %13, i8* %31)
br label %33
33: ; preds = %24, %2
store i32 0, i32* @errno
%34 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i32* %34, null
%36 = load i32, i32* @stderr
br i1 %35, label %37, label %41
37: ; preds = %33
%38 = load i32, i32* @errno
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %13, i32 %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %33
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%43 = call i64 @malloc(i32 16384)
%44 = inttoptr i64 %43 to i8*
%45 = icmp eq i64 %43, 0
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %41
%51 = call i32 @extractHeader(i32* %34, i8* %44, i32 16384, i32* %4)
switch i32 %51, label %55 [
i32 0, label %60
i32 1, label %52
]
52: ; preds = %50
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 16384)
br label %58
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %58
58: ; preds = %55, %52
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %50
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%63 = load i32, i32* %4
%64 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%65 = add nsw i32 %64, %63
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %65)
%67 = call i32 @extractMetadata(i8* %44, i32* %5, i32* %6)
%68 = icmp eq i32 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %60
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %60
%74 = load i32, i32* %6
%75 = load i32, i32* %5
%76 = mul nsw i32 %75, %74
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.12, i64 0, i64 0), i32 %75, i32 %74, i32 %76)
%78 = load i32, i32* %6
%79 = icmp eq i32 %78, 8
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = load i32, i32* @AF_INET
%83 = load i32, i32* @SOCK_DGRAM
%84 = call i32 @socket(i32 %82, i32 %83, i32 0)
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %73
%87 = load i32, i32* @stderr
%88 = load i32, i32* @errno
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %88)
%90 = call i32 @fclose(i32* %34)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %73
%93 = call i32 @memset(i8* %17, i32 0, i32 12)
%94 = load i32, i32* @AF_INET
%95 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 2
store i32 %94, i32* %95
%96 = load i32, i32* @INADDR_ANY
%97 = call i32 @htonl(i32 %96)
%98 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 1, i32 0
store i32 %97, i32* %98
%99 = call i32 @htons(i32 56789)
%100 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 0
store i32 %99, i32* %100
%101 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%102 = call i64 @bind(i32 %84, %struct.sockaddr* %101, i32 12)
%103 = icmp slt i64 %102, 0
br i1 %103, label %104, label %110
104: ; preds = %92
%105 = load i32, i32* @stderr
%106 = load i32, i32* @errno
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0), i32 56789, i32 %106)
%108 = call i32 @fclose(i32* %34)
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %92
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i32 56789)
%112 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%113 = call i32 @recvfrom(i32 %84, i8* %20, i32 1024, i32 0, %struct.sockaddr* %112, i32* %9)
%114 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%115 = call i64 @malloc(i32 %76)
%116 = inttoptr i64 %115 to i8*
%117 = sext i32 %76 to i64
br label %118
118: ; preds = %118, %110
%119 = load i32, i32* @SEEK_END
%120 = call i32 @fseek(i32* %34, i32 0, i32 %119)
%121 = call i32 @ftell(i32* %34)
%122 = sub nsw i32 %121, %65
%123 = sext i32 %122 to i64
%124 = srem i64 %123, %117
%125 = trunc i64 %124 to i32
%126 = add i32 %76, %125
%127 = sub i32 %65, %126
%128 = add i32 %127, %122
%129 = load i32, i32* @SEEK_SET
%130 = call i32 @fseek(i32* %34, i32 %128, i32 %129)
%131 = call i32 @fread(i8* %116, i32 %76, i32 1, i32* %34)
%132 = call i32 @sendto(i32 %84, i8* %116, i32 %76, i32 0, %struct.sockaddr* %112, i32 12)
%133 = call i32 @usleep(i32 25000)
br label %118
}