#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 {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ num_rt;
typedef int /*<<< orphan*/ data_size;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int bind(int, struct sockaddr *, int);
long check_args(int /*<<< orphan*/ *, int, char **);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int getpid();
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(long);
int /*<<< orphan*/ init_sig();
int listen(int, int);
int /*<<< orphan*/ log_args(int /*<<< orphan*/ *, int, char **);
int /*<<< orphan*/ *log_init();
int /*<<< orphan*/ log_msg(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ log_msg_arg1(int /*<<< orphan*/ *, char *, int);
scalar_t__ malloc(long);
int /*<<< orphan*/ memcpy(void *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, long);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
char *strerror(int /*<<< orphan*/);
int server_main(int argc, char *argv[]) {
  FILE *f;
  long local_port;
  int server_socket;
  struct sockaddr_in server_socket_name;
  int optval = 1;
  int client_socket;
  char buf[128];
  char *data;
  int rc;
  long num_rt;
  long data_size;
  int num_test = 0;
  int cur_bytes_read = 0;
  long total_bytes_read = 0;
  f = log_init();
  log_args(f, argc, argv);
  log_msg_arg1(f, "server: pid = %d \n", getpid());
  init_sig();
  local_port = check_args(f, argc, argv);
  if ((server_socket = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
    log_msg(f, "cannot create socket: ");
    log_msg(f, strerror(errno));
    exit(-1);
  }
  setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int));
  memset((char *)&server_socket_name, 0, sizeof(struct sockaddr_in));
  server_socket_name.sin_family = AF_INET;
  server_socket_name.sin_port = htons(local_port);
  server_socket_name.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(server_socket, (struct sockaddr *)&server_socket_name,
           sizeof(struct sockaddr_in)) == -1) {
    log_msg(f, "cannot bind sccket: ");
    log_msg(f, strerror(errno));
    exit(-1);
  }
  if (listen(server_socket, 1) == -1) {
    log_msg(f, "cannot listen: ");
    log_msg(f, strerror(errno));
    exit(-1);
  }
  while (1) {
    log_msg(f, "waiting for new connection ...\n");
    if ((client_socket = accept(server_socket, NULL, NULL)) == -1) {
      log_msg(f, "cannot accept: ");
      log_msg(f, strerror(errno));
      exit(-1);
    }
    log_msg(f, "client connected. \n");
    if (read(client_socket, buf, sizeof(num_rt)) == -1) {
      log_msg(f, "read rt_num failed: ");
      log_msg(f, strerror(errno));
      exit(-1);
    }
    memcpy((void *)&num_rt, (void *)buf, sizeof(num_rt));
    if (read(client_socket, (void *)buf, sizeof(data_size)) == -1) {
      log_msg(f, "read data_size failed: ");
      log_msg(f, strerror(errno));
      exit(-1);
    }
    memcpy((void *)&data_size, buf, sizeof(data_size));
    log_msg_arg1(f, "num_rt = %ld \n", num_rt);
    log_msg_arg1(f, "data_size = %ld \n", data_size);
    data = (char *)malloc(data_size);
    if (data == NULL) {
      log_msg_arg1(f, "malloc %ld failed \n", data_size);
      exit(-1);
    }
    num_test++;
    total_bytes_read = 0;
    log_msg_arg1(f, "test nr=%d started.\n", num_test);
    log_msg(f, "start reading ... \n");
    while (total_bytes_read < num_rt * data_size) {
      cur_bytes_read = 0;
      while (cur_bytes_read < data_size) {
        if ((rc = read(client_socket, data, data_size - cur_bytes_read)) ==
            -1) {
          log_msg(f, "read failed: ");
          log_msg(f, strerror(errno));
          exit(-1);
        }
        total_bytes_read += rc;
        if (rc == 0) {
          log_msg(f, "unexpected: 0 byte read: exit.\n");
          exit(-1);
        }
        if (rc < data_size)
          cur_bytes_read = cur_bytes_read + rc;
        if (cur_bytes_read == data_size)
          break;
        if (total_bytes_read == num_rt * data_size)
          break;
      }
    }
    log_msg(f, "... reading OK\n");
    close(client_socket);
    log_msg(f, "socket closed\n");
    log_msg_arg1(f, "test nr=%d ended.\n", num_test);
    free(data);
  }
  return (0);
}


x86 assembly (clang, -O0):
<server_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xe8(%rbp)
movq   $0x0,-0xf0(%rbp)
mov    $0x0,%al
call   1030 <log_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1130 <log_args@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    -0xf8(%rbp),%rdi
mov    %eax,%edx
lea    0xd2b(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    $0x0,%al
call   10f0 <init_sig@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   10a0 <check_args@plt>
mov    %rax,-0x20(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    135c <server_main+0xfc>
mov    -0x18(%rbp),%rdi
lea    0xcee(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x100(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
mov    -0x24(%rbp),%edi
mov    0x2c82(%rip),%rax
mov    (%rax),%esi
mov    0x2c41(%rip),%rax
mov    (%rax),%edx
lea    -0x34(%rbp),%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2c49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1140 <bind@plt>
cmp    $0xffffffff,%eax
jne    1415 <server_main+0x1b5>
mov    -0x18(%rbp),%rdi
lea    0xc4c(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x108(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
mov    -0x24(%rbp),%edi
mov    $0x1,%esi
call   1120 <listen@plt>
cmp    $0xffffffff,%eax
jne    146d <server_main+0x20d>
mov    -0x18(%rbp),%rdi
lea    0xc09(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    0x2b73(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x110(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
jmp    1472 <server_main+0x212>
mov    -0x18(%rbp),%rdi
lea    0xbd2(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1150 <accept@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xffffffff,%eax
jne    14df <server_main+0x27f>
mov    -0x18(%rbp),%rdi
lea    0xbc7(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x118(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xb95(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x38(%rbp),%edi
lea    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
jne    154e <server_main+0x2ee>
mov    -0x18(%rbp),%rdi
lea    0xb7c(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    0x2a92(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x120(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
lea    -0xd8(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   10e0 <memcpy@plt>
mov    -0x38(%rbp),%edi
lea    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
jne    15c5 <server_main+0x365>
mov    -0x18(%rbp),%rdi
lea    0xb1a(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    0x2a1b(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x128(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
lea    -0xe0(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   10e0 <memcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0xd8(%rbp),%rax
mov    %eax,%edx
lea    0xacf(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    -0x18(%rbp),%rdi
mov    -0xe0(%rbp),%rax
mov    %eax,%edx
lea    0xac5(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    -0xe0(%rbp),%rdi
call   1100 <malloc@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
jne    1653 <server_main+0x3f3>
mov    -0x18(%rbp),%rdi
mov    -0xe0(%rbp),%rax
mov    %eax,%edx
lea    0xa9d(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
movq   $0x0,-0xf0(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xe4(%rbp),%edx
lea    0xa77(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    -0x18(%rbp),%rdi
lea    0xa7c(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0xf0(%rbp),%rax
mov    -0xd8(%rbp),%rcx
imul   -0xe0(%rbp),%rcx
ff
cmp    %rcx,%rax
jge    17ea <server_main+0x58a>
movl   $0x0,-0xe8(%rbp)
movslq -0xe8(%rbp),%rax
cmp    -0xe0(%rbp),%rax
jge    17e5 <server_main+0x585>
mov    -0x38(%rbp),%edi
mov    -0xc8(%rbp),%rsi
mov    -0xe0(%rbp),%rdx
movslq -0xe8(%rbp),%rax
sub    %rax,%rdx
call   10c0 <read@plt>
mov    %eax,-0xcc(%rbp)
cmp    $0xffffffff,%eax
jne    1741 <server_main+0x4e1>
mov    -0x18(%rbp),%rdi
lea    0xa14(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    0x289f(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    -0x130(%rbp),%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
movslq -0xcc(%rbp),%rax
add    -0xf0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
cmpl   $0x0,-0xcc(%rbp)
jne    177d <server_main+0x51d>
mov    -0x18(%rbp),%rdi
lea    0x9be(%rip),%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
movslq -0xcc(%rbp),%rax
cmp    -0xe0(%rbp),%rax
jge    17a3 <server_main+0x543>
mov    -0xe8(%rbp),%eax
add    -0xcc(%rbp),%eax
mov    %eax,-0xe8(%rbp)
movslq -0xe8(%rbp),%rax
cmp    -0xe0(%rbp),%rax
jne    17bc <server_main+0x55c>
jmp    17e5 <server_main+0x585>
mov    -0xf0(%rbp),%rax
mov    -0xd8(%rbp),%rcx
imul   -0xe0(%rbp),%rcx
ff
cmp    %rcx,%rax
jne    17e0 <server_main+0x580>
jmp    17e5 <server_main+0x585>
jmp    16bc <server_main+0x45c>
jmp    1693 <server_main+0x433>
mov    -0x18(%rbp),%rdi
lea    0x957(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x38(%rbp),%edi
call   10b0 <close@plt>
mov    -0x18(%rbp),%rdi
lea    0x94f(%rip),%rsi
call   1110 <log_msg@plt>
mov    -0x18(%rbp),%rdi
mov    -0xe4(%rbp),%edx
lea    0x948(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    -0xc8(%rbp),%rdi
call   1040 <free@plt>
jmp    1472 <server_main+0x212>

x86 assembly (clang, -O2):
<server_main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movl   $0x1,0x1c(%rsp)
xor    %eax,%eax
call   1030 <log_init@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1130 <log_args@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xd5d(%rip),%rsi
mov    %rbp,%rdi
mov    %eax,%edx
call   10d0 <log_msg_arg1@plt>
xor    %eax,%eax
call   10f0 <init_sig@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   10a0 <check_args@plt>
mov    %rax,%r15
mov    0x2ced(%rip),%rax
mov    (%rax),%edi
mov    0x2cf4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
cmp    $0xffffffff,%eax
jne    12ee <server_main+0x8e>
lea    0xd2a(%rip),%rsi
jmp    13b8 <server_main+0x158>
mov    %eax,%r13d
mov    0x2cf0(%rip),%rax
mov    (%rax),%esi
mov    0x2caf(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rcx
mov    %r13d,%edi
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2caf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    %r15,%rdi
call   1070 <htons@plt>
mov    %eax,0x24(%rsp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x20(%rsp)
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1140 <bind@plt>
cmp    $0xffffffff,%eax
jne    1373 <server_main+0x113>
lea    0xcb9(%rip),%rsi
jmp    13b8 <server_main+0x158>
mov    %r13d,%edi
mov    $0x1,%esi
call   1120 <listen@plt>
cmp    $0xffffffff,%eax
jne    138e <server_main+0x12e>
lea    0xcb3(%rip),%rsi
jmp    13b8 <server_main+0x158>
lea    0xcba(%rip),%rsi
mov    %rbp,%rdi
call   1110 <log_msg@plt>
xor    %r15d,%r15d
mov    %r13d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1150 <accept@plt>
cmp    $0xffffffff,%eax
jne    13e3 <server_main+0x183>
lea    0xcb7(%rip),%rsi
mov    %rbp,%rdi
call   1110 <log_msg@plt>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1110 <log_msg@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
mov    %eax,%r14d
lea    0x30(%rsp),%rbx
movl   $0x0,0x4(%rsp)
mov    %r13d,0x18(%rsp)
jmp    1471 <server_main+0x211>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rbp
mov    %rbx,%rdi
lea    0xd3f(%rip),%rsi
call   1110 <log_msg@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    %rbx,%rdi
lea    0xd38(%rip),%rsi
call   1110 <log_msg@plt>
mov    %rbx,%rdi
lea    0xd38(%rip),%rsi
mov    0x4(%rsp),%edx
call   10d0 <log_msg_arg1@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
lea    0xc01(%rip),%rsi
call   1110 <log_msg@plt>
mov    0x18(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1150 <accept@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
lea    0x30(%rsp),%rbx
je     13b1 <server_main+0x151>
mov    %rbp,%rdi
lea    0xc04(%rip),%rsi
call   1110 <log_msg@plt>
mov    $0x8,%edx
mov    %r14d,%edi
mov    %rbx,%rsi
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
je     1600 <server_main+0x3a0>
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   10e0 <memcpy@plt>
mov    $0x8,%edx
mov    %r14d,%edi
mov    %rbx,%rsi
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
je     160c <server_main+0x3ac>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   10e0 <memcpy@plt>
mov    0x10(%rsp),%edx
mov    %rbp,%rdi
lea    0xbdc(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    0x8(%rsp),%edx
mov    %rbp,%rdi
lea    0xbd8(%rip),%rsi
call   10d0 <log_msg_arg1@plt>
mov    0x8(%rsp),%rdi
call   1100 <malloc@plt>
test   %rax,%rax
je     1618 <server_main+0x3b8>
mov    %rax,%r12
mov    0x4(%rsp),%edx
add    $0x1,%edx
mov    %rbp,%rdi
lea    0xbd2(%rip),%rsi
mov    %edx,0x4(%rsp)
call   10d0 <log_msg_arg1@plt>
mov    %rbp,%rbx
mov    %rbp,%rdi
lea    0xbd1(%rip),%rsi
call   1110 <log_msg@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rdx
mov    %rdx,%rcx
imul   %rax,%rcx
test   %rcx,%rcx
jle    1400 <server_main+0x1a0>
xor    %ebp,%ebp
jmp    1570 <server_main+0x310>
nopl   0x0(%rax)
mov    %rdx,%rcx
imul   %rax,%rcx
cmp    %rcx,%rbp
jge    1400 <server_main+0x1a0>
test   %rdx,%rdx
jle    1560 <server_main+0x300>
xor    %ecx,%ecx
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
sub    %rcx,%rdx
mov    %r14d,%edi
mov    %r12,%rsi
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
je     15cc <server_main+0x36c>
test   %eax,%eax
je     15f1 <server_main+0x391>
movslq %eax,%rcx
add    %rcx,%rbp
mov    0x8(%rsp),%rdx
cmp    %rcx,%rdx
cmovle %r15d,%eax
add    %eax,%r13d
movslq %r13d,%rcx
mov    0x10(%rsp),%rax
cmp    %rcx,%rdx
je     1560 <server_main+0x300>
mov    %rax,%rsi
imul   %rdx,%rsi
cmp    %rsi,%rbp
je     1560 <server_main+0x300>
cmp    %rcx,%rdx
jg     1580 <server_main+0x320>
jmp    1560 <server_main+0x300>
lea    0xb4b(%rip),%rsi
mov    %rbx,%rdi
call   1110 <log_msg@plt>
mov    0x29de(%rip),%rax
mov    (%rax),%edi
call   1170 <strerror@plt>
mov    %rbx,%rdi
jmp    13d1 <server_main+0x171>
lea    0xb34(%rip),%rsi
mov    %rbx,%rdi
jmp    13d4 <server_main+0x174>
lea    0xa8c(%rip),%rsi
jmp    13b8 <server_main+0x158>
lea    0xa95(%rip),%rsi
jmp    13b8 <server_main+0x158>
mov    0x8(%rsp),%edx
lea    0xabe(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <log_msg_arg1@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"server: pid = %d \0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [23 x i8] c"cannot create socket: \00"
@errno = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [21 x i8] c"cannot bind sccket: \00"
@.str.3 = [16 x i8] c"cannot listen: \00"
@.str.4 = [32 x i8] c"waiting for new connection ...\0A\00"
@.str.5 = [16 x i8] c"cannot accept: \00"
@.str.6 = [20 x i8] c"client connected. \0A\00"
@.str.7 = [21 x i8] c"read rt_num failed: \00"
@.str.8 = [24 x i8] c"read data_size failed: \00"
@.str.9 = [15 x i8] c"num_rt = %ld \0A\00"
@.str.10 = [18 x i8] c"data_size = %ld \0A\00"
@.str.11 = [20 x i8] c"malloc %ld failed \0A\00"
@.str.12 = [21 x i8] c"test nr=%d started.\0A\00"
@.str.13 = [20 x i8] c"start reading ... \0A\00"
@.str.14 = [14 x i8] c"read failed: \00"
@.str.15 = [32 x i8] c"unexpected: 0 byte read: exit.\0A\00"
@.str.16 = [16 x i8] c"... reading OK\0A\00"
@.str.17 = [15 x i8] c"socket closed\0A\00"
@.str.18 = [19 x i8] c"test nr=%d ended.\0A\00"
define i32 @server_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32
%11 = alloca [128 x i8]
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %9
store i32 0, i32* %16
store i32 0, i32* %17
store i64 0, i64* %18
%19 = call i32* (...) @log_init()
store i32* %19, i32** %5
%20 = load i32*, i32** %5
%21 = load i32, i32* %3
%22 = load i8**, i8*** %4
%23 = call i32 @log_args(i32* %20, i32 %21, i8** %22)
%24 = load i32*, i32** %5
%25 = call i32 (...) @getpid()
%26 = call i32 @log_msg_arg1(i32* %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 (...) @init_sig()
%28 = load i32*, i32** %5
%29 = load i32, i32* %3
%30 = load i8**, i8*** %4
%31 = call i64 @check_args(i32* %28, i32 %29, i8** %30)
store i64 %31, i64* %6
%32 = load i32, i32* @PF_INET
%33 = load i32, i32* @SOCK_STREAM
%34 = call i32 @socket(i32 %32, i32 %33, i32 0)
store i32 %34, i32* %7
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %44
36: ; preds = %2
%37 = load i32*, i32** %5
%38 = call i32 @log_msg(i32* %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32*, i32** %5
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 @log_msg(i32* %39, i8* %41)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %2
%45 = load i32, i32* %7
%46 = load i32, i32* @SOL_SOCKET
%47 = load i32, i32* @SO_REUSEADDR
%48 = call i32 @setsockopt(i32 %45, i32 %46, i32 %47, i32* %9, i32 4)
%49 = bitcast %struct.sockaddr_in* %8 to i8*
%50 = call i32 @memset(i8* %49, i32 0, i32 12)
%51 = load i32, i32* @AF_INET
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %51, i32* %52
%53 = load i64, i64* %6
%54 = call i32 @htons(i64 %53)
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %54, i32* %55
%56 = load i32, i32* @INADDR_ANY
%57 = call i32 @htonl(i32 %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%59 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %58, i32 0, i32 0
store i32 %57, i32* %59
%60 = load i32, i32* %7
%61 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%62 = call i32 @bind(i32 %60, %struct.sockaddr* %61, i32 12)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %72
64: ; preds = %44
%65 = load i32*, i32** %5
%66 = call i32 @log_msg(i32* %65, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%67 = load i32*, i32** %5
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 @log_msg(i32* %67, i8* %69)
%71 = call i32 @exit(i32 -1)
unreachable
72: ; preds = %44
%73 = load i32, i32* %7
%74 = call i32 @listen(i32 %73, i32 1)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %84
76: ; preds = %72
%77 = load i32*, i32** %5
%78 = call i32 @log_msg(i32* %77, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%79 = load i32*, i32** %5
%80 = load i32, i32* @errno
%81 = call i8* @strerror(i32 %80)
%82 = call i32 @log_msg(i32* %79, i8* %81)
%83 = call i32 @exit(i32 -1)
unreachable
84: ; preds = %72
br label %85
85: ; preds = %84, %225
%86 = load i32*, i32** %5
%87 = call i32 @log_msg(i32* %86, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%88 = load i32, i32* %7
%89 = call i32 @accept(i32 %88, i32* null, i32* null)
store i32 %89, i32* %10
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %99
91: ; preds = %85
%92 = load i32*, i32** %5
%93 = call i32 @log_msg(i32* %92, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%94 = load i32*, i32** %5
%95 = load i32, i32* @errno
%96 = call i8* @strerror(i32 %95)
%97 = call i32 @log_msg(i32* %94, i8* %96)
%98 = call i32 @exit(i32 -1)
unreachable
99: ; preds = %85
%100 = load i32*, i32** %5
%101 = call i32 @log_msg(i32* %100, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%102 = load i32, i32* %10
%103 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%104 = call i32 @read(i32 %102, i8* %103, i64 8)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %114
106: ; preds = %99
%107 = load i32*, i32** %5
%108 = call i32 @log_msg(i32* %107, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%109 = load i32*, i32** %5
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 @log_msg(i32* %109, i8* %111)
%113 = call i32 @exit(i32 -1)
unreachable
114: ; preds = %99
%115 = bitcast i64* %14 to i8*
%116 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%117 = call i32 @memcpy(i8* %115, i8* %116, i32 8)
%118 = load i32, i32* %10
%119 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%120 = call i32 @read(i32 %118, i8* %119, i64 8)
%121 = icmp eq i32 %120, -1
br i1 %121, label %122, label %130
122: ; preds = %114
%123 = load i32*, i32** %5
%124 = call i32 @log_msg(i32* %123, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%125 = load i32*, i32** %5
%126 = load i32, i32* @errno
%127 = call i8* @strerror(i32 %126)
%128 = call i32 @log_msg(i32* %125, i8* %127)
%129 = call i32 @exit(i32 -1)
unreachable
130: ; preds = %114
%131 = bitcast i64* %15 to i8*
%132 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%133 = call i32 @memcpy(i8* %131, i8* %132, i32 8)
%134 = load i32*, i32** %5
%135 = load i64, i64* %14
%136 = trunc i64 %135 to i32
%137 = call i32 @log_msg_arg1(i32* %134, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i32 %136)
%138 = load i32*, i32** %5
%139 = load i64, i64* %15
%140 = trunc i64 %139 to i32
%141 = call i32 @log_msg_arg1(i32* %138, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %140)
%142 = load i64, i64* %15
%143 = call i64 @malloc(i64 %142)
%144 = inttoptr i64 %143 to i8*
store i8* %144, i8** %12
%145 = load i8*, i8** %12
%146 = icmp eq i8* %145, null
br i1 %146, label %147, label %153
147: ; preds = %130
%148 = load i32*, i32** %5
%149 = load i64, i64* %15
%150 = trunc i64 %149 to i32
%151 = call i32 @log_msg_arg1(i32* %148, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %150)
%152 = call i32 @exit(i32 -1)
unreachable
153: ; preds = %130
%154 = load i32, i32* %16
%155 = add nsw i32 %154, 1
store i32 %155, i32* %16
store i64 0, i64* %18
%156 = load i32*, i32** %5
%157 = load i32, i32* %16
%158 = call i32 @log_msg_arg1(i32* %156, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %157)
%159 = load i32*, i32** %5
%160 = call i32 @log_msg(i32* %159, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %161
161: ; preds = %224, %153
%162 = load i64, i64* %18
%163 = load i64, i64* %14
%164 = load i64, i64* %15
%165 = mul nsw i64 %163, %164
%166 = icmp slt i64 %162, %165
br i1 %166, label %167, label %225
167: ; preds = %161
store i32 0, i32* %17
br label %168
168: ; preds = %223, %167
%169 = load i32, i32* %17
%170 = sext i32 %169 to i64
%171 = load i64, i64* %15
%172 = icmp slt i64 %170, %171
br i1 %172, label %173, label %224
173: ; preds = %168
%174 = load i32, i32* %10
%175 = load i8*, i8** %12
%176 = load i64, i64* %15
%177 = load i32, i32* %17
%178 = sext i32 %177 to i64
%179 = sub nsw i64 %176, %178
%180 = call i32 @read(i32 %174, i8* %175, i64 %179)
store i32 %180, i32* %13
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %190
182: ; preds = %173
%183 = load i32*, i32** %5
%184 = call i32 @log_msg(i32* %183, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
%185 = load i32*, i32** %5
%186 = load i32, i32* @errno
%187 = call i8* @strerror(i32 %186)
%188 = call i32 @log_msg(i32* %185, i8* %187)
%189 = call i32 @exit(i32 -1)
unreachable
190: ; preds = %173
%191 = load i32, i32* %13
%192 = sext i32 %191 to i64
%193 = load i64, i64* %18
%194 = add nsw i64 %193, %192
store i64 %194, i64* %18
%195 = load i32, i32* %13
%196 = icmp eq i32 %195, 0
br i1 %196, label %197, label %201
197: ; preds = %190
%198 = load i32*, i32** %5
%199 = call i32 @log_msg(i32* %198, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0))
%200 = call i32 @exit(i32 -1)
unreachable
201: ; preds = %190
%202 = load i32, i32* %13
%203 = sext i32 %202 to i64
%204 = load i64, i64* %15
%205 = icmp slt i64 %203, %204
br i1 %205, label %206, label %210
206: ; preds = %201
%207 = load i32, i32* %17
%208 = load i32, i32* %13
%209 = add nsw i32 %207, %208
store i32 %209, i32* %17
br label %210
210: ; preds = %206, %201
%211 = load i32, i32* %17
%212 = sext i32 %211 to i64
%213 = load i64, i64* %15
%214 = icmp eq i64 %212, %213
br i1 %214, label %215, label %216
215: ; preds = %210
br label %224
216: ; preds = %210
%217 = load i64, i64* %18
%218 = load i64, i64* %14
%219 = load i64, i64* %15
%220 = mul nsw i64 %218, %219
%221 = icmp eq i64 %217, %220
br i1 %221, label %222, label %223
222: ; preds = %216
br label %224
223: ; preds = %216
br label %168
224: ; preds = %222, %215, %168
br label %161
225: ; preds = %161
%226 = load i32*, i32** %5
%227 = call i32 @log_msg(i32* %226, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%228 = load i32, i32* %10
%229 = call i32 @close(i32 %228)
%230 = load i32*, i32** %5
%231 = call i32 @log_msg(i32* %230, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
%232 = load i32*, i32** %5
%233 = load i32, i32* %16
%234 = call i32 @log_msg_arg1(i32* %232, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %233)
%235 = load i8*, i8** %12
%236 = call i32 @free(i8* %235)
br label %85
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"server: pid = %d \0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [23 x i8] c"cannot create socket: \00"
@errno = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [21 x i8] c"cannot bind sccket: \00"
@.str.3 = [16 x i8] c"cannot listen: \00"
@.str.4 = [32 x i8] c"waiting for new connection ...\0A\00"
@.str.5 = [16 x i8] c"cannot accept: \00"
@.str.6 = [20 x i8] c"client connected. \0A\00"
@.str.7 = [21 x i8] c"read rt_num failed: \00"
@.str.8 = [24 x i8] c"read data_size failed: \00"
@.str.9 = [15 x i8] c"num_rt = %ld \0A\00"
@.str.10 = [18 x i8] c"data_size = %ld \0A\00"
@.str.11 = [20 x i8] c"malloc %ld failed \0A\00"
@.str.12 = [21 x i8] c"test nr=%d started.\0A\00"
@.str.13 = [20 x i8] c"start reading ... \0A\00"
@.str.14 = [14 x i8] c"read failed: \00"
@.str.15 = [32 x i8] c"unexpected: 0 byte read: exit.\0A\00"
@.str.16 = [16 x i8] c"... reading OK\0A\00"
@.str.17 = [15 x i8] c"socket closed\0A\00"
@.str.18 = [19 x i8] c"test nr=%d ended.\0A\00"
define i32 @server_main(i32 %0, i8** %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = alloca i64
%7 = alloca i64
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%11 = bitcast i64* %6 to i8*
%12 = bitcast i64* %7 to i8*
%13 = tail call i32* (...) @log_init()
%14 = tail call i32 @log_args(i32* %13, i32 %0, i8** %1)
%15 = tail call i32 (...) @getpid()
%16 = tail call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = tail call i32 (...) @init_sig()
%18 = tail call i64 @check_args(i32* %13, i32 %0, i8** %1)
%19 = load i32, i32* @PF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = tail call i32 @socket(i32 %19, i32 %20, i32 0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %29
23: ; preds = %2
%24 = tail call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 @log_msg(i32* %13, i8* %26)
%28 = tail call i32 @exit(i32 -1)
unreachable
29: ; preds = %2
%30 = load i32, i32* @SOL_SOCKET
%31 = load i32, i32* @SO_REUSEADDR
%32 = call i32 @setsockopt(i32 %21, i32 %30, i32 %31, i32* %4, i32 4)
%33 = call i32 @memset(i8* %8, i32 0, i32 12)
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %34, i32* %35
%36 = call i32 @htons(i64 %18)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %36, i32* %37
%38 = load i32, i32* @INADDR_ANY
%39 = call i32 @htonl(i32 %38)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %39, i32* %40
%41 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%42 = call i32 @bind(i32 %21, %struct.sockaddr* %41, i32 12)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %50
44: ; preds = %29
%45 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%46 = load i32, i32* @errno
%47 = call i8* @strerror(i32 %46)
%48 = call i32 @log_msg(i32* %13, i8* %47)
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %29
%51 = call i32 @listen(i32 %21, i32 1)
%52 = icmp eq i32 %51, -1
br i1 %52, label %57, label %53
53: ; preds = %50
%54 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%55 = call i32 @accept(i32 %21, i32* null, i32* null)
%56 = icmp eq i32 %55, -1
br i1 %56, label %63, label %69
57: ; preds = %50
%58 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 @log_msg(i32* %13, i8* %60)
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %162, %53
%64 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 @log_msg(i32* %13, i8* %66)
%68 = call i32 @exit(i32 -1)
unreachable
69: ; preds = %53, %162
%70 = phi i32 [ %169, %162 ], [ %55, %53 ]
%71 = phi i32 [ %109, %162 ], [ 0, %53 ]
%72 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%73 = call i32 @read(i32 %70, i8* %10, i64 8)
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %81
75: ; preds = %69
%76 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 @log_msg(i32* %13, i8* %78)
%80 = call i32 @exit(i32 -1)
unreachable
81: ; preds = %69
%82 = call i32 @memcpy(i8* %11, i8* %10, i32 8)
%83 = call i32 @read(i32 %70, i8* %10, i64 8)
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%87 = load i32, i32* @errno
%88 = call i8* @strerror(i32 %87)
%89 = call i32 @log_msg(i32* %13, i8* %88)
%90 = call i32 @exit(i32 -1)
unreachable
91: ; preds = %81
%92 = call i32 @memcpy(i8* %12, i8* %10, i32 8)
%93 = load i64, i64* %6
%94 = trunc i64 %93 to i32
%95 = call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i32 %94)
%96 = load i64, i64* %7
%97 = trunc i64 %96 to i32
%98 = call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %97)
%99 = load i64, i64* %7
%100 = call i64 @malloc(i64 %99)
%101 = inttoptr i64 %100 to i8*
%102 = icmp eq i64 %100, 0
br i1 %102, label %103, label %108
103: ; preds = %91
%104 = load i64, i64* %7
%105 = trunc i64 %104 to i32
%106 = call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %105)
%107 = call i32 @exit(i32 -1)
unreachable
108: ; preds = %91
%109 = add nuw nsw i32 %71, 1
%110 = call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %109)
%111 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
%112 = load i64, i64* %6
%113 = load i64, i64* %7
%114 = mul nsw i64 %113, %112
%115 = icmp sgt i64 %114, 0
br i1 %115, label %116, label %162
116: ; preds = %108, %156
%117 = phi i64 [ %157, %156 ], [ %113, %108 ]
%118 = phi i64 [ %158, %156 ], [ %112, %108 ]
%119 = phi i64 [ %159, %156 ], [ 0, %108 ]
%120 = icmp sgt i64 %117, 0
br i1 %120, label %121, label %156
121: ; preds = %116, %150
%122 = phi i64 [ %153, %150 ], [ 0, %116 ]
%123 = phi i64 [ %137, %150 ], [ %119, %116 ]
%124 = phi i32 [ %146, %150 ], [ 0, %116 ]
%125 = phi i64 [ %143, %150 ], [ %117, %116 ]
%126 = sub nsw i64 %125, %122
%127 = call i32 @read(i32 %70, i8* %101, i64 %126)
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %135
129: ; preds = %121
%130 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 @log_msg(i32* %13, i8* %132)
%134 = call i32 @exit(i32 -1)
unreachable
135: ; preds = %121
%136 = sext i32 %127 to i64
%137 = add nsw i64 %123, %136
%138 = icmp eq i32 %127, 0
br i1 %138, label %139, label %142
139: ; preds = %135
%140 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0))
%141 = call i32 @exit(i32 -1)
unreachable
142: ; preds = %135
%143 = load i64, i64* %7
%144 = icmp sgt i64 %143, %136
%145 = select i1 %144, i32 %127, i32 0
%146 = add nsw i32 %145, %124
%147 = sext i32 %146 to i64
%148 = icmp eq i64 %143, %147
%149 = load i64, i64* %6
br i1 %148, label %156, label %150
150: ; preds = %142
%151 = mul nsw i64 %149, %143
%152 = icmp ne i64 %137, %151
%153 = sext i32 %146 to i64
%154 = icmp sgt i64 %143, %153
%155 = select i1 %152, i1 %154, i1 false
br i1 %155, label %121, label %156
156: ; preds = %150, %142, %116
%157 = phi i64 [ %117, %116 ], [ %143, %142 ], [ %143, %150 ]
%158 = phi i64 [ %118, %116 ], [ %149, %142 ], [ %149, %150 ]
%159 = phi i64 [ %119, %116 ], [ %137, %142 ], [ %137, %150 ]
%160 = mul nsw i64 %157, %158
%161 = icmp slt i64 %159, %160
br i1 %161, label %116, label %162
162: ; preds = %156, %108
%163 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%164 = call i32 @close(i32 %70)
%165 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
%166 = call i32 @log_msg_arg1(i32* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i32 %109)
%167 = call i32 @free(i8* %101)
%168 = call i32 @log_msg(i32* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%169 = call i32 @accept(i32 %21, i32* null, i32* null)
%170 = icmp eq i32 %169, -1
br i1 %170, label %63, label %69
}