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

/* Forward declarations */

/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ lenfilename;
typedef int /*<<< orphan*/ found;
typedef int /*<<< orphan*/ flag_f;
typedef int /*<<< orphan*/ flag;
typedef int /*<<< orphan*/ bytewr;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int O_CREAT;
int O_WRONLY;
int STDOUT_FILENO;
int close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int read(int, ...);
scalar_t__ strcmp(char *, char *);
int write(int, char *, int);
void put(int fd) {
  int f;
  int found = 0;
  char *f_content;
  char *filename;
  char type[4];
  char flag = '+';
  char flag_f = '#';
  size_t lenfilename = 0;
  ssize_t nbytes;
  size_t bytewr;
  nbytes = read(fd, &found, sizeof(found));
  if (nbytes == -1) {
    perror("Error read");
    exit(EXIT_FAILURE);
  }
  if (found == 1) {
    nbytes = read(fd, type, 3);
    if (nbytes == -1) {
      perror("Error read");
      exit(EXIT_FAILURE);
    }
    if (nbytes == 0) {
      exit(EXIT_SUCCESS);
    }
    type[nbytes] = '\0';
    if (strcmp(type, "REG") == 0) {
      filename = (char *)malloc(sizeof(char) * 4096 + 1);
      if (filename == NULL) {
        perror("Error malloc");
        exit(EXIT_FAILURE);
      }
      f_content = (char *)malloc(sizeof(char) * 4096 + 1);
      if (f_content == NULL) {
        perror("Error malloc");
        exit(EXIT_FAILURE);
      }
      nbytes = read(fd, &lenfilename, sizeof(lenfilename));
      if (nbytes == -1) {
        perror("Error read");
        exit(EXIT_FAILURE);
      }
      if (nbytes == 0) {
        exit(EXIT_SUCCESS);
      }
      nbytes = read(fd, filename, lenfilename);
      if (nbytes == -1) {
        perror("Error read");
        exit(EXIT_FAILURE);
      }
      if (nbytes == 0) {
        exit(EXIT_SUCCESS);
      }
      filename[nbytes] = '\0';
      f = open(filename, O_CREAT | O_WRONLY, 0644);
      if (f == -1) {
        perror("Error open");
        exit(EXIT_FAILURE);
      }
      while ((nbytes = read(fd, &flag, sizeof(flag))) != 0) {
        if (nbytes == -1) {
          perror("Error read");
          exit(EXIT_FAILURE);
        }
        if (flag == '-') {
          nbytes = read(fd, &bytewr, sizeof(bytewr));
          if (nbytes == -1) {
            perror("Error read");
            exit(EXIT_SUCCESS);
          }
          if (nbytes == 0) {
            exit(EXIT_FAILURE);
          }
          nbytes = read(fd, f_content, bytewr);
          if (nbytes == -1) {
            perror("Error read file content");
            exit(EXIT_FAILURE);
          }
          if (nbytes == 0) {
            exit(EXIT_SUCCESS);
          }
          if (write(f, f_content, bytewr) < bytewr) {
            perror("Error write");
            exit(EXIT_SUCCESS);
          }
        } else {
          break;
        }
      }
      if (write(STDOUT_FILENO, "File received with success!\n", 28) < 28) {
        perror("Error write");
        exit(EXIT_FAILURE);
      }
      free(f_content);
      free(filename);
      if (close(f) == -1) {
        perror("Error closing file");
        exit(EXIT_FAILURE);
      }
    } else if (strcmp(type, "DIR") == 0) {
      for (;;) {
        nbytes = read(fd, &flag_f, sizeof(flag_f));
        if (nbytes == -1) {
          perror("Error read");
          exit(EXIT_FAILURE);
        }
        if (nbytes == 0) {
          exit(EXIT_SUCCESS);
        }
        if (flag_f == 'f') {
          filename = (char *)malloc(sizeof(char) * 4096 + 1);
          if (filename == NULL) {
            perror("Error malloc");
            exit(EXIT_FAILURE);
          }
          f_content = (char *)malloc(sizeof(char) * 4096 + 1);
          if (f_content == NULL) {
            perror("Error malloc");
            exit(EXIT_FAILURE);
          }
          nbytes = read(fd, &lenfilename, sizeof(lenfilename));
          if (nbytes == -1) {
            perror("Error read");
            exit(EXIT_FAILURE);
          }
          if (nbytes == 0) {
            exit(EXIT_SUCCESS);
          }
          nbytes = read(fd, filename, lenfilename);
          if (nbytes == -1) {
            perror("Error read filename");
            exit(EXIT_FAILURE);
          }
          if (nbytes == 0) {
            exit(EXIT_SUCCESS);
          }
          filename[nbytes] = '\0';
          f = open(filename, O_CREAT | O_WRONLY, 0644);
          if (f == -1) {
            perror("Error open file");
            exit(EXIT_FAILURE);
          }
          while ((nbytes = read(fd, &flag, sizeof(flag))) != 0) {
            if (nbytes == -1) {
              perror("Error write");
              exit(EXIT_FAILURE);
            }
            if (flag == '-') {
              nbytes = read(fd, &bytewr, sizeof(bytewr));
              if (nbytes == -1) {
                perror("Error read");
                exit(EXIT_FAILURE);
              }
              if (nbytes == 0) {
                exit(EXIT_SUCCESS);
              }
              nbytes = read(fd, f_content, bytewr);
              if (nbytes == -1) {
                perror("Error read file content");
                exit(EXIT_FAILURE);
              }
              if (nbytes == 0) {
                exit(EXIT_SUCCESS);
              }
              f_content[nbytes] = '\0';
              if (write(f, f_content, bytewr) < bytewr) {
                perror("Error write file content");
                exit(EXIT_FAILURE);
              }
            } else {
              break;
            }
          }
          free(f_content);
          free(filename);
          if (close(f) == -1) {
            perror("Error close file");
            exit(EXIT_FAILURE);
          }
        } else if (flag_f == 'd') {
          continue;
        } else {
          if (flag_f == 'e') {
            break;
          }
        }
        if (write(STDOUT_FILENO, "File received with success|\n", 28) < 28) {
          perror("Error write");
          exit(EXIT_FAILURE);
        }
      }
    } else {
      if (write(STDOUT_FILENO, "The file is not a regular file/directory!\n",
                45) < 45) {
        perror("Error write");
        exit(EXIT_SUCCESS);
      }
    }
  } else {
    if (write(STDOUT_FILENO, "File not found!\n", 16) < 16) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
  }
}


x86 assembly (clang, -O0):
<put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movb   $0x2b,-0x25(%rbp)
movb   $0x23,-0x26(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    11ec <put+0x5c>
lea    0xe27(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x1,-0xc(%rbp)
jne    19ad <put+0x81d>
mov    -0x4(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1230 <put+0xa0>
lea    0xde3(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1248 <put+0xb8>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movslq -0x34(%rbp),%rax
movb   $0x0,-0x24(%rbp,%rax,1)
lea    -0x24(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1585 <put+0x3f5>
mov    $0x1001,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    129e <put+0x10e>
lea    0xd84(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    $0x1001,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12d1 <put+0x141>
lea    0xd51(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    130b <put+0x17b>
lea    0xd08(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1323 <put+0x193>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    135c <put+0x1cc>
lea    0xcb7(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1374 <put+0x1e4>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
mov    0x2c6d(%rip),%rax
mov    (%rax),%esi
mov    0x2c24(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    13c7 <put+0x237>
lea    0xc68(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    13cc <put+0x23c>
mov    -0x4(%rbp),%edi
lea    -0x25(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
je     1506 <put+0x376>
cmpl   $0xffffffff,-0x34(%rbp)
jne    140f <put+0x27f>
lea    0xc04(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2bc8(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movsbl -0x25(%rbp),%eax
cmp    $0x2d,%eax
jne    14fc <put+0x36c>
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1456 <put+0x2c6>
lea    0xbbd(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    146e <put+0x2de>
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    14a7 <put+0x317>
lea    0xb93(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2b30(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    14bf <put+0x32f>
mov    0x2b10(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
call   1040 <write@plt>
cltq
cmp    -0x40(%rbp),%rax
jae    14f7 <put+0x367>
lea    0xb5b(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2ad8(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    1501 <put+0x371>
jmp    1506 <put+0x376>
jmp    13cc <put+0x23c>
mov    0x2adb(%rip),%rax
mov    (%rax),%edi
lea    0xb35(%rip),%rsi
mov    $0x1c,%edx
call   1040 <write@plt>
cmp    $0x1c,%eax
jge    1543 <put+0x3b3>
lea    0xb0f(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2a94(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
jne    1580 <put+0x3f0>
lea    0xafb(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2a57(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    19a8 <put+0x818>
lea    -0x24(%rbp),%rdi
lea    0xaeb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1961 <put+0x7d1>
jmp    15a4 <put+0x414>
mov    -0x4(%rbp),%edi
lea    -0x26(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    15de <put+0x44e>
lea    0xa35(%rip),%rdi
call   10a0 <perror@plt>
mov    0x29f9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    15f6 <put+0x466>
mov    0x29d9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movsbl -0x26(%rbp),%eax
cmp    $0x66,%eax
jne    18ec <put+0x75c>
mov    $0x1001,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1636 <put+0x4a6>
lea    0x9ec(%rip),%rdi
call   10a0 <perror@plt>
mov    0x29a1(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    $0x1001,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1669 <put+0x4d9>
lea    0x9b9(%rip),%rdi
call   10a0 <perror@plt>
mov    0x296e(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    16a3 <put+0x513>
lea    0x970(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2934(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    16bb <put+0x52b>
mov    0x2914(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    16f4 <put+0x564>
lea    0x99e(%rip),%rdi
call   10a0 <perror@plt>
mov    0x28e3(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    170c <put+0x57c>
mov    0x28c3(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
mov    0x28d5(%rip),%rax
mov    (%rax),%esi
mov    0x288c(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    175f <put+0x5cf>
lea    0x947(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2878(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    1764 <put+0x5d4>
mov    -0x4(%rbp),%edi
lea    -0x25(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
je     18aa <put+0x71a>
cmpl   $0xffffffff,-0x34(%rbp)
jne    17a7 <put+0x617>
lea    0x8ab(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2830(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movsbl -0x25(%rbp),%eax
cmp    $0x2d,%eax
jne    18a0 <put+0x710>
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    17ee <put+0x65e>
lea    0x825(%rip),%rdi
call   10a0 <perror@plt>
mov    0x27e9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1806 <put+0x676>
mov    0x27c9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    183f <put+0x6af>
lea    0x7fb(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2798(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1857 <put+0x6c7>
mov    0x2778(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
call   1040 <write@plt>
cltq
cmp    -0x40(%rbp),%rax
jae    189b <put+0x70b>
lea    0x81b(%rip),%rdi
call   10a0 <perror@plt>
mov    0x273c(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    18a5 <put+0x715>
jmp    18aa <put+0x71a>
jmp    1764 <put+0x5d4>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
jne    18e7 <put+0x757>
lea    0x7e8(%rip),%rdi
call   10a0 <perror@plt>
mov    0x26f0(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    191a <put+0x78a>
movsbl -0x26(%rbp),%eax
cmp    $0x64,%eax
jne    18fe <put+0x76e>
jmp    15a4 <put+0x414>
movsbl -0x26(%rbp),%eax
cmp    $0x65,%eax
jne    1910 <put+0x780>
jmp    195c <put+0x7cc>
jmp    1915 <put+0x785>
jmp    191a <put+0x78a>
mov    0x26c7(%rip),%rax
mov    (%rax),%edi
lea    0x7a3(%rip),%rsi
mov    $0x1c,%edx
call   1040 <write@plt>
cmp    $0x1c,%eax
jge    1957 <put+0x7c7>
lea    0x6fb(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2680(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    15a4 <put+0x414>
jmp    19a3 <put+0x813>
mov    0x2680(%rip),%rax
mov    (%rax),%edi
lea    0x779(%rip),%rsi
mov    $0x2d,%edx
call   1040 <write@plt>
cmp    $0x2d,%eax
jge    199e <put+0x80e>
lea    0x6b4(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2631(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    19a3 <put+0x813>
jmp    19a8 <put+0x818>
jmp    19ef <put+0x85f>
mov    0x2634(%rip),%rax
mov    (%rax),%edi
lea    0x758(%rip),%rsi
mov    $0x10,%edx
call   1040 <write@plt>
cmp    $0x10,%eax
jge    19ea <put+0x85a>
lea    0x668(%rip),%rdi
call   10a0 <perror@plt>
mov    0x25ed(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    19ef <put+0x85f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
movl   $0x0,0x1c(%rsp)
movb   $0x2b,0xe(%rsp)
movb   $0x23,0xf(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x1c(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <read@plt>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
cmpl   $0x1,0x1c(%rsp)
jne    1263 <put+0xd3>
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
cltq
movb   $0x0,0x18(%rsp,%rax,1)
lea    0xdf9(%rip),%rsi
lea    0x18(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     128b <put+0xfb>
lea    0xe53(%rip),%rsi
lea    0x18(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1424 <put+0x294>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
mov    $0x2d,%edx
call   1040 <write@plt>
cmp    $0x2c,%eax
jg     1415 <put+0x285>
jmp    13c5 <put+0x235>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
mov    $0x10,%edx
call   1040 <write@plt>
cmp    $0xf,%eax
jg     1415 <put+0x285>
jmp    162a <put+0x49a>
mov    $0x1001,%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     164d <put+0x4bd>
mov    %rax,%r14
mov    $0x1001,%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     164d <put+0x4bd>
mov    %rax,%rbp
lea    0x20(%rsp),%rsi
mov    $0x8,%edx
mov    %ebx,%edi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
mov    0x20(%rsp),%rdx
mov    %ebx,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
cltq
movb   $0x0,(%r14,%rax,1)
mov    0x2ced(%rip),%rax
mov    0x2ca6(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %r14,%rdi
mov    $0x1a4,%edx
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     168b <put+0x4fb>
mov    %eax,%r15d
lea    0xe(%rsp),%r12
lea    0x10(%rsp),%r13
nopl   0x0(%rax)
mov    $0x1,%edx
mov    %ebx,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     13d1 <put+0x241>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
cmpb   $0x2d,0xe(%rsp)
jne    13d1 <put+0x241>
mov    $0x8,%edx
mov    %ebx,%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     163f <put+0x4af>
cmp    $0xffffffff,%eax
je     1671 <put+0x4e1>
mov    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1633 <put+0x4a3>
mov    0x10(%rsp),%edx
mov    %r15d,%edi
mov    %rbp,%rsi
call   1040 <write@plt>
cltq
cmp    %rax,0x10(%rsp)
jbe    1340 <put+0x1b0>
lea    0xc73(%rip),%rdi
jmp    1678 <put+0x4e8>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
lea    0xc6a(%rip),%rsi
mov    $0x1c,%edx
call   1040 <write@plt>
cmp    $0x1b,%eax
jle    162a <put+0x49a>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     1694 <put+0x504>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf(%rsp),%r15
lea    0xe(%rsp),%r12
lea    0x10(%rsp),%r13
mov    0x2bae(%rip),%r14
lea    0xc8c(%rip),%rbp
jmp    149d <put+0x30d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
lea    0xf(%rsp),%r15
mov    0x2b71(%rip),%r14
lea    0xc4f(%rip),%rbp
je     1656 <put+0x4c6>
mov    (%r14),%edi
mov    %rbp,%rsi
mov    $0x1c,%edx
call   1040 <write@plt>
cmp    $0x1b,%eax
jle    162a <put+0x49a>
mov    $0x1,%edx
mov    %ebx,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
mov    0xf(%rsp),%al
cmp    $0x64,%al
je     149d <put+0x30d>
cmp    $0x66,%al
je     14e0 <put+0x350>
cmp    $0x65,%al
jne    1484 <put+0x2f4>
jmp    1415 <put+0x285>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1001,%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     164d <put+0x4bd>
mov    %rax,%r15
mov    $0x1001,%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     164d <put+0x4bd>
mov    %rax,%rbp
mov    $0x8,%edx
mov    %ebx,%edi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
mov    0x20(%rsp),%rdx
mov    %ebx,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     165f <put+0x4cf>
cltq
movb   $0x0,(%r15,%rax,1)
mov    0x2a58(%rip),%rax
mov    (%rax),%esi
mov    0x2a8f(%rip),%rax
or     (%rax),%esi
mov    %r15,%rdi
mov    $0x1a4,%edx
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1668 <put+0x4d8>
mov    %eax,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%edx
mov    %ebx,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     1450 <put+0x2c0>
cmp    $0xffffffff,%eax
je     162a <put+0x49a>
cmpb   $0x2d,0xe(%rsp)
jne    1450 <put+0x2c0>
mov    $0x8,%edx
mov    %ebx,%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1621 <put+0x491>
mov    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <read@plt>
test   %eax,%eax
je     167d <put+0x4ed>
cmp    $0xffffffff,%eax
je     1633 <put+0x4a3>
cltq
movb   $0x0,0x0(%rbp,%rax,1)
mov    0x10(%rsp),%edx
mov    %r14d,%edi
mov    %rbp,%rsi
call   1040 <write@plt>
cltq
cmp    %rax,0x10(%rsp)
jbe    1590 <put+0x400>
lea    0xa84(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0x9d8(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0xa0e(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0x9ed(%rip),%rdi
call   10a0 <perror@plt>
mov    0x298a(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0x9bb(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0xa5f(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0xa19(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0xa24(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0x988(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2944(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0x98a(%rip),%rdi
jmp    163a <put+0x4aa>
lea    0x9cd(%rip),%rdi
jmp    163a <put+0x4aa>

LLVM IR (-O0):
@.str = [11 x i8] c"Error read\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.1 = [4 x i8] c"REG\00"
@.str.2 = [13 x i8] c"Error malloc\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@.str.3 = [11 x i8] c"Error open\00"
@.str.4 = [24 x i8] c"Error read file content\00"
@.str.5 = [12 x i8] c"Error write\00"
@STDOUT_FILENO = global i32 0
@.str.6 = [29 x i8] c"File received with success!\0A\00"
@.str.7 = [19 x i8] c"Error closing file\00"
@.str.8 = [4 x i8] c"DIR\00"
@.str.9 = [20 x i8] c"Error read filename\00"
@.str.10 = [16 x i8] c"Error open file\00"
@.str.11 = [25 x i8] c"Error write file content\00"
@.str.12 = [17 x i8] c"Error close file\00"
@.str.13 = [29 x i8] c"File received with success|\0A\00"
@.str.14 = [43 x i8] c"The file is not a regular file/directory!\0A\00"
@.str.15 = [17 x i8] c"File not found!\0A\00"
define void @put(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [4 x i8]
%8 = alloca i8
%9 = alloca i8
%10 = alloca i64
%11 = alloca i32
%12 = alloca i64
store i32 %0, i32* %2
store i32 0, i32* %4
store i8 43, i8* %8
store i8 35, i8* %9
store i64 0, i64* %10
%13 = load i32, i32* %2
%14 = call i32 (i32, ...) @read(i32 %13, i32* %4, i64 4)
store i32 %14, i32* %11
%15 = load i32, i32* %11
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %1
%18 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %1
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %402
24: ; preds = %21
%25 = load i32, i32* %2
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%27 = call i32 (i32, ...) @read(i32 %25, i8* %26, i32 3)
store i32 %27, i32* %11
%28 = load i32, i32* %11
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %24
%35 = load i32, i32* %11
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* @EXIT_SUCCESS
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %34
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 %42
store i8 0, i8* %43
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %198
47: ; preds = %40
%48 = call i64 @malloc(i32 4097)
%49 = inttoptr i64 %48 to i8*
store i8* %49, i8** %6
%50 = load i8*, i8** %6
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %56
52: ; preds = %47
%53 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %47
%57 = call i64 @malloc(i32 4097)
%58 = inttoptr i64 %57 to i8*
store i8* %58, i8** %5
%59 = load i8*, i8** %5
%60 = icmp eq i8* %59, null
br i1 %60, label %61, label %65
61: ; preds = %56
%62 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %56
%66 = load i32, i32* %2
%67 = call i32 (i32, ...) @read(i32 %66, i64* %10, i64 8)
store i32 %67, i32* %11
%68 = load i32, i32* %11
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %74
70: ; preds = %65
%71 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %65
%75 = load i32, i32* %11
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i32, i32* @EXIT_SUCCESS
%79 = call i32 @exit(i32 %78)
unreachable
80: ; preds = %74
%81 = load i32, i32* %2
%82 = load i8*, i8** %6
%83 = load i64, i64* %10
%84 = call i32 (i32, ...) @read(i32 %81, i8* %82, i64 %83)
store i32 %84, i32* %11
%85 = load i32, i32* %11
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %91
87: ; preds = %80
%88 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%89 = load i32, i32* @EXIT_FAILURE
%90 = call i32 @exit(i32 %89)
unreachable
91: ; preds = %80
%92 = load i32, i32* %11
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %91
%95 = load i32, i32* @EXIT_SUCCESS
%96 = call i32 @exit(i32 %95)
unreachable
97: ; preds = %91
%98 = load i8*, i8** %6
%99 = load i32, i32* %11
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %98, i64 %100
store i8 0, i8* %101
%102 = load i8*, i8** %6
%103 = load i32, i32* @O_CREAT
%104 = load i32, i32* @O_WRONLY
%105 = or i32 %103, %104
%106 = call i32 @open(i8* %102, i32 %105, i32 420)
store i32 %106, i32* %3
%107 = load i32, i32* %3
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %113
109: ; preds = %97
%110 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%111 = load i32, i32* @EXIT_FAILURE
%112 = call i32 @exit(i32 %111)
unreachable
113: ; preds = %97
br label %114
114: ; preds = %176, %113
%115 = load i32, i32* %2
%116 = call i32 (i32, ...) @read(i32 %115, i8* %8, i64 1)
store i32 %116, i32* %11
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %177
118: ; preds = %114
%119 = load i32, i32* %11
%120 = icmp eq i32 %119, -1
br i1 %120, label %121, label %125
121: ; preds = %118
%122 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%123 = load i32, i32* @EXIT_FAILURE
%124 = call i32 @exit(i32 %123)
unreachable
125: ; preds = %118
%126 = load i8, i8* %8
%127 = sext i8 %126 to i32
%128 = icmp eq i32 %127, 45
br i1 %128, label %129, label %175
129: ; preds = %125
%130 = load i32, i32* %2
%131 = call i32 (i32, ...) @read(i32 %130, i64* %12, i64 8)
store i32 %131, i32* %11
%132 = load i32, i32* %11
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %138
134: ; preds = %129
%135 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%136 = load i32, i32* @EXIT_SUCCESS
%137 = call i32 @exit(i32 %136)
unreachable
138: ; preds = %129
%139 = load i32, i32* %11
%140 = icmp eq i32 %139, 0
br i1 %140, label %141, label %144
141: ; preds = %138
%142 = load i32, i32* @EXIT_FAILURE
%143 = call i32 @exit(i32 %142)
unreachable
144: ; preds = %138
%145 = load i32, i32* %2
%146 = load i8*, i8** %5
%147 = load i64, i64* %12
%148 = call i32 (i32, ...) @read(i32 %145, i8* %146, i64 %147)
store i32 %148, i32* %11
%149 = load i32, i32* %11
%150 = icmp eq i32 %149, -1
br i1 %150, label %151, label %155
151: ; preds = %144
%152 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%153 = load i32, i32* @EXIT_FAILURE
%154 = call i32 @exit(i32 %153)
unreachable
155: ; preds = %144
%156 = load i32, i32* %11
%157 = icmp eq i32 %156, 0
br i1 %157, label %158, label %161
158: ; preds = %155
%159 = load i32, i32* @EXIT_SUCCESS
%160 = call i32 @exit(i32 %159)
unreachable
161: ; preds = %155
%162 = load i32, i32* %3
%163 = load i8*, i8** %5
%164 = load i64, i64* %12
%165 = trunc i64 %164 to i32
%166 = call i32 @write(i32 %162, i8* %163, i32 %165)
%167 = sext i32 %166 to i64
%168 = load i64, i64* %12
%169 = icmp ult i64 %167, %168
br i1 %169, label %170, label %174
170: ; preds = %161
%171 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%172 = load i32, i32* @EXIT_SUCCESS
%173 = call i32 @exit(i32 %172)
unreachable
174: ; preds = %161
br label %176
175: ; preds = %125
br label %177
176: ; preds = %174
br label %114
177: ; preds = %175, %114
%178 = load i32, i32* @STDOUT_FILENO
%179 = call i32 @write(i32 %178, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 28)
%180 = icmp slt i32 %179, 28
br i1 %180, label %181, label %185
181: ; preds = %177
%182 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%183 = load i32, i32* @EXIT_FAILURE
%184 = call i32 @exit(i32 %183)
unreachable
185: ; preds = %177
%186 = load i8*, i8** %5
%187 = call i32 @free(i8* %186)
%188 = load i8*, i8** %6
%189 = call i32 @free(i8* %188)
%190 = load i32, i32* %3
%191 = call i32 @close(i32 %190)
%192 = icmp eq i32 %191, -1
br i1 %192, label %193, label %197
193: ; preds = %185
%194 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%195 = load i32, i32* @EXIT_FAILURE
%196 = call i32 @exit(i32 %195)
unreachable
197: ; preds = %185
br label %401
198: ; preds = %40
%199 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%200 = call i64 @strcmp(i8* %199, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%201 = icmp eq i64 %200, 0
br i1 %201, label %202, label %391
202: ; preds = %198
br label %203
203: ; preds = %389, %373, %202
%204 = load i32, i32* %2
%205 = call i32 (i32, ...) @read(i32 %204, i8* %9, i64 1)
store i32 %205, i32* %11
%206 = load i32, i32* %11
%207 = icmp eq i32 %206, -1
br i1 %207, label %208, label %212
208: ; preds = %203
%209 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%210 = load i32, i32* @EXIT_FAILURE
%211 = call i32 @exit(i32 %210)
unreachable
212: ; preds = %203
%213 = load i32, i32* %11
%214 = icmp eq i32 %213, 0
br i1 %214, label %215, label %218
215: ; preds = %212
%216 = load i32, i32* @EXIT_SUCCESS
%217 = call i32 @exit(i32 %216)
unreachable
218: ; preds = %212
%219 = load i8, i8* %9
%220 = sext i8 %219 to i32
%221 = icmp eq i32 %220, 102
br i1 %221, label %222, label %369
222: ; preds = %218
%223 = call i64 @malloc(i32 4097)
%224 = inttoptr i64 %223 to i8*
store i8* %224, i8** %6
%225 = load i8*, i8** %6
%226 = icmp eq i8* %225, null
br i1 %226, label %227, label %231
227: ; preds = %222
%228 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%229 = load i32, i32* @EXIT_FAILURE
%230 = call i32 @exit(i32 %229)
unreachable
231: ; preds = %222
%232 = call i64 @malloc(i32 4097)
%233 = inttoptr i64 %232 to i8*
store i8* %233, i8** %5
%234 = load i8*, i8** %5
%235 = icmp eq i8* %234, null
br i1 %235, label %236, label %240
236: ; preds = %231
%237 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%238 = load i32, i32* @EXIT_FAILURE
%239 = call i32 @exit(i32 %238)
unreachable
240: ; preds = %231
%241 = load i32, i32* %2
%242 = call i32 (i32, ...) @read(i32 %241, i64* %10, i64 8)
store i32 %242, i32* %11
%243 = load i32, i32* %11
%244 = icmp eq i32 %243, -1
br i1 %244, label %245, label %249
245: ; preds = %240
%246 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%247 = load i32, i32* @EXIT_FAILURE
%248 = call i32 @exit(i32 %247)
unreachable
249: ; preds = %240
%250 = load i32, i32* %11
%251 = icmp eq i32 %250, 0
br i1 %251, label %252, label %255
252: ; preds = %249
%253 = load i32, i32* @EXIT_SUCCESS
%254 = call i32 @exit(i32 %253)
unreachable
255: ; preds = %249
%256 = load i32, i32* %2
%257 = load i8*, i8** %6
%258 = load i64, i64* %10
%259 = call i32 (i32, ...) @read(i32 %256, i8* %257, i64 %258)
store i32 %259, i32* %11
%260 = load i32, i32* %11
%261 = icmp eq i32 %260, -1
br i1 %261, label %262, label %266
262: ; preds = %255
%263 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%264 = load i32, i32* @EXIT_FAILURE
%265 = call i32 @exit(i32 %264)
unreachable
266: ; preds = %255
%267 = load i32, i32* %11
%268 = icmp eq i32 %267, 0
br i1 %268, label %269, label %272
269: ; preds = %266
%270 = load i32, i32* @EXIT_SUCCESS
%271 = call i32 @exit(i32 %270)
unreachable
272: ; preds = %266
%273 = load i8*, i8** %6
%274 = load i32, i32* %11
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds i8, i8* %273, i64 %275
store i8 0, i8* %276
%277 = load i8*, i8** %6
%278 = load i32, i32* @O_CREAT
%279 = load i32, i32* @O_WRONLY
%280 = or i32 %278, %279
%281 = call i32 @open(i8* %277, i32 %280, i32 420)
store i32 %281, i32* %3
%282 = load i32, i32* %3
%283 = icmp eq i32 %282, -1
br i1 %283, label %284, label %288
284: ; preds = %272
%285 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%286 = load i32, i32* @EXIT_FAILURE
%287 = call i32 @exit(i32 %286)
unreachable
288: ; preds = %272
br label %289
289: ; preds = %355, %288
%290 = load i32, i32* %2
%291 = call i32 (i32, ...) @read(i32 %290, i8* %8, i64 1)
store i32 %291, i32* %11
%292 = icmp ne i32 %291, 0
br i1 %292, label %293, label %356
293: ; preds = %289
%294 = load i32, i32* %11
%295 = icmp eq i32 %294, -1
br i1 %295, label %296, label %300
296: ; preds = %293
%297 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%298 = load i32, i32* @EXIT_FAILURE
%299 = call i32 @exit(i32 %298)
unreachable
300: ; preds = %293
%301 = load i8, i8* %8
%302 = sext i8 %301 to i32
%303 = icmp eq i32 %302, 45
br i1 %303, label %304, label %354
304: ; preds = %300
%305 = load i32, i32* %2
%306 = call i32 (i32, ...) @read(i32 %305, i64* %12, i64 8)
store i32 %306, i32* %11
%307 = load i32, i32* %11
%308 = icmp eq i32 %307, -1
br i1 %308, label %309, label %313
309: ; preds = %304
%310 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%311 = load i32, i32* @EXIT_FAILURE
%312 = call i32 @exit(i32 %311)
unreachable
313: ; preds = %304
%314 = load i32, i32* %11
%315 = icmp eq i32 %314, 0
br i1 %315, label %316, label %319
316: ; preds = %313
%317 = load i32, i32* @EXIT_SUCCESS
%318 = call i32 @exit(i32 %317)
unreachable
319: ; preds = %313
%320 = load i32, i32* %2
%321 = load i8*, i8** %5
%322 = load i64, i64* %12
%323 = call i32 (i32, ...) @read(i32 %320, i8* %321, i64 %322)
store i32 %323, i32* %11
%324 = load i32, i32* %11
%325 = icmp eq i32 %324, -1
br i1 %325, label %326, label %330
326: ; preds = %319
%327 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%328 = load i32, i32* @EXIT_FAILURE
%329 = call i32 @exit(i32 %328)
unreachable
330: ; preds = %319
%331 = load i32, i32* %11
%332 = icmp eq i32 %331, 0
br i1 %332, label %333, label %336
333: ; preds = %330
%334 = load i32, i32* @EXIT_SUCCESS
%335 = call i32 @exit(i32 %334)
unreachable
336: ; preds = %330
%337 = load i8*, i8** %5
%338 = load i32, i32* %11
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds i8, i8* %337, i64 %339
store i8 0, i8* %340
%341 = load i32, i32* %3
%342 = load i8*, i8** %5
%343 = load i64, i64* %12
%344 = trunc i64 %343 to i32
%345 = call i32 @write(i32 %341, i8* %342, i32 %344)
%346 = sext i32 %345 to i64
%347 = load i64, i64* %12
%348 = icmp ult i64 %346, %347
br i1 %348, label %349, label %353
349: ; preds = %336
%350 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%351 = load i32, i32* @EXIT_FAILURE
%352 = call i32 @exit(i32 %351)
unreachable
353: ; preds = %336
br label %355
354: ; preds = %300
br label %356
355: ; preds = %353
br label %289
356: ; preds = %354, %289
%357 = load i8*, i8** %5
%358 = call i32 @free(i8* %357)
%359 = load i8*, i8** %6
%360 = call i32 @free(i8* %359)
%361 = load i32, i32* %3
%362 = call i32 @close(i32 %361)
%363 = icmp eq i32 %362, -1
br i1 %363, label %364, label %368
364: ; preds = %356
%365 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
%366 = load i32, i32* @EXIT_FAILURE
%367 = call i32 @exit(i32 %366)
unreachable
368: ; preds = %356
br label %381
369: ; preds = %218
%370 = load i8, i8* %9
%371 = sext i8 %370 to i32
%372 = icmp eq i32 %371, 100
br i1 %372, label %373, label %374
373: ; preds = %369
br label %203
374: ; preds = %369
%375 = load i8, i8* %9
%376 = sext i8 %375 to i32
%377 = icmp eq i32 %376, 101
br i1 %377, label %378, label %379
378: ; preds = %374
br label %390
379: ; preds = %374
br label %380
380: ; preds = %379
br label %381
381: ; preds = %380, %368
%382 = load i32, i32* @STDOUT_FILENO
%383 = call i32 @write(i32 %382, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 28)
%384 = icmp slt i32 %383, 28
br i1 %384, label %385, label %389
385: ; preds = %381
%386 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%387 = load i32, i32* @EXIT_FAILURE
%388 = call i32 @exit(i32 %387)
unreachable
389: ; preds = %381
br label %203
390: ; preds = %378
br label %400
391: ; preds = %198
%392 = load i32, i32* @STDOUT_FILENO
%393 = call i32 @write(i32 %392, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i32 45)
%394 = icmp slt i32 %393, 45
br i1 %394, label %395, label %399
395: ; preds = %391
%396 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%397 = load i32, i32* @EXIT_SUCCESS
%398 = call i32 @exit(i32 %397)
unreachable
399: ; preds = %391
br label %400
400: ; preds = %399, %390
br label %401
401: ; preds = %400, %197
br label %411
402: ; preds = %21
%403 = load i32, i32* @STDOUT_FILENO
%404 = call i32 @write(i32 %403, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 16)
%405 = icmp slt i32 %404, 16
br i1 %405, label %406, label %410
406: ; preds = %402
%407 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%408 = load i32, i32* @EXIT_FAILURE
%409 = call i32 @exit(i32 %408)
unreachable
410: ; preds = %402
br label %411
411: ; preds = %410, %401
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Error read\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.1 = [4 x i8] c"REG\00"
@.str.2 = [13 x i8] c"Error malloc\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@.str.3 = [11 x i8] c"Error open\00"
@.str.4 = [24 x i8] c"Error read file content\00"
@.str.5 = [12 x i8] c"Error write\00"
@STDOUT_FILENO = global i32 0
@.str.6 = [29 x i8] c"File received with success!\0A\00"
@.str.7 = [19 x i8] c"Error closing file\00"
@.str.8 = [4 x i8] c"DIR\00"
@.str.9 = [20 x i8] c"Error read filename\00"
@.str.10 = [16 x i8] c"Error open file\00"
@.str.11 = [25 x i8] c"Error write file content\00"
@.str.12 = [17 x i8] c"Error close file\00"
@.str.13 = [29 x i8] c"File received with success|\0A\00"
@.str.14 = [43 x i8] c"The file is not a regular file/directory!\0A\00"
@.str.15 = [17 x i8] c"File not found!\0A\00"
define void @put(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
%4 = alloca i8
%5 = alloca i8
%6 = alloca i64
%7 = alloca i64
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 43, i8* %4
store i8 35, i8* %5
%10 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%11 = bitcast i64* %7 to i8*
%12 = call i32 (i32, ...) @read(i32 %0, i32* %2, i64 4)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %1
%15 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %1
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %266
21: ; preds = %18
%22 = call i32 (i32, ...) @read(i32 %0, i8* %9, i32 3)
switch i32 %22, label %30 [
i32 -1, label %23
i32 0, label %27
]
23: ; preds = %21
%24 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %21
%28 = load i32, i32* @EXIT_SUCCESS
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %21
%31 = sext i32 %22 to i64
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %138
35: ; preds = %30
%36 = call i64 @malloc(i32 4097)
%37 = inttoptr i64 %36 to i8*
%38 = icmp eq i64 %36, 0
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %35
%44 = call i64 @malloc(i32 4097)
%45 = inttoptr i64 %44 to i8*
%46 = icmp eq i64 %44, 0
br i1 %46, label %47, label %51
47: ; preds = %43
%48 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%49 = load i32, i32* @EXIT_FAILURE
%50 = call i32 @exit(i32 %49)
unreachable
51: ; preds = %43
%52 = call i32 (i32, ...) @read(i32 %0, i64* %6, i64 8)
switch i32 %52, label %60 [
i32 -1, label %53
i32 0, label %57
]
53: ; preds = %51
%54 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %51
%58 = load i32, i32* @EXIT_SUCCESS
%59 = call i32 @exit(i32 %58)
unreachable
60: ; preds = %51
%61 = load i64, i64* %6
%62 = call i32 (i32, ...) @read(i32 %0, i8* %37, i64 %61)
switch i32 %62, label %70 [
i32 -1, label %63
i32 0, label %67
]
63: ; preds = %60
%64 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%65 = load i32, i32* @EXIT_FAILURE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %60
%68 = load i32, i32* @EXIT_SUCCESS
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %60
%71 = sext i32 %62 to i64
%72 = getelementptr inbounds i8, i8* %37, i64 %71
store i8 0, i8* %72
%73 = load i32, i32* @O_CREAT
%74 = load i32, i32* @O_WRONLY
%75 = or i32 %74, %73
%76 = call i32 @open(i8* %37, i32 %75, i32 420)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %82
78: ; preds = %70
%79 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %70, %110
%83 = call i32 (i32, ...) @read(i32 %0, i8* %4, i64 1)
switch i32 %83, label %88 [
i32 0, label %121
i32 -1, label %84
]
84: ; preds = %82
%85 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%86 = load i32, i32* @EXIT_FAILURE
%87 = call i32 @exit(i32 %86)
unreachable
88: ; preds = %82
%89 = load i8, i8* %4
%90 = icmp eq i8 %89, 45
br i1 %90, label %91, label %121
91: ; preds = %88
%92 = call i32 (i32, ...) @read(i32 %0, i64* %7, i64 8)
switch i32 %92, label %100 [
i32 -1, label %93
i32 0, label %97
]
93: ; preds = %91
%94 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%95 = load i32, i32* @EXIT_SUCCESS
%96 = call i32 @exit(i32 %95)
unreachable
97: ; preds = %91
%98 = load i32, i32* @EXIT_FAILURE
%99 = call i32 @exit(i32 %98)
unreachable
100: ; preds = %91
%101 = load i64, i64* %7
%102 = call i32 (i32, ...) @read(i32 %0, i8* %45, i64 %101)
switch i32 %102, label %110 [
i32 -1, label %103
i32 0, label %107
]
103: ; preds = %100
%104 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%105 = load i32, i32* @EXIT_FAILURE
%106 = call i32 @exit(i32 %105)
unreachable
107: ; preds = %100
%108 = load i32, i32* @EXIT_SUCCESS
%109 = call i32 @exit(i32 %108)
unreachable
110: ; preds = %100
%111 = load i64, i64* %7
%112 = trunc i64 %111 to i32
%113 = call i32 @write(i32 %76, i8* %45, i32 %112)
%114 = sext i32 %113 to i64
%115 = load i64, i64* %7
%116 = icmp ugt i64 %115, %114
br i1 %116, label %117, label %82
117: ; preds = %110
%118 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%119 = load i32, i32* @EXIT_SUCCESS
%120 = call i32 @exit(i32 %119)
unreachable
121: ; preds = %82, %88
%122 = load i32, i32* @STDOUT_FILENO
%123 = call i32 @write(i32 %122, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 28)
%124 = icmp slt i32 %123, 28
br i1 %124, label %125, label %129
125: ; preds = %121
%126 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%127 = load i32, i32* @EXIT_FAILURE
%128 = call i32 @exit(i32 %127)
unreachable
129: ; preds = %121
%130 = call i32 @free(i8* %45)
%131 = call i32 @free(i8* %37)
%132 = call i32 @close(i32 %76)
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %274
134: ; preds = %129
%135 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%136 = load i32, i32* @EXIT_FAILURE
%137 = call i32 @exit(i32 %136)
unreachable
138: ; preds = %30
%139 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %258
141: ; preds = %138, %253
%142 = call i32 (i32, ...) @read(i32 %0, i8* %5, i64 1)
switch i32 %142, label %150 [
i32 -1, label %143
i32 0, label %147
]
143: ; preds = %141
%144 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%145 = load i32, i32* @EXIT_FAILURE
%146 = call i32 @exit(i32 %145)
unreachable
147: ; preds = %141
%148 = load i32, i32* @EXIT_SUCCESS
%149 = call i32 @exit(i32 %148)
unreachable
150: ; preds = %141
%151 = load i8, i8* %5
switch i8 %151, label %249 [
i8 102, label %152
i8 100, label %253
i8 101, label %274
]
152: ; preds = %150
%153 = call i64 @malloc(i32 4097)
%154 = inttoptr i64 %153 to i8*
%155 = icmp eq i64 %153, 0
br i1 %155, label %156, label %160
156: ; preds = %152
%157 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%158 = load i32, i32* @EXIT_FAILURE
%159 = call i32 @exit(i32 %158)
unreachable
160: ; preds = %152
%161 = call i64 @malloc(i32 4097)
%162 = inttoptr i64 %161 to i8*
%163 = icmp eq i64 %161, 0
br i1 %163, label %164, label %168
164: ; preds = %160
%165 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%166 = load i32, i32* @EXIT_FAILURE
%167 = call i32 @exit(i32 %166)
unreachable
168: ; preds = %160
%169 = call i32 (i32, ...) @read(i32 %0, i64* %6, i64 8)
switch i32 %169, label %177 [
i32 -1, label %170
i32 0, label %174
]
170: ; preds = %168
%171 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%172 = load i32, i32* @EXIT_FAILURE
%173 = call i32 @exit(i32 %172)
unreachable
174: ; preds = %168
%175 = load i32, i32* @EXIT_SUCCESS
%176 = call i32 @exit(i32 %175)
unreachable
177: ; preds = %168
%178 = load i64, i64* %6
%179 = call i32 (i32, ...) @read(i32 %0, i8* %154, i64 %178)
switch i32 %179, label %187 [
i32 -1, label %180
i32 0, label %184
]
180: ; preds = %177
%181 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%182 = load i32, i32* @EXIT_FAILURE
%183 = call i32 @exit(i32 %182)
unreachable
184: ; preds = %177
%185 = load i32, i32* @EXIT_SUCCESS
%186 = call i32 @exit(i32 %185)
unreachable
187: ; preds = %177
%188 = sext i32 %179 to i64
%189 = getelementptr inbounds i8, i8* %154, i64 %188
store i8 0, i8* %189
%190 = load i32, i32* @O_CREAT
%191 = load i32, i32* @O_WRONLY
%192 = or i32 %191, %190
%193 = call i32 @open(i8* %154, i32 %192, i32 420)
%194 = icmp eq i32 %193, -1
br i1 %194, label %195, label %199
195: ; preds = %187
%196 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%197 = load i32, i32* @EXIT_FAILURE
%198 = call i32 @exit(i32 %197)
unreachable
199: ; preds = %187, %227
%200 = call i32 (i32, ...) @read(i32 %0, i8* %4, i64 1)
switch i32 %200, label %205 [
i32 0, label %240
i32 -1, label %201
]
201: ; preds = %199
%202 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%203 = load i32, i32* @EXIT_FAILURE
%204 = call i32 @exit(i32 %203)
unreachable
205: ; preds = %199
%206 = load i8, i8* %4
%207 = icmp eq i8 %206, 45
br i1 %207, label %208, label %240
208: ; preds = %205
%209 = call i32 (i32, ...) @read(i32 %0, i64* %7, i64 8)
switch i32 %209, label %217 [
i32 -1, label %210
i32 0, label %214
]
210: ; preds = %208
%211 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%212 = load i32, i32* @EXIT_FAILURE
%213 = call i32 @exit(i32 %212)
unreachable
214: ; preds = %208
%215 = load i32, i32* @EXIT_SUCCESS
%216 = call i32 @exit(i32 %215)
unreachable
217: ; preds = %208
%218 = load i64, i64* %7
%219 = call i32 (i32, ...) @read(i32 %0, i8* %162, i64 %218)
switch i32 %219, label %227 [
i32 -1, label %220
i32 0, label %224
]
220: ; preds = %217
%221 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%222 = load i32, i32* @EXIT_FAILURE
%223 = call i32 @exit(i32 %222)
unreachable
224: ; preds = %217
%225 = load i32, i32* @EXIT_SUCCESS
%226 = call i32 @exit(i32 %225)
unreachable
227: ; preds = %217
%228 = sext i32 %219 to i64
%229 = getelementptr inbounds i8, i8* %162, i64 %228
store i8 0, i8* %229
%230 = load i64, i64* %7
%231 = trunc i64 %230 to i32
%232 = call i32 @write(i32 %193, i8* %162, i32 %231)
%233 = sext i32 %232 to i64
%234 = load i64, i64* %7
%235 = icmp ugt i64 %234, %233
br i1 %235, label %236, label %199
236: ; preds = %227
%237 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%238 = load i32, i32* @EXIT_FAILURE
%239 = call i32 @exit(i32 %238)
unreachable
240: ; preds = %199, %205
%241 = call i32 @free(i8* %162)
%242 = call i32 @free(i8* %154)
%243 = call i32 @close(i32 %193)
%244 = icmp eq i32 %243, -1
br i1 %244, label %245, label %249
245: ; preds = %240
%246 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
%247 = load i32, i32* @EXIT_FAILURE
%248 = call i32 @exit(i32 %247)
unreachable
249: ; preds = %150, %240
%250 = load i32, i32* @STDOUT_FILENO
%251 = call i32 @write(i32 %250, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 28)
%252 = icmp slt i32 %251, 28
br i1 %252, label %254, label %253
253: ; preds = %249, %150
br label %141
254: ; preds = %249
%255 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%256 = load i32, i32* @EXIT_FAILURE
%257 = call i32 @exit(i32 %256)
unreachable
258: ; preds = %138
%259 = load i32, i32* @STDOUT_FILENO
%260 = call i32 @write(i32 %259, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i32 45)
%261 = icmp slt i32 %260, 45
br i1 %261, label %262, label %274
262: ; preds = %258
%263 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%264 = load i32, i32* @EXIT_SUCCESS
%265 = call i32 @exit(i32 %264)
unreachable
266: ; preds = %18
%267 = load i32, i32* @STDOUT_FILENO
%268 = call i32 @write(i32 %267, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 16)
%269 = icmp slt i32 %268, 16
br i1 %269, label %270, label %274
270: ; preds = %266
%271 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%272 = load i32, i32* @EXIT_FAILURE
%273 = call i32 @exit(i32 %272)
unreachable
274: ; preds = %150, %266, %129, %258
ret void
}