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

/* Forward declarations */

/* Type definitions */
struct stat {
  int st_size;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef scalar_t__ ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ server_addr;
typedef int off_t;
typedef int /*<<< orphan*/ file_size;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int listen(int, int);
char *malloc(int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
scalar_t__ send(int, char *, int, int /*<<< orphan*/);
int sendfile(int, int, int *, int);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int strlen(char *);
int main(int argc, char **argv) {
  int server_socket;
  int peer_socket;
  socklen_t sock_len;
  ssize_t len;
  struct sockaddr_in server_addr;
  struct sockaddr_in peer_addr;
  int fd;
  int sent_bytes = 0;
  char file_size[256];
  struct stat file_stat;
  off_t offset;
  int remain_data;
  server_socket = socket(AF_INET, SOCK_STREAM, 0);
  if (server_socket == -1) {
    fprintf(stderr, "Error creating socket --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  memset(&server_addr, 0, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  inet_pton(AF_INET, "127.0.0.1", &(server_addr.sin_addr));
  server_addr.sin_port = htons(5000);
  int reuse = 1;
  if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse,
                 sizeof(int)) == -1)
    error("Can't set the reuse option on the socket");
  if ((bind(server_socket, (struct sockaddr *)&server_addr,
            sizeof(struct sockaddr))) == -1) {
    fprintf(stderr, "Error on bind --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if ((listen(server_socket, 5)) == -1) {
    fprintf(stderr, "Error on listen --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  fd = open("server_side.txt", O_RDONLY);
  if (fd == -1) {
    fprintf(stderr, "Error opening file --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (fstat(fd, &file_stat) < 0) {
    fprintf(stderr, "Error fstat --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "File Size: \n%d bytes\n", file_stat.st_size);
  sock_len = sizeof(struct sockaddr_in);
  peer_socket = accept(server_socket, (struct sockaddr *)&peer_addr, &sock_len);
  if (peer_socket == -1) {
    fprintf(stderr, "Error on accept --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "Accept peer --> %s\n", inet_ntoa(peer_addr.sin_addr));
  sprintf(file_size, "%d", file_stat.st_size);
  len = send(peer_socket, file_size, sizeof(file_size), 0);
  if (len < 0) {
    fprintf(stderr, "Error on sending greetings --> %s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "Server sent %d bytes for the size\n", len);
  fprintf(stdout, "%d\n", BUFSIZ);
  offset = 0;
  remain_data = file_stat.st_size;
  while (((sent_bytes = sendfile(peer_socket, fd, &offset, BUFSIZ)) > 0) &&
         (remain_data > 0)) {
    fprintf(stdout,
            "1. Server sent %d bytes from file's data, offset is now : %d and "
            "remaining data = %d\n",
            sent_bytes, offset, remain_data);
    remain_data -= sent_bytes;
    fprintf(stdout,
            "2. Server sent %d bytes from file's data, offset is now : %d and "
            "remaining data = %d\n",
            sent_bytes, offset, remain_data);
    fprintf(stdout, "HELLO\n");
  }
  offset = 16;
  char *buf = malloc(1);
  *buf = ' ';
  send(peer_socket, buf, strlen(buf), 0);
  sendfile(peer_socket, fd, &offset, 16);
  close(peer_socket);
  close(server_socket);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x50(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12d8 <main+0x88>
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x174(%rbp)
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x174(%rbp),%edi
mov    %rax,%rdx
lea    0xd3d(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2cf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rdx
lea    0xd15(%rip),%rsi
call   10b0 <inet_pton@plt>
mov    $0x1388,%edi
call   1060 <htons@plt>
mov    %eax,-0x34(%rbp)
movl   $0x1,-0x164(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    0x2c61(%rip),%rax
mov    (%rax),%edx
lea    -0x164(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1360 <main+0x110>
lea    0xccc(%rip),%rdi
call   1100 <error@plt>
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
jne    13bc <main+0x16c>
mov    0x2c47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x178(%rbp)
mov    0x2c20(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x178(%rbp),%edi
mov    %rax,%rdx
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1414 <main+0x1c4>
mov    0x2bef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x17c(%rbp)
mov    0x2bc8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x17c(%rbp),%edi
mov    %rax,%rdx
lea    0xc66(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2bbd(%rip),%rax
mov    (%rax),%esi
lea    0xc58(%rip),%rdi
call   1110 <open@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0xffffffff,-0x4c(%rbp)
jne    1478 <main+0x228>
mov    0x2b8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x180(%rbp)
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x180(%rbp),%edi
mov    %rax,%rdx
lea    0xc29(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2b37(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x4c(%rbp),%edi
lea    -0x158(%rbp),%rsi
call   1160 <fstat@plt>
cmp    $0x0,%rax
jge    14d3 <main+0x283>
mov    0x2b30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x184(%rbp)
mov    0x2b09(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x184(%rbp),%edi
mov    %rax,%rdx
lea    0xbe8(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2ac6(%rip),%rax
mov    (%rax),%edi
mov    -0x158(%rbp),%edx
lea    0xbd0(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xc,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1556 <main+0x306>
mov    0x2aad(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x188(%rbp)
mov    0x2a86(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x188(%rbp),%edi
mov    %rax,%rdx
lea    0xb8e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2a43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18c(%rbp)
mov    -0x48(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    -0x18c(%rbp),%edi
mov    %rax,%rdx
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x158(%rbp),%edx
lea    0xb62(%rip),%rsi
call   1130 <sprintf@plt>
mov    -0x18(%rbp),%edi
lea    -0x150(%rbp),%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    1604 <main+0x3b4>
mov    0x29ff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x190(%rbp)
mov    0x29d8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x190(%rbp),%edi
mov    %rax,%rdx
lea    0xb0e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x29ab(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2995(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xb07(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x297a(%rip),%rax
mov    (%rax),%edi
mov    0x2989(%rip),%rax
mov    (%rax),%edx
lea    0xb5c(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x0,-0x15c(%rbp)
mov    -0x158(%rbp),%eax
mov    %eax,-0x160(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    0x2956(%rip),%rax
mov    (%rax),%ecx
lea    -0x15c(%rbp),%rdx
call   10e0 <sendfile@plt>
mov    %eax,%ecx
mov    %ecx,-0x50(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x191(%rbp)
jle    1696 <main+0x446>
cmpl   $0x0,-0x160(%rbp)
setg   %al
mov    %al,-0x191(%rbp)
mov    -0x191(%rbp),%al
test   $0x1,%al
jne    16a9 <main+0x459>
jmp    1724 <main+0x4d4>
mov    0x28f0(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%edx
mov    -0x15c(%rbp),%ecx
mov    -0x160(%rbp),%r8d
lea    0xa79(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x50(%rbp),%ecx
mov    -0x160(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x160(%rbp)
mov    0x28b8(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%edx
mov    -0x15c(%rbp),%ecx
mov    -0x160(%rbp),%r8d
lea    0xa97(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2891(%rip),%rax
mov    (%rax),%edi
lea    0xad6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1655 <main+0x405>
movl   $0x10,-0x15c(%rbp)
mov    $0x1,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x170(%rbp)
mov    -0x170(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
mov    -0x170(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x170(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1a4(%rbp),%edi
mov    -0x1a0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    -0x18(%rbp),%edi
mov    -0x4c(%rbp),%esi
lea    -0x15c(%rbp),%rdx
mov    $0x10,%ecx
call   10e0 <sendfile@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    0x2d78(%rip),%r14
mov    (%r14),%edi
mov    0x2d4e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
cmp    $0xffffffff,%eax
je     1532 <main+0x2e2>
mov    %eax,%ebx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    (%r14),%edi
mov    %edi,0x28(%rsp)
lea    0xd75(%rip),%rsi
mov    %rbp,%rdx
call   10b0 <inet_pton@plt>
mov    $0x1388,%edi
call   1060 <htons@plt>
mov    %eax,0x24(%rsp)
movl   $0x1,0x18(%rsp)
mov    0x2d1b(%rip),%rax
mov    (%rax),%esi
mov    0x2cc2(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    12fb <main+0xab>
lea    0xd31(%rip),%rdi
call   1100 <error@plt>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
je     1555 <main+0x305>
mov    %ebx,%edi
mov    $0x5,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
je     1578 <main+0x328>
mov    0x2ca7(%rip),%rax
mov    (%rax),%esi
lea    0xd42(%rip),%rdi
call   1110 <open@plt>
cmp    $0xffffffff,%eax
je     1598 <main+0x348>
mov    %eax,%r13d
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   1160 <fstat@plt>
test   %rax,%rax
js     15b8 <main+0x368>
mov    0x2c39(%rip),%r14
mov    (%r14),%edi
mov    0x10(%rsp),%ebp
lea    0xd44(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
movl   $0xc,0x1c(%rsp)
lea    0x30(%rsp),%rsi
lea    0x1c(%rsp),%rdx
mov    %ebx,%edi
call   1120 <accept@plt>
cmp    $0xffffffff,%eax
je     15d8 <main+0x388>
mov    %eax,%r12d
mov    %ebx,0x14(%rsp)
mov    (%r14),%ebx
mov    0x30(%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xd2c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd2d(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %ebp,%edx
call   1130 <sprintf@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     15f8 <main+0x3a8>
mov    (%r14),%edi
lea    0xd1e(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r14),%edi
mov    0x2ba3(%rip),%rbx
mov    (%rbx),%edx
lea    0xd76(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movl   $0x0,0xc(%rsp)
mov    (%rbx),%ecx
lea    0xc(%rsp),%rdx
mov    %r12d,%edi
mov    %r13d,%r15d
mov    %r13d,%esi
call   10e0 <sendfile@plt>
test   %ebp,%ebp
jle    14c9 <main+0x279>
mov    %eax,%ebx
test   %eax,%eax
jle    14c9 <main+0x279>
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14),%edi
mov    0xc(%rsp),%ecx
lea    0xcd4(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%r8d
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r14),%edi
mov    0xc(%rsp),%ecx
mov    %ebp,%r8d
sub    %ebx,%r8d
lea    0xd0a(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r14),%edi
lea    0xd4d(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2b09(%rip),%rax
mov    (%rax),%ecx
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r13,%rdx
call   10e0 <sendfile@plt>
sub    %ebx,%ebp
jle    14c9 <main+0x279>
mov    %eax,%ebx
test   %eax,%eax
jg     1460 <main+0x210>
movl   $0x10,0xc(%rsp)
mov    $0x1,%edi
call   10c0 <malloc@plt>
mov    %rax,%rbx
movb   $0x20,(%rax)
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
lea    0xc(%rsp),%rdx
mov    %r12d,%edi
mov    %r15d,%esi
mov    $0x10,%ecx
call   10e0 <sendfile@plt>
mov    %r12d,%edi
call   1090 <close@plt>
mov    0x14(%rsp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a8f(%rip),%rax
mov    (%rax),%ebx
mov    0x2a6e(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xab0(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x2a6c(%rip),%rax
mov    (%rax),%ebx
mov    0x2a4b(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xadd(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x2a49(%rip),%rax
mov    (%rax),%ebx
mov    0x2a28(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xacf(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x2a29(%rip),%rax
mov    (%rax),%ebx
mov    0x2a08(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xad6(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x2a09(%rip),%rax
mov    (%rax),%ebx
mov    0x29e8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xad0(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x29e9(%rip),%rax
mov    (%rax),%ebx
mov    0x29c8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xad9(%rip),%rsi
jmp    1616 <main+0x3c6>
mov    0x29c9(%rip),%rax
mov    (%rax),%ebx
mov    0x29a8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xae7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x297f(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.stat = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"Error creating socket --> %s\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [41 x i8] c"Can't set the reuse option on the socket\00"
@.str.3 = [21 x i8] c"Error on bind --> %s\00"
@.str.4 = [23 x i8] c"Error on listen --> %s\00"
@.str.5 = [16 x i8] c"server_side.txt\00"
@O_RDONLY = global i32 0
@.str.6 = [26 x i8] c"Error opening file --> %s\00"
@.str.7 = [19 x i8] c"Error fstat --> %s\00"
@stdout = global i32 0
@.str.8 = [22 x i8] c"File Size: \0A%d bytes\0A\00"
@.str.9 = [23 x i8] c"Error on accept --> %s\00"
@.str.10 = [20 x i8] c"Accept peer --> %s\0A\00"
@.str.11 = [3 x i8] c"%d\00"
@.str.12 = [34 x i8] c"Error on sending greetings --> %s\00"
@.str.13 = [35 x i8] c"Server sent %d bytes for the size\0A\00"
@.str.14 = [4 x i8] c"%d\0A\00"
@BUFSIZ = global i32 0
@.str.15 = [86 x i8] c"1. Server sent %d bytes from file's data, offset is now : %d and remaining data = %d\0A\00"
@.str.16 = [86 x i8] c"2. Server sent %d bytes from file's data, offset is now : %d and remaining data = %d\0A\00"
@.str.17 = [7 x i8] c"HELLO\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32
%14 = alloca [256 x i8]
%15 = alloca %struct.stat
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %32
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %2
%33 = call i32 @memset(%struct.sockaddr_in* %10, i32 0, i32 12)
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %34, i32* %35
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%38 = call i32 @inet_pton(i32 %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = call i32 @htons(i32 5000)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %39, i32* %40
store i32 1, i32* %18
%41 = load i32, i32* %6
%42 = load i32, i32* @SOL_SOCKET
%43 = load i32, i32* @SO_REUSEADDR
%44 = bitcast i32* %18 to i8*
%45 = call i32 @setsockopt(i32 %41, i32 %42, i32 %43, i8* %44, i32 4)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %49
47: ; preds = %32
%48 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %32
%50 = load i32, i32* %6
%51 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%52 = call i32 @bind(i32 %50, %struct.sockaddr* %51, i32 4)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %61
54: ; preds = %49
%55 = load i32, i32* @stderr
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = load i32, i32* @EXIT_FAILURE
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %49
%62 = load i32, i32* %6
%63 = call i32 @listen(i32 %62, i32 5)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %72
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = load i32, i32* @errno
%68 = call i8* @strerror(i32 %67)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %68)
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %61
%73 = load i32, i32* @O_RDONLY
%74 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %73)
store i32 %74, i32* %12
%75 = load i32, i32* %12
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %84
77: ; preds = %72
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %80)
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %72
%85 = load i32, i32* %12
%86 = call i64 @fstat(i32 %85, %struct.stat* %15)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %95
88: ; preds = %84
%89 = load i32, i32* @stderr
%90 = load i32, i32* @errno
%91 = call i8* @strerror(i32 %90)
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %91)
%93 = load i32, i32* @EXIT_FAILURE
%94 = call i32 @exit(i32 %93)
unreachable
95: ; preds = %84
%96 = load i32, i32* @stdout
%97 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%98 = load i32, i32* %97
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %98)
store i32 12, i32* %8
%100 = load i32, i32* %6
%101 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%102 = call i32 @accept(i32 %100, %struct.sockaddr* %101, i32* %8)
store i32 %102, i32* %7
%103 = load i32, i32* %7
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %112
105: ; preds = %95
%106 = load i32, i32* @stderr
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %108)
%110 = load i32, i32* @EXIT_FAILURE
%111 = call i32 @exit(i32 %110)
unreachable
112: ; preds = %95
%113 = load i32, i32* @stdout
%114 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%115 = load i32, i32* %114
%116 = call i8* @inet_ntoa(i32 %115)
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %116)
%118 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%119 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%120 = load i32, i32* %119
%121 = call i32 @sprintf(i8* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %120)
%122 = load i32, i32* %7
%123 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%124 = call i64 @send(i32 %122, i8* %123, i32 256, i32 0)
store i64 %124, i64* %9
%125 = load i64, i64* %9
%126 = icmp slt i64 %125, 0
br i1 %126, label %127, label %134
127: ; preds = %112
%128 = load i32, i32* @stderr
%129 = load i32, i32* @errno
%130 = call i8* @strerror(i32 %129)
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* %130)
%132 = load i32, i32* @EXIT_FAILURE
%133 = call i32 @exit(i32 %132)
unreachable
134: ; preds = %112
%135 = load i32, i32* @stdout
%136 = load i64, i64* %9
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i64 %136)
%138 = load i32, i32* @stdout
%139 = load i32, i32* @BUFSIZ
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %139)
store i32 0, i32* %16
%141 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%142 = load i32, i32* %141
store i32 %142, i32* %17
br label %143
143: ; preds = %154, %134
%144 = load i32, i32* %7
%145 = load i32, i32* %12
%146 = load i32, i32* @BUFSIZ
%147 = call i32 @sendfile(i32 %144, i32 %145, i32* %16, i32 %146)
store i32 %147, i32* %13
%148 = icmp sgt i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %143
%150 = load i32, i32* %17
%151 = icmp sgt i32 %150, 0
br label %152
152: ; preds = %149, %143
%153 = phi i1 [ false, %143 ], [ %151, %149 ]
br i1 %153, label %154, label %170
154: ; preds = %152
%155 = load i32, i32* @stdout
%156 = load i32, i32* %13
%157 = load i32, i32* %16
%158 = load i32, i32* %17
%159 = call i32 (i32, i8*, ...) @fprintf(i32 %155, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.15, i64 0, i64 0), i32 %156, i32 %157, i32 %158)
%160 = load i32, i32* %13
%161 = load i32, i32* %17
%162 = sub nsw i32 %161, %160
store i32 %162, i32* %17
%163 = load i32, i32* @stdout
%164 = load i32, i32* %13
%165 = load i32, i32* %16
%166 = load i32, i32* %17
%167 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.16, i64 0, i64 0), i32 %164, i32 %165, i32 %166)
%168 = load i32, i32* @stdout
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
br label %143
170: ; preds = %152
store i32 16, i32* %16
%171 = call i8* @malloc(i32 1)
store i8* %171, i8** %19
%172 = load i8*, i8** %19
store i8 32, i8* %172
%173 = load i32, i32* %7
%174 = load i8*, i8** %19
%175 = load i8*, i8** %19
%176 = call i32 @strlen(i8* %175)
%177 = call i64 @send(i32 %173, i8* %174, i32 %176, i32 0)
%178 = load i32, i32* %7
%179 = load i32, i32* %12
%180 = call i32 @sendfile(i32 %178, i32 %179, i32* %16, i32 16)
%181 = load i32, i32* %7
%182 = call i32 @close(i32 %181)
%183 = load i32, i32* %6
%184 = call i32 @close(i32 %183)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.stat = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"Error creating socket --> %s\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [41 x i8] c"Can't set the reuse option on the socket\00"
@.str.3 = [21 x i8] c"Error on bind --> %s\00"
@.str.4 = [23 x i8] c"Error on listen --> %s\00"
@.str.5 = [16 x i8] c"server_side.txt\00"
@O_RDONLY = global i32 0
@.str.6 = [26 x i8] c"Error opening file --> %s\00"
@.str.7 = [19 x i8] c"Error fstat --> %s\00"
@stdout = global i32 0
@.str.8 = [22 x i8] c"File Size: \0A%d bytes\0A\00"
@.str.9 = [23 x i8] c"Error on accept --> %s\00"
@.str.10 = [20 x i8] c"Accept peer --> %s\0A\00"
@.str.11 = [3 x i8] c"%d\00"
@.str.12 = [34 x i8] c"Error on sending greetings --> %s\00"
@.str.13 = [35 x i8] c"Server sent %d bytes for the size\0A\00"
@.str.14 = [4 x i8] c"%d\0A\00"
@BUFSIZ = global i32 0
@.str.15 = [86 x i8] c"1. Server sent %d bytes from file's data, offset is now : %d and remaining data = %d\0A\00"
@.str.16 = [86 x i8] c"2. Server sent %d bytes from file's data, offset is now : %d and remaining data = %d\0A\00"
@.str.17 = [7 x i8] c"HELLO\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [256 x i8]
%7 = alloca %struct.stat
%8 = alloca i32
%9 = alloca i32
%10 = bitcast i32* %3 to i8*
%11 = bitcast %struct.sockaddr_in* %4 to i8*
%12 = bitcast %struct.sockaddr_in* %5 to i8*
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%14 = bitcast %struct.stat* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = tail call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = tail call i8* @strerror(i32 %22)
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %2
%28 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %29, i32* %30
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%32 = call i32 @inet_pton(i32 %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = call i32 @htons(i32 5000)
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %33, i32* %34
%35 = bitcast i32* %9 to i8*
store i32 1, i32* %9
%36 = load i32, i32* @SOL_SOCKET
%37 = load i32, i32* @SO_REUSEADDR
%38 = call i32 @setsockopt(i32 %18, i32 %36, i32 %37, i8* %35, i32 4)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %27
%41 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %40, %27
%43 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%44 = call i32 @bind(i32 %18, %struct.sockaddr* %43, i32 4)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %53
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %42
%54 = call i32 @listen(i32 %18, i32 5)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %63
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %59)
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %53
%64 = load i32, i32* @O_RDONLY
%65 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %74
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = load i32, i32* @errno
%70 = call i8* @strerror(i32 %69)
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %70)
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %63
%75 = call i64 @fstat(i32 %65, %struct.stat* %7)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %84
77: ; preds = %74
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %80)
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %74
%85 = load i32, i32* @stdout
%86 = getelementptr inbounds %struct.stat, %struct.stat* %7, i64 0, i32 0
%87 = load i32, i32* %86
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %87)
store i32 12, i32* %3
%89 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%90 = call i32 @accept(i32 %18, %struct.sockaddr* %89, i32* %3)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %99
92: ; preds = %84
%93 = load i32, i32* @stderr
%94 = load i32, i32* @errno
%95 = call i8* @strerror(i32 %94)
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %95)
%97 = load i32, i32* @EXIT_FAILURE
%98 = call i32 @exit(i32 %97)
unreachable
99: ; preds = %84
%100 = load i32, i32* @stdout
%101 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
%102 = load i32, i32* %101
%103 = call i8* @inet_ntoa(i32 %102)
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %103)
%105 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %87)
%106 = call i64 @send(i32 %90, i8* %13, i32 256, i32 0)
%107 = icmp slt i64 %106, 0
br i1 %107, label %108, label %115
108: ; preds = %99
%109 = load i32, i32* @stderr
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* %111)
%113 = load i32, i32* @EXIT_FAILURE
%114 = call i32 @exit(i32 %113)
unreachable
115: ; preds = %99
%116 = load i32, i32* @stdout
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i64 %106)
%118 = load i32, i32* @stdout
%119 = load i32, i32* @BUFSIZ
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %119)
store i32 0, i32* %8
%121 = load i32, i32* @BUFSIZ
%122 = call i32 @sendfile(i32 %90, i32 %65, i32* %8, i32 %121)
%123 = icmp sgt i32 %122, 0
%124 = icmp sgt i32 %87, 0
%125 = and i1 %124, %123
br i1 %125, label %126, label %143
126: ; preds = %115, %126
%127 = phi i32 [ %139, %126 ], [ %122, %115 ]
%128 = phi i32 [ %132, %126 ], [ %87, %115 ]
%129 = load i32, i32* @stdout
%130 = load i32, i32* %8
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %129, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.15, i64 0, i64 0), i32 %127, i32 %130, i32 %128)
%132 = sub nsw i32 %128, %127
%133 = load i32, i32* @stdout
%134 = load i32, i32* %8
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.16, i64 0, i64 0), i32 %127, i32 %134, i32 %132)
%136 = load i32, i32* @stdout
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
%138 = load i32, i32* @BUFSIZ
%139 = call i32 @sendfile(i32 %90, i32 %65, i32* %8, i32 %138)
%140 = icmp sgt i32 %139, 0
%141 = icmp sgt i32 %132, 0
%142 = and i1 %141, %140
br i1 %142, label %126, label %143
143: ; preds = %126, %115
store i32 16, i32* %8
%144 = call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8 32, i8* %144
%145 = call i32 @strlen(i8* %144)
%146 = call i64 @send(i32 %90, i8* %144, i32 %145, i32 0)
%147 = call i32 @sendfile(i32 %90, i32 %65, i32* %8, i32 16)
%148 = call i32 @close(i32 %90)
%149 = call i32 @close(i32 %18)
ret i32 0
}