#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 timeval {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ *h_addr_list;
};
typedef int /*<<< orphan*/ serv_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr_in *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_raw(char *, int *, int);
scalar_t__ read(int, char *, unsigned int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ write(int, unsigned char *, int);
char *read_nios(char *hostname, int port, int ch_number, int chunks_count) {
  int sock, i, j;
  long int n, nold;
  struct sockaddr_in serv_addr;
  struct hostent *server;
  char *buffer;
  char *ret;
  signed int acq_data_cast;
  unsigned int acq_data;
  unsigned int chunk_size = 350;
  unsigned int data_count;
  unsigned char start_stop;
  unsigned char data_type;
  unsigned char payload_counter;
  unsigned int error_counter;
  unsigned int requests_counter;
  unsigned int frame_number;
  unsigned char command[4];
  struct timeval t_start;
  struct timeval t_end;
  long int read_time_us;
  unsigned int points;
  double data_mean;
  int data_max;
  int data_min;
  int suppress_count = 5;
  signed short prev_sample;
  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("socket");
    exit(EXIT_FAILURE);
  }
  server = gethostbyname(hostname);
  if (server == NULL) {
    fprintf(stderr, "ERROR, no such host\n");
    exit(0);
  }
  bzero((char *)&serv_addr, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr_list[0], (char *)&serv_addr.sin_addr.s_addr,
        server->h_length);
  serv_addr.sin_port = htons(port);
  if (connect(sock, &serv_addr, sizeof(serv_addr)) < 0) {
    perror("ERROR connecting");
    exit(1);
  }
  error_counter = 0;
  requests_counter = 0;
  if (ch_number < 0 || ch_number > 7) {
    perror("ERROR: channels go from 0 to 7.");
    exit(1);
  }
  data_count = chunks_count * chunk_size * 4;
  buffer = (char *)malloc(data_count);
  if (buffer == NULL) {
    perror("ERROR allocating READ buffer");
    exit(1);
  }
  bzero(buffer, data_count);
  ret = (char *)malloc(data_count * 2);
  if (ret == NULL) {
    perror("ERROR allocating DATA buffer");
    exit(1);
  }
  bzero(ret, 2 * data_count);
  start_stop = 1;
  data_type = 0;
  command[0] = start_stop << 7 | (data_type & 3) << 5 | (ch_number & 7) << 2 |
               (chunks_count & 0x3000000) >> 18;
  command[1] = (unsigned char)((chunks_count & 0xFF0000) >> 16);
  command[2] = (unsigned char)((chunks_count & 0xFF00) >> 8);
  command[3] = (unsigned char)(chunks_count & 0xFF);
  n = (long int)write(sock, command, 4);
  if (n < 0) {
    perror("ERROR writing to socket");
    exit(1);
  }
  n = 0L;
  nold = 0L;
  payload_counter = 0;
  while (n < data_count) {
    n += (long int)read(sock, buffer + n, data_count - n);
    if (n <= nold) {
      perror("ERROR reading from socket");
      exit(1);
    }
    nold = n;
  }
  for (i = 0; i < chunks_count * chunk_size; i++) {
    acq_data = (buffer[i * 4] & 0xFF) << 24 | (buffer[i * 4 + 1] & 0xFF) << 16 |
               (buffer[i * 4 + 2] & 0xFF) << 8 | (buffer[i * 4 + 3] & 0xFF);
    acq_data_cast = (signed int)((acq_data & 0x003FFFFF) << 11);
    acq_data_cast = acq_data_cast >> 11;
    frame_number = (unsigned int)(acq_data & 0x07E00000) >> 21;
    print_raw(&ret[8 * i], &acq_data_cast, 4);
    if (payload_counter != ((acq_data >> 21) & 0x3F)) {
      error_counter++;
      if (error_counter <= suppress_count)
        fprintf(stderr,
                "Dropping packets: payload counter is %d, expected payload "
                "counter is %d\n",
                ((acq_data >> 21) & 0x3F), payload_counter);
      if (error_counter == suppress_count)
        fprintf(stderr,
                "Further dropped packets notices will be suppressed.\n");
      payload_counter = ((acq_data >> 21) & 0x3F);
    }
    payload_counter = (payload_counter << 2) + (1 << 2);
    payload_counter >>= 2;
  }
  if (error_counter > suppress_count)
    fprintf(stderr, "%d errors have been suppressed.\n", error_counter,
            requests_counter);
  close(sock);
  free(buffer);
  return ret;
}


x86 assembly (clang, -O0):
<read_nios>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x15e,-0x64(%rbp)
movl   $0x5,-0xac(%rbp)
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    0x2da7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1258 <read_nios+0x68>
lea    0xe66(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1080 <gethostbyname@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    128e <read_nios+0x9e>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    -0x40(%rbp),%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
add    $0x4,%rsi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   10b0 <bcopy@plt>
mov    -0xc(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
jge    1302 <read_nios+0x112>
lea    0xd22(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1324 <read_nios+0x134>
cmpl   $0x7,-0x10(%rbp)
jle    133a <read_nios+0x14a>
lea    0xcfb(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x14(%rbp),%eax
imul   -0x64(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1374 <read_nios+0x184>
lea    0xce1(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x50(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   10d0 <bzero@plt>
mov    -0x68(%rbp),%edi
shl    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    13b0 <read_nios+0x1c0>
lea    0xcc2(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x58(%rbp),%rdi
mov    -0x68(%rbp),%esi
shl    $0x1,%esi
call   10d0 <bzero@plt>
movb   $0x1,-0x69(%rbp)
movb   $0x0,-0x6a(%rbp)
movzbl -0x69(%rbp),%eax
shl    $0x7,%eax
movzbl -0x6a(%rbp),%ecx
and    $0x3,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0x7,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0x3000000,%ecx
sar    $0x12,%ecx
or     %ecx,%eax
mov    %al,-0x7c(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %al,-0x7b(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x7a(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x79(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x7c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    1453 <read_nios+0x263>
lea    0xc3c(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movb   $0x0,-0x6b(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x68(%rbp),%ecx
cmp    %rcx,%rax
jge    14c9 <read_nios+0x2d9>
mov    -0x18(%rbp),%edi
mov    -0x50(%rbp),%rsi
add    -0x28(%rbp),%rsi
mov    -0x68(%rbp),%eax
sub    -0x28(%rbp),%rax
mov    %eax,%edx
call   1070 <read@plt>
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jg     14bc <read_nios+0x2cc>
lea    0xbeb(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1467 <read_nios+0x277>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x64(%rbp),%ecx
cmp    %ecx,%eax
jae    1642 <read_nios+0x452>
mov    -0x50(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x50(%rbp),%rcx
mov    -0x1c(%rbp),%edx
shl    $0x2,%edx
add    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x50(%rbp),%rcx
mov    -0x1c(%rbp),%edx
shl    $0x2,%edx
add    $0x2,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x50(%rbp),%rcx
mov    -0x1c(%rbp),%edx
shl    $0x2,%edx
add    $0x3,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
and    $0x3fffff,%eax
shl    $0xb,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
sar    $0xb,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x60(%rbp),%eax
and    $0x7e00000,%eax
shr    $0x15,%eax
mov    %eax,-0x78(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rdi
lea    -0x5c(%rbp),%rsi
mov    $0x4,%edx
call   1100 <print_raw@plt>
movzbl -0x6b(%rbp),%eax
mov    -0x60(%rbp),%ecx
shr    $0x15,%ecx
and    $0x3f,%ecx
cmp    %ecx,%eax
je     161d <read_nios+0x42d>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0xac(%rbp),%eax
ja     15eb <read_nios+0x3fb>
mov    0x2a0a(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
shr    $0x15,%edx
and    $0x3f,%edx
movzbl -0x6b(%rbp),%ecx
lea    0xace(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x70(%rbp),%eax
cmp    -0xac(%rbp),%eax
jne    1611 <read_nios+0x421>
mov    0x29d7(%rip),%rax
mov    (%rax),%edi
lea    0xaf1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x60(%rbp),%eax
shr    $0x15,%eax
and    $0x3f,%eax
mov    %al,-0x6b(%rbp)
movzbl -0x6b(%rbp),%eax
shl    $0x2,%eax
add    $0x4,%eax
mov    %al,-0x6b(%rbp)
movzbl -0x6b(%rbp),%eax
sar    $0x2,%eax
mov    %al,-0x6b(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14d0 <read_nios+0x2e0>
mov    -0x70(%rbp),%eax
cmp    -0xac(%rbp),%eax
jbe    166e <read_nios+0x47e>
mov    0x2980(%rip),%rax
mov    (%rax),%edi
mov    -0x70(%rbp),%edx
mov    -0x74(%rbp),%ecx
lea    0xac9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_nios>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %ecx,0x10(%rsp)
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    0x2dd6(%rip),%r14
mov    (%r14),%edi
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     14c0 <read_nios+0x2d0>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1080 <gethostbyname@plt>
test   %rax,%rax
je     14da <read_nios+0x2ea>
mov    %rax,%rbp
lea    0x28(%rsp),%r13
mov    %r13,%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    (%r14),%eax
mov    %eax,0x30(%rsp)
mov    0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0x2c(%rsp),%rdi
mov    0x0(%rbp),%edx
call   10b0 <memmove@plt>
mov    %r15d,%edi
call   1050 <htons@plt>
mov    %eax,0x28(%rsp)
mov    %ebx,%edi
mov    %r13,%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
test   %rax,%rax
js     14f8 <read_nios+0x308>
cmp    $0x8,%r12d
jae    1501 <read_nios+0x311>
mov    %ebx,0xc(%rsp)
mov    0x10(%rsp),%ebx
imul   $0x578,%ebx,%r14d
mov    %r14d,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     150a <read_nios+0x31a>
mov    %rax,0x18(%rsp)
mov    %rax,%rdi
mov    %r14d,%esi
call   10d0 <bzero@plt>
imul   $0xaf0,%ebx,%r13d
mov    %r13d,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1513 <read_nios+0x323>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r13d,%esi
call   10d0 <bzero@plt>
and    $0x7,%r12d
mov    %ebx,%eax
shr    $0x12,%eax
and    $0x40,%eax
lea    (%rax,%r12,4),%eax
or     $0x80,%al
mov    %al,0x8(%rsp)
mov    %ebx,%eax
shr    $0x10,%eax
mov    %al,0x9(%rsp)
mov    %bh,0xa(%rsp)
mov    %bl,0xb(%rsp)
lea    0x8(%rsp),%rsi
mov    0xc(%rsp),%r15d
mov    %r15d,%edi
mov    $0x4,%edx
call   1040 <write@plt>
test   %rax,%rax
js     151c <read_nios+0x32c>
mov    %rbp,0x20(%rsp)
test   %r14d,%r14d
mov    0x18(%rsp),%r13
je     1372 <read_nios+0x182>
mov    %r14d,%ebp
xor    %ebx,%ebx
nop
lea    (%rbx,%r13,1),%rsi
mov    %r14d,%edx
sub    %ebx,%edx
mov    %r15d,%edi
call   1070 <read@plt>
test   %rax,%rax
jle    14aa <read_nios+0x2ba>
add    %rax,%rbx
cmp    %rbp,%rbx
jl     1350 <read_nios+0x160>
imul   $0x15e,0x10(%rsp),%eax
test   %eax,%eax
je     1486 <read_nios+0x296>
mov    %eax,%r12d
mov    %r13,%r15
add    $0x3,%r15
shl    $0x3,%r12
xor    %r14d,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    13bc <read_nios+0x1cc>
nopl   0x0(%rax)
mov    %r13d,%ebp
add    $0x1,%bpl
and    $0x3f,%bpl
add    $0x8,%r14
add    $0x4,%r15
cmp    %r14,%r12
je     145c <read_nios+0x26c>
movzbl -0x3(%r15),%r13d
shl    $0x18,%r13d
movzbl -0x2(%r15),%eax
shl    $0x10,%eax
or     %eax,%r13d
movzbl -0x1(%r15),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl (%r15),%eax
or     %ecx,%eax
shl    $0xb,%eax
sar    $0xb,%eax
mov    %eax,0x14(%rsp)
mov    %r14d,%edi
and    $0xfffffff8,%edi
add    0x20(%rsp),%rdi
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
call   1100 <print_raw@plt>
movzbl %bpl,%ecx
shr    $0x15,%r13d
and    $0x3f,%r13d
cmp    %ecx,%r13d
je     13a3 <read_nios+0x1b3>
add    $0x1,%ebx
cmp    $0x5,%ebx
ja     13a0 <read_nios+0x1b0>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    $0x5,%ebx
jne    13a0 <read_nios+0x1b0>
mov    0x2b91(%rip),%rax
mov    (%rax),%edi
lea    0xcab(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    13a0 <read_nios+0x1b0>
cmp    $0x6,%ebx
mov    0xc(%rsp),%r15d
mov    0x18(%rsp),%r13
jb     1486 <read_nios+0x296>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
lea    0xcb5(%rip),%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbe7(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xbe4(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2af7(%rip),%rax
mov    (%rax),%edi
lea    0xb16(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xb16(%rip),%rdi
jmp    14b1 <read_nios+0x2c1>
lea    0xb1e(%rip),%rdi
jmp    14b1 <read_nios+0x2c1>
lea    0xb35(%rip),%rdi
jmp    14b1 <read_nios+0x2c1>
lea    0xb49(%rip),%rdi
jmp    14b1 <read_nios+0x2c1>
lea    0xb5d(%rip),%rdi
jmp    14b1 <read_nios+0x2c1>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64* }
%struct.timeval = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.2 = [17 x i8] c"ERROR connecting\00"
@.str.3 = [32 x i8] c"ERROR: channels go from 0 to 7.\00"
@.str.4 = [29 x i8] c"ERROR allocating READ buffer\00"
@.str.5 = [29 x i8] c"ERROR allocating DATA buffer\00"
@.str.6 = [24 x i8] c"ERROR writing to socket\00"
@.str.7 = [26 x i8] c"ERROR reading from socket\00"
@.str.8 = [73 x i8] c"Dropping packets: payload counter is %d, expected payload counter is %d\0A\00"
@.str.9 = [53 x i8] c"Further dropped packets notices will be suppressed.\0A\00"
@.str.10 = [33 x i8] c"%d errors have been suppressed.\0A\00"
define i8* @read_nios(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca %struct.sockaddr_in
%15 = alloca %struct.hostent*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i8
%23 = alloca i8
%24 = alloca i8
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca [4 x i8]
%29 = alloca %struct.timeval
%30 = alloca %struct.timeval
%31 = alloca i64
%32 = alloca i32
%33 = alloca double
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i16
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 350, i32* %20
store i32 5, i32* %36
%38 = load i32, i32* @AF_INET
%39 = load i32, i32* @SOCK_STREAM
%40 = call i32 @socket(i32 %38, i32 %39, i32 0)
store i32 %40, i32* %9
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %4
%43 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %4
%47 = load i8*, i8** %5
%48 = call %struct.hostent* @gethostbyname(i8* %47)
store %struct.hostent* %48, %struct.hostent** %15
%49 = load %struct.hostent*, %struct.hostent** %15
%50 = icmp eq %struct.hostent* %49, null
br i1 %50, label %51, label %55
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%54 = call i32 @exit(i32 0)
unreachable
55: ; preds = %46
%56 = bitcast %struct.sockaddr_in* %14 to i8*
%57 = call i32 @bzero(i8* %56, i32 12)
%58 = load i32, i32* @AF_INET
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 2
store i32 %58, i32* %59
%60 = load %struct.hostent*, %struct.hostent** %15
%61 = getelementptr inbounds %struct.hostent, %struct.hostent* %60, i32 0, i32 1
%62 = load i64*, i64** %61
%63 = getelementptr inbounds i64, i64* %62, i64 0
%64 = load i64, i64* %63
%65 = inttoptr i64 %64 to i8*
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 1
%67 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %66, i32 0, i32 0
%68 = bitcast i32* %67 to i8*
%69 = load %struct.hostent*, %struct.hostent** %15
%70 = getelementptr inbounds %struct.hostent, %struct.hostent* %69, i32 0, i32 0
%71 = load i32, i32* %70
%72 = call i32 @bcopy(i8* %65, i8* %68, i32 %71)
%73 = load i32, i32* %6
%74 = call i32 @htons(i32 %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
store i32 %74, i32* %75
%76 = load i32, i32* %9
%77 = call i64 @connect(i32 %76, %struct.sockaddr_in* %14, i32 12)
%78 = icmp slt i64 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %55
%80 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %55
store i32 0, i32* %25
store i32 0, i32* %26
%83 = load i32, i32* %7
%84 = icmp slt i32 %83, 0
br i1 %84, label %88, label %85
85: ; preds = %82
%86 = load i32, i32* %7
%87 = icmp sgt i32 %86, 7
br i1 %87, label %88, label %91
88: ; preds = %85, %82
%89 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %85
%92 = load i32, i32* %8
%93 = load i32, i32* %20
%94 = mul i32 %92, %93
%95 = mul i32 %94, 4
store i32 %95, i32* %21
%96 = load i32, i32* %21
%97 = call i64 @malloc(i32 %96)
%98 = inttoptr i64 %97 to i8*
store i8* %98, i8** %16
%99 = load i8*, i8** %16
%100 = icmp eq i8* %99, null
br i1 %100, label %101, label %104
101: ; preds = %91
%102 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %91
%105 = load i8*, i8** %16
%106 = load i32, i32* %21
%107 = call i32 @bzero(i8* %105, i32 %106)
%108 = load i32, i32* %21
%109 = mul i32 %108, 2
%110 = call i64 @malloc(i32 %109)
%111 = inttoptr i64 %110 to i8*
store i8* %111, i8** %17
%112 = load i8*, i8** %17
%113 = icmp eq i8* %112, null
br i1 %113, label %114, label %117
114: ; preds = %104
%115 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %104
%118 = load i8*, i8** %17
%119 = load i32, i32* %21
%120 = mul i32 2, %119
%121 = call i32 @bzero(i8* %118, i32 %120)
store i8 1, i8* %22
store i8 0, i8* %23
%122 = load i8, i8* %22
%123 = zext i8 %122 to i32
%124 = shl i32 %123, 7
%125 = load i8, i8* %23
%126 = zext i8 %125 to i32
%127 = and i32 %126, 3
%128 = shl i32 %127, 5
%129 = or i32 %124, %128
%130 = load i32, i32* %7
%131 = and i32 %130, 7
%132 = shl i32 %131, 2
%133 = or i32 %129, %132
%134 = load i32, i32* %8
%135 = and i32 %134, 50331648
%136 = ashr i32 %135, 18
%137 = or i32 %133, %136
%138 = trunc i32 %137 to i8
%139 = getelementptr inbounds [4 x i8], [4 x i8]* %28, i64 0, i64 0
store i8 %138, i8* %139
%140 = load i32, i32* %8
%141 = and i32 %140, 16711680
%142 = ashr i32 %141, 16
%143 = trunc i32 %142 to i8
%144 = getelementptr inbounds [4 x i8], [4 x i8]* %28, i64 0, i64 1
store i8 %143, i8* %144
%145 = load i32, i32* %8
%146 = and i32 %145, 65280
%147 = ashr i32 %146, 8
%148 = trunc i32 %147 to i8
%149 = getelementptr inbounds [4 x i8], [4 x i8]* %28, i64 0, i64 2
store i8 %148, i8* %149
%150 = load i32, i32* %8
%151 = and i32 %150, 255
%152 = trunc i32 %151 to i8
%153 = getelementptr inbounds [4 x i8], [4 x i8]* %28, i64 0, i64 3
store i8 %152, i8* %153
%154 = load i32, i32* %9
%155 = getelementptr inbounds [4 x i8], [4 x i8]* %28, i64 0, i64 0
%156 = call i64 @write(i32 %154, i8* %155, i32 4)
store i64 %156, i64* %12
%157 = load i64, i64* %12
%158 = icmp slt i64 %157, 0
br i1 %158, label %159, label %162
159: ; preds = %117
%160 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%161 = call i32 @exit(i32 1)
unreachable
162: ; preds = %117
store i64 0, i64* %12
store i64 0, i64* %13
store i8 0, i8* %24
br label %163
163: ; preds = %187, %162
%164 = load i64, i64* %12
%165 = load i32, i32* %21
%166 = zext i32 %165 to i64
%167 = icmp slt i64 %164, %166
br i1 %167, label %168, label %189
168: ; preds = %163
%169 = load i32, i32* %9
%170 = load i8*, i8** %16
%171 = load i64, i64* %12
%172 = getelementptr inbounds i8, i8* %170, i64 %171
%173 = load i32, i32* %21
%174 = zext i32 %173 to i64
%175 = load i64, i64* %12
%176 = sub nsw i64 %174, %175
%177 = trunc i64 %176 to i32
%178 = call i64 @read(i32 %169, i8* %172, i32 %177)
%179 = load i64, i64* %12
%180 = add nsw i64 %179, %178
store i64 %180, i64* %12
%181 = load i64, i64* %12
%182 = load i64, i64* %13
%183 = icmp sle i64 %181, %182
br i1 %183, label %184, label %187
184: ; preds = %168
%185 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%186 = call i32 @exit(i32 1)
unreachable
187: ; preds = %168
%188 = load i64, i64* %12
store i64 %188, i64* %13
br label %163
189: ; preds = %163
store i32 0, i32* %10
br label %190
190: ; preds = %294, %189
%191 = load i32, i32* %10
%192 = load i32, i32* %8
%193 = load i32, i32* %20
%194 = mul i32 %192, %193
%195 = icmp ult i32 %191, %194
br i1 %195, label %196, label %297
196: ; preds = %190
%197 = load i8*, i8** %16
%198 = load i32, i32* %10
%199 = mul nsw i32 %198, 4
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i8, i8* %197, i64 %200
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = and i32 %203, 255
%205 = shl i32 %204, 24
%206 = load i8*, i8** %16
%207 = load i32, i32* %10
%208 = mul nsw i32 %207, 4
%209 = add nsw i32 %208, 1
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %206, i64 %210
%212 = load i8, i8* %211
%213 = sext i8 %212 to i32
%214 = and i32 %213, 255
%215 = shl i32 %214, 16
%216 = or i32 %205, %215
%217 = load i8*, i8** %16
%218 = load i32, i32* %10
%219 = mul nsw i32 %218, 4
%220 = add nsw i32 %219, 2
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds i8, i8* %217, i64 %221
%223 = load i8, i8* %222
%224 = sext i8 %223 to i32
%225 = and i32 %224, 255
%226 = shl i32 %225, 8
%227 = or i32 %216, %226
%228 = load i8*, i8** %16
%229 = load i32, i32* %10
%230 = mul nsw i32 %229, 4
%231 = add nsw i32 %230, 3
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8, i8* %228, i64 %232
%234 = load i8, i8* %233
%235 = sext i8 %234 to i32
%236 = and i32 %235, 255
%237 = or i32 %227, %236
store i32 %237, i32* %19
%238 = load i32, i32* %19
%239 = and i32 %238, 4194303
%240 = shl i32 %239, 11
store i32 %240, i32* %18
%241 = load i32, i32* %18
%242 = ashr i32 %241, 11
store i32 %242, i32* %18
%243 = load i32, i32* %19
%244 = and i32 %243, 132120576
%245 = lshr i32 %244, 21
store i32 %245, i32* %27
%246 = load i8*, i8** %17
%247 = load i32, i32* %10
%248 = mul nsw i32 8, %247
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds i8, i8* %246, i64 %249
%251 = call i32 @print_raw(i8* %250, i32* %18, i32 4)
%252 = load i8, i8* %24
%253 = zext i8 %252 to i32
%254 = load i32, i32* %19
%255 = lshr i32 %254, 21
%256 = and i32 %255, 63
%257 = icmp ne i32 %253, %256
br i1 %257, label %258, label %284
258: ; preds = %196
%259 = load i32, i32* %25
%260 = add i32 %259, 1
store i32 %260, i32* %25
%261 = load i32, i32* %25
%262 = load i32, i32* %36
%263 = icmp ule i32 %261, %262
br i1 %263, label %264, label %272
264: ; preds = %258
%265 = load i32, i32* @stderr
%266 = load i32, i32* %19
%267 = lshr i32 %266, 21
%268 = and i32 %267, 63
%269 = load i8, i8* %24
%270 = zext i8 %269 to i32
%271 = call i32 (i32, i8*, ...) @fprintf(i32 %265, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.8, i64 0, i64 0), i32 %268, i32 %270)
br label %272
272: ; preds = %264, %258
%273 = load i32, i32* %25
%274 = load i32, i32* %36
%275 = icmp eq i32 %273, %274
br i1 %275, label %276, label %279
276: ; preds = %272
%277 = load i32, i32* @stderr
%278 = call i32 (i32, i8*, ...) @fprintf(i32 %277, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
br label %279
279: ; preds = %276, %272
%280 = load i32, i32* %19
%281 = lshr i32 %280, 21
%282 = and i32 %281, 63
%283 = trunc i32 %282 to i8
store i8 %283, i8* %24
br label %284
284: ; preds = %279, %196
%285 = load i8, i8* %24
%286 = zext i8 %285 to i32
%287 = shl i32 %286, 2
%288 = add nsw i32 %287, 4
%289 = trunc i32 %288 to i8
store i8 %289, i8* %24
%290 = load i8, i8* %24
%291 = zext i8 %290 to i32
%292 = ashr i32 %291, 2
%293 = trunc i32 %292 to i8
store i8 %293, i8* %24
br label %294
294: ; preds = %284
%295 = load i32, i32* %10
%296 = add nsw i32 %295, 1
store i32 %296, i32* %10
br label %190
297: ; preds = %190
%298 = load i32, i32* %25
%299 = load i32, i32* %36
%300 = icmp ugt i32 %298, %299
br i1 %300, label %301, label %306
301: ; preds = %297
%302 = load i32, i32* @stderr
%303 = load i32, i32* %25
%304 = load i32, i32* %26
%305 = call i32 (i32, i8*, ...) @fprintf(i32 %302, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %303, i32 %304)
br label %306
306: ; preds = %301, %297
%307 = load i32, i32* %9
%308 = call i32 @close(i32 %307)
%309 = load i8*, i8** %16
%310 = call i32 @free(i8* %309)
%311 = load i8*, i8** %17
ret i8* %311
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64* }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.2 = [17 x i8] c"ERROR connecting\00"
@.str.3 = [32 x i8] c"ERROR: channels go from 0 to 7.\00"
@.str.4 = [29 x i8] c"ERROR allocating READ buffer\00"
@.str.5 = [29 x i8] c"ERROR allocating DATA buffer\00"
@.str.6 = [24 x i8] c"ERROR writing to socket\00"
@.str.7 = [26 x i8] c"ERROR reading from socket\00"
@.str.8 = [73 x i8] c"Dropping packets: payload counter is %d, expected payload counter is %d\0A\00"
@.str.9 = [53 x i8] c"Further dropped packets notices will be suppressed.\0A\00"
@.str.10 = [33 x i8] c"%d errors have been suppressed.\0A\00"
define i8* @read_nios(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca [4 x i8]
%8 = bitcast %struct.sockaddr_in* %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %4
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %4
%20 = tail call %struct.hostent* @gethostbyname(i8* %0)
%21 = icmp eq %struct.hostent* %20, null
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%25 = tail call i32 @exit(i32 0)
unreachable
26: ; preds = %19
%27 = call i32 @bzero(i8* %8, i32 12)
%28 = load i32, i32* @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.hostent, %struct.hostent* %20, i64 0, i32 1
%31 = load i64*, i64** %30
%32 = load i64, i64* %31
%33 = inttoptr i64 %32 to i8*
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
%35 = bitcast i32* %34 to i8*
%36 = getelementptr inbounds %struct.hostent, %struct.hostent* %20, i64 0, i32 0
%37 = load i32, i32* %36
%38 = tail call i32 @htons(i32 %1)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
store i32 %38, i32* %39
%40 = call i64 @connect(i32 %13, %struct.sockaddr_in* %5, i32 12)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %26
%43 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %26
%46 = icmp ugt i32 %2, 7
br i1 %46, label %47, label %50
47: ; preds = %45
%48 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %45
%51 = mul i32 %3, 350
%52 = mul i32 %3, 1400
%53 = call i64 @malloc(i32 %52)
%54 = inttoptr i64 %53 to i8*
%55 = icmp eq i64 %53, 0
br i1 %55, label %56, label %59
56: ; preds = %50
%57 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %50
%60 = call i32 @bzero(i8* %54, i32 %52)
%61 = mul i32 %3, 2800
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i8*
%64 = icmp eq i64 %62, 0
br i1 %64, label %65, label %68
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %59
%69 = call i32 @bzero(i8* %63, i32 %61)
%70 = shl nuw nsw i32 %2, 2
%71 = and i32 %70, 28
%72 = lshr i32 %3, 18
%73 = and i32 %72, 64
%74 = or i32 %73, %71
%75 = trunc i32 %74 to i8
%76 = or i8 %75, -128
store i8 %76, i8* %10
%77 = lshr i32 %3, 16
%78 = trunc i32 %77 to i8
%79 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
store i8 %78, i8* %79
%80 = lshr i32 %3, 8
%81 = trunc i32 %80 to i8
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 2
store i8 %81, i8* %82
%83 = trunc i32 %3 to i8
%84 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
store i8 %83, i8* %84
%85 = call i64 @write(i32 %13, i8* %10, i32 4)
%86 = icmp slt i64 %85, 0
br i1 %86, label %90, label %87
87: ; preds = %68
%88 = zext i32 %52 to i64
%89 = icmp eq i32 %52, 0
br i1 %89, label %95, label %99
90: ; preds = %68
%91 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %99
%94 = icmp slt i64 %106, %88
br i1 %94, label %99, label %95
95: ; preds = %93, %87
%96 = icmp eq i32 %51, 0
br i1 %96, label %170, label %97
97: ; preds = %95
%98 = zext i32 %51 to i64
br label %110
99: ; preds = %87, %93
%100 = phi i64 [ %106, %93 ], [ 0, %87 ]
%101 = getelementptr inbounds i8, i8* %54, i64 %100
%102 = trunc i64 %100 to i32
%103 = sub i32 %52, %102
%104 = call i64 @read(i32 %13, i8* %101, i32 %103)
%105 = icmp sgt i64 %104, 0
%106 = add nsw i64 %104, %100
br i1 %105, label %93, label %107
107: ; preds = %99
%108 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %97, %158
%111 = phi i64 [ 0, %97 ], [ %163, %158 ]
%112 = phi i8 [ 0, %97 ], [ %162, %158 ]
%113 = phi i32 [ 0, %97 ], [ %159, %158 ]
%114 = shl nsw i64 %111, 2
%115 = getelementptr inbounds i8, i8* %54, i64 %114
%116 = load i8, i8* %115
%117 = zext i8 %116 to i32
%118 = shl nuw i32 %117, 24
%119 = or i64 %114, 1
%120 = getelementptr inbounds i8, i8* %54, i64 %119
%121 = load i8, i8* %120
%122 = zext i8 %121 to i32
%123 = shl nuw nsw i32 %122, 16
%124 = or i32 %123, %118
%125 = or i64 %114, 2
%126 = getelementptr inbounds i8, i8* %54, i64 %125
%127 = load i8, i8* %126
%128 = zext i8 %127 to i32
%129 = shl nuw nsw i32 %128, 8
%130 = or i32 %129, %123
%131 = or i64 %114, 3
%132 = getelementptr inbounds i8, i8* %54, i64 %131
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = or i32 %130, %134
%136 = shl i32 %135, 11
%137 = ashr exact i32 %136, 11
store i32 %137, i32* %6
%138 = shl i64 %111, 3
%139 = and i64 %138, 4294967288
%140 = getelementptr inbounds i8, i8* %63, i64 %139
%141 = call i32 @print_raw(i8* %140, i32* %6, i32 4)
%142 = zext i8 %112 to i32
%143 = lshr i32 %124, 21
%144 = and i32 %143, 63
%145 = icmp eq i32 %144, %142
br i1 %145, label %158, label %146
146: ; preds = %110
%147 = add i32 %113, 1
%148 = icmp ult i32 %147, 6
br i1 %148, label %149, label %156
149: ; preds = %146
%150 = load i32, i32* @stderr
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.8, i64 0, i64 0), i32 %144, i32 %142)
%152 = icmp eq i32 %147, 5
br i1 %152, label %153, label %156
153: ; preds = %149
%154 = load i32, i32* @stderr
%155 = call i32 (i32, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
br label %156
156: ; preds = %146, %153, %149
%157 = trunc i32 %144 to i8
br label %158
158: ; preds = %156, %110
%159 = phi i32 [ %147, %156 ], [ %113, %110 ]
%160 = phi i8 [ %157, %156 ], [ %112, %110 ]
%161 = add nsw i8 %160, 1
%162 = and i8 %161, 63
%163 = add nuw nsw i64 %111, 1
%164 = icmp eq i64 %163, %98
br i1 %164, label %165, label %110
165: ; preds = %158
%166 = icmp ugt i32 %159, 5
br i1 %166, label %167, label %170
167: ; preds = %165
%168 = load i32, i32* @stderr
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %159, i32 0)
br label %170
170: ; preds = %95, %167, %165
%171 = call i32 @close(i32 %13)
%172 = call i32 @free(i8* %54)
ret i8* %63
}