#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 {
  scalar_t__ st_mtime;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int AT_FDCWD;
int /*<<< orphan*/ AT_SYMLINK_NOFOLLOW;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ F_OK;
int O_CREAT;
int O_DIRECTORY;
int O_RDONLY;
int O_TRUNC;
int O_WRONLY;
scalar_t__ S_ISLNK(int /*<<< orphan*/);
int /*<<< orphan*/ W_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
char *calloc(int, int);
int /*<<< orphan*/ close(int);
int errno;
scalar_t__ faccessat(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int fstatat(int, char *, struct stat *, int /*<<< orphan*/);
int getc(int /*<<< orphan*/);
scalar_t__ mycp_copy(int, int);
int open(char *, int, ...);
int openat(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int readlink(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
int stat(char *, struct stat *);
int /*<<< orphan*/ stdin;
scalar_t__ symlink(char *, char *);
scalar_t__ symlinkat(char *, int, char *);
scalar_t__ unlink(char *);
scalar_t__ unlinkat(int, char *, int /*<<< orphan*/);
int mycp_do_copy(char **sources, int sources_len, char *destname,
                 int dest_is_dir, char **err_msg, int err_msg_len,
                 int verbose_flag, int update_flag, int dereference_flag,
                 int no_clobber_flag, int interactive_flag) {
  int src, destdir, dest;
  int s_ind, err, ans;
  int dest_exist;
  int allow_copy = 1;
  int linkname_len_max = 1024;
  int linkname_len;
  char *linkname;
  struct stat src_stat;
  struct stat dest_stat;
  if (dest_is_dir) {
    destdir = open(destname, O_RDONLY | O_DIRECTORY);
    if (destdir == -1) {
      err = errno;
      snprintf(*err_msg, err_msg_len, "failed to open '%s'", destname);
      errno = err;
      return EXIT_FAILURE;
    }
  }
  for (s_ind = 0; s_ind < sources_len; s_ind++) {
    if (dereference_flag)
      err = stat(sources[s_ind], &src_stat);
    else
      err = fstatat(AT_FDCWD, sources[s_ind], &src_stat, AT_SYMLINK_NOFOLLOW);
    if (err) {
      err = errno;
      snprintf(*err_msg, err_msg_len, "cannot stat '%s'", sources[s_ind]);
      if (dest_is_dir)
        close(destdir);
      errno = err;
      return EXIT_FAILURE;
    }
    if (dereference_flag && S_ISLNK(src_stat.st_mode))
      src = open(sources[s_ind], O_RDONLY);
    else
      src = openat(AT_FDCWD, sources[s_ind], O_RDONLY, AT_SYMLINK_NOFOLLOW);
    if (src == -1) {
      if (dest_is_dir) {
        err = errno;
        snprintf(*err_msg, err_msg_len, "failed to open '%s'", sources[s_ind]);
        close(destdir);
        errno = err;
      }
      return EXIT_FAILURE;
    }
    if (dest_is_dir) {
      dest_exist = faccessat(destdir, sources[s_ind], F_OK, 0) == 0;
      if (dest_exist) {
        if (faccessat(destdir, sources[s_ind], W_OK, 0)) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "cannot create regular file '%s'",
                   sources[s_ind]);
          close(src);
          close(destdir);
          errno = err;
          return EXIT_FAILURE;
        }
        if (fstatat(destdir, sources[s_ind], &dest_stat, 0)) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "connot stat '%s'", sources[s_ind]);
          close(src);
          close(destdir);
          errno = err;
          return EXIT_FAILURE;
        }
        allow_copy =
            !(update_flag && !(src_stat.st_mtime > dest_stat.st_mtime)) &&
            !no_clobber_flag;
        if (interactive_flag && allow_copy) {
          printf("%s: overwrite '%s/%s'? ", "", destname, sources[s_ind]);
          ans = getc(stdin);
          allow_copy = ans == 'y' || ans == 'Y';
        }
      }
      if (allow_copy && !S_ISLNK(src_stat.st_mode)) {
        dest = openat(destdir, sources[s_ind], O_CREAT | O_WRONLY | O_TRUNC,
                      src_stat.st_mode);
        if (dest == -1) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "failed to open '%s/%s':", destname,
                   sources[s_ind]);
          close(src);
          close(destdir);
          errno = err;
          return EXIT_FAILURE;
        }
        if (verbose_flag) {
          printf("'%s' -> '%s/%s'\n", sources[s_ind], destname, sources[s_ind]);
        }
      }
    } else {
      dest_exist = access(destname, F_OK) == 0;
      if (dest_exist) {
        if (access(destname, W_OK)) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "cannot create regular file '%s'",
                   sources[s_ind]);
          close(src);
          errno = err;
          return EXIT_FAILURE;
        }
        if (stat(destname, &dest_stat)) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "connot stat '%s'", destname);
          close(src);
          errno = err;
          return EXIT_FAILURE;
        }
        allow_copy =
            !(update_flag && !(src_stat.st_mtime > dest_stat.st_mtime)) &&
            !no_clobber_flag;
        if (interactive_flag && allow_copy) {
          printf("%s: overwrite '%s'? ", "", destname);
          ans = getc(stdin);
          allow_copy = ans == 'y' || ans == 'Y';
        }
      }
      if (allow_copy && !S_ISLNK(src_stat.st_mode)) {
        dest = open(destname, O_CREAT | O_WRONLY | O_TRUNC, src_stat.st_mode);
        if (dest == -1) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "failed to open '%s'", destname);
          close(src);
          errno = err;
          return EXIT_FAILURE;
        }
        if (verbose_flag) {
          printf("'%s' -> '%s'\n", sources[s_ind], destname);
        }
      }
    }
    if (allow_copy && !S_ISLNK(src_stat.st_mode)) {
      if (mycp_copy(src, dest)) {
        err = errno;
        snprintf(*err_msg, err_msg_len, "cannot copy '%s'", destname);
        close(src);
        close(dest);
        if (dest_is_dir)
          close(destdir);
        errno = err;
        return EXIT_FAILURE;
      }
      close(dest);
    }
    if (allow_copy && S_ISLNK(src_stat.st_mode)) {
      linkname = calloc(linkname_len_max, sizeof(char));
      if (linkname == NULL) {
        err = errno;
        close(src);
        if (dest_is_dir)
          close(destdir);
        errno = err;
        return EXIT_FAILURE;
      }
      linkname_len = readlink(sources[s_ind], linkname, linkname_len_max);
      if (linkname_len == -1) {
        err = errno;
        snprintf(*err_msg, err_msg_len, "failed access link '%s'",
                 sources[s_ind]);
        free(linkname);
        close(src);
        if (dest_is_dir)
          close(destdir);
        errno = err;
        return EXIT_FAILURE;
      }
      linkname[linkname_len] = '\0';
      if (dest_exist) {
        if (dest_is_dir) {
          if (unlinkat(destdir, sources[s_ind], 0)) {
            err = errno;
            snprintf(*err_msg, err_msg_len, "failed to remove '%s/%s'",
                     destname, sources[s_ind]);
            free(linkname);
            close(src);
            if (dest_is_dir)
              close(destdir);
            errno = err;
            return EXIT_FAILURE;
          }
          if (verbose_flag)
            printf("'%s/%s' removed\n", destname, sources[s_ind]);
        } else {
          if (unlink(destname)) {
            err = errno;
            snprintf(*err_msg, err_msg_len, "failed to remove '%s'",
                     sources[s_ind]);
            free(linkname);
            close(src);
            if (dest_is_dir)
              close(destdir);
            errno = err;
            return EXIT_FAILURE;
          }
          if (verbose_flag)
            printf("'%s' removed\n", destname);
        }
      }
      if (dest_is_dir) {
        if (symlinkat(linkname, destdir, sources[s_ind])) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "failed to create link '%s/%s'",
                   destname, sources[s_ind]);
          free(linkname);
          close(src);
          if (dest_is_dir)
            close(destdir);
          errno = err;
          return EXIT_FAILURE;
        }
        if (verbose_flag) {
          printf("'%s' -> '%s/%s'\n", sources[s_ind], destname, sources[s_ind]);
        }
      } else {
        if (symlink(linkname, destname)) {
          err = errno;
          snprintf(*err_msg, err_msg_len, "failed to remove '%s'",
                   sources[s_ind]);
          free(linkname);
          close(src);
          if (dest_is_dir)
            close(destdir);
          errno = err;
          return EXIT_FAILURE;
        }
        if (verbose_flag) {
          printf("'%s' -> '%s'\n", sources[s_ind], destname);
        }
      }
      free(linkname);
    }
    close(src);
  }
  if (dest_is_dir)
    close(destdir);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<mycp_do_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movl   $0x1,-0x54(%rbp)
movl   $0x400,-0x58(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12ec <mycp_do_copy+0xbc>
mov    -0x20(%rbp),%rdi
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
mov    0x2d2c(%rip),%rax
or     (%rax),%esi
mov    $0x0,%al
call   1100 <open@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    12e7 <mycp_do_copy+0xb7>
mov    0x2d07(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0xd3d(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x48(%rbp),%ecx
mov    0x2cdc(%rip),%rax
mov    %ecx,(%rax)
mov    0x2ccb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
jmp    12ec <mycp_do_copy+0xbc>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1efb <mycp_do_copy+0xccb>
cmpl   $0x0,0x20(%rbp)
je     1326 <mycp_do_copy+0xf6>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x78(%rbp),%rsi
call   10f0 <stat@plt>
mov    %eax,-0x48(%rbp)
jmp    1350 <mycp_do_copy+0x120>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x2c5e(%rip),%rax
mov    (%rax),%ecx
lea    -0x78(%rbp),%rdx
call   1150 <fstatat@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     13b9 <mycp_do_copy+0x189>
mov    0x2c4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xc91(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
cmpl   $0x0,-0x24(%rbp)
je     139c <mycp_do_copy+0x16c>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2c0a(%rip),%rax
mov    %ecx,(%rax)
mov    0x2bf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x20(%rbp)
je     13f9 <mycp_do_copy+0x1c9>
mov    -0x70(%rbp),%edi
call   1050 <S_ISLNK@plt>
cmp    $0x0,%rax
je     13f9 <mycp_do_copy+0x1c9>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2bf0(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1100 <open@plt>
mov    %eax,-0x38(%rbp)
jmp    1428 <mycp_do_copy+0x1f8>
mov    0x2b78(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x2bc3(%rip),%rax
mov    (%rax),%edx
mov    0x2b82(%rip),%rax
mov    (%rax),%ecx
call   1090 <openat@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1491 <mycp_do_copy+0x261>
cmpl   $0x0,-0x24(%rbp)
je     1480 <mycp_do_copy+0x250>
mov    0x2b6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xb9b(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2b32(%rip),%rax
mov    %ecx,(%rax)
mov    0x2b21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,-0x24(%rbp)
je     1792 <mycp_do_copy+0x562>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x2acf(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1070 <faccessat@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1698 <mycp_do_copy+0x468>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x2adf(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1070 <faccessat@plt>
cmp    $0x0,%rax
je     1559 <mycp_do_copy+0x329>
mov    0x2aad(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xb00(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2a6a(%rip),%rax
mov    %ecx,(%rax)
mov    0x2a59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x88(%rbp),%rdx
xor    %ecx,%ecx
call   1150 <fstatat@plt>
cmp    $0x0,%eax
je     15dc <mycp_do_copy+0x3ac>
mov    0x2a2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xa9d(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x29e7(%rip),%rax
mov    %ecx,(%rax)
mov    0x29d6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x18(%rbp)
je     15ff <mycp_do_copy+0x3cf>
mov    -0x78(%rbp),%rcx
xor    %eax,%eax
cmp    -0x88(%rbp),%rcx
mov    %al,-0x89(%rbp)
jle    160e <mycp_do_copy+0x3de>
cmpl   $0x0,0x28(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,0x30(%rbp)
je     1693 <mycp_do_copy+0x463>
cmpl   $0x0,-0x54(%rbp)
je     1693 <mycp_do_copy+0x463>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xa0f(%rip),%rdi
lea    0xa6b(%rip),%rsi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x2974(%rip),%rax
mov    (%rax),%edi
call   1140 <getc@plt>
mov    %eax,-0x4c(%rbp)
mov    $0x1,%al
cmpl   $0x79,-0x4c(%rbp)
mov    %al,-0x8a(%rbp)
je     1685 <mycp_do_copy+0x455>
cmpl   $0x59,-0x4c(%rbp)
sete   %al
mov    %al,-0x8a(%rbp)
mov    -0x8a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
jmp    1698 <mycp_do_copy+0x468>
cmpl   $0x0,-0x54(%rbp)
je     178d <mycp_do_copy+0x55d>
mov    -0x70(%rbp),%edi
call   1050 <S_ISLNK@plt>
cmp    $0x0,%rax
jne    178d <mycp_do_copy+0x55d>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x292e(%rip),%rax
mov    (%rax),%edx
mov    0x28b5(%rip),%rax
or     (%rax),%edx
mov    0x2914(%rip),%rax
or     (%rax),%edx
mov    -0x70(%rbp),%ecx
call   1090 <openat@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0xffffffff,-0x40(%rbp)
jne    1754 <mycp_do_copy+0x524>
mov    0x28b6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rdx
mov    (%rax,%rdx,8),%r8
lea    0x94e(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x286f(%rip),%rax
mov    %ecx,(%rax)
mov    0x285e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1788 <mycp_do_copy+0x558>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x905(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    178d <mycp_do_copy+0x55d>
jmp    1a15 <mycp_do_copy+0x7e5>
mov    -0x20(%rbp),%rdi
mov    0x27e3(%rip),%rax
mov    (%rax),%esi
call   1110 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1944 <mycp_do_copy+0x714>
mov    -0x20(%rbp),%rdi
mov    0x2800(%rip),%rax
mov    (%rax),%esi
call   1110 <access@plt>
cmp    $0x0,%rax
je     182e <mycp_do_copy+0x5fe>
mov    0x27d0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x823(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2795(%rip),%rax
mov    %ecx,(%rax)
mov    0x2784(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
mov    -0x20(%rbp),%rdi
lea    -0x88(%rbp),%rsi
call   10f0 <stat@plt>
cmp    $0x0,%eax
je     1894 <mycp_do_copy+0x664>
mov    0x2762(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0x7dd(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x272f(%rip),%rax
mov    %ecx,(%rax)
mov    0x271e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x18(%rbp)
je     18b7 <mycp_do_copy+0x687>
mov    -0x78(%rbp),%rcx
xor    %eax,%eax
cmp    -0x88(%rbp),%rcx
mov    %al,-0x8b(%rbp)
jle    18c6 <mycp_do_copy+0x696>
cmpl   $0x0,0x28(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x8b(%rbp)
mov    -0x8b(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,0x30(%rbp)
je     193f <mycp_do_copy+0x70f>
cmpl   $0x0,-0x54(%rbp)
je     193f <mycp_do_copy+0x70f>
mov    -0x20(%rbp),%rdx
lea    0x7a4(%rip),%rdi
lea    0x7bf(%rip),%rsi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x26c8(%rip),%rax
mov    (%rax),%edi
call   1140 <getc@plt>
mov    %eax,-0x4c(%rbp)
mov    $0x1,%al
cmpl   $0x79,-0x4c(%rbp)
mov    %al,-0x8c(%rbp)
je     1931 <mycp_do_copy+0x701>
cmpl   $0x59,-0x4c(%rbp)
sete   %al
mov    %al,-0x8c(%rbp)
mov    -0x8c(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
jmp    1944 <mycp_do_copy+0x714>
cmpl   $0x0,-0x54(%rbp)
je     1a10 <mycp_do_copy+0x7e0>
mov    -0x70(%rbp),%edi
call   1050 <S_ISLNK@plt>
cmp    $0x0,%rax
jne    1a10 <mycp_do_copy+0x7e0>
mov    -0x20(%rbp),%rdi
mov    0x268d(%rip),%rax
mov    (%rax),%esi
mov    0x2614(%rip),%rax
or     (%rax),%esi
mov    0x2673(%rip),%rax
or     (%rax),%esi
mov    -0x70(%rbp),%edx
mov    $0x0,%al
call   1100 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0xffffffff,-0x40(%rbp)
jne    19e3 <mycp_do_copy+0x7b3>
mov    0x2613(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0x649(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x25e0(%rip),%rax
mov    %ecx,(%rax)
mov    0x25cf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1a0b <mycp_do_copy+0x7db>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
lea    0x6a8(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1a10 <mycp_do_copy+0x7e0>
jmp    1a15 <mycp_do_copy+0x7e5>
cmpl   $0x0,-0x54(%rbp)
je     1ab5 <mycp_do_copy+0x885>
mov    -0x70(%rbp),%edi
call   1050 <S_ISLNK@plt>
cmp    $0x0,%rax
jne    1ab5 <mycp_do_copy+0x885>
mov    -0x38(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1120 <mycp_copy@plt>
cmp    $0x0,%rax
je     1aad <mycp_do_copy+0x87d>
mov    0x2563(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0x653(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x40(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1a90 <mycp_do_copy+0x860>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2516(%rip),%rax
mov    %ecx,(%rax)
mov    0x2505(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
mov    -0x40(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x54(%rbp)
je     1ee5 <mycp_do_copy+0xcb5>
mov    -0x70(%rbp),%edi
call   1050 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1ee5 <mycp_do_copy+0xcb5>
mov    -0x58(%rbp),%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1b30 <mycp_do_copy+0x900>
mov    0x24bc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1b13 <mycp_do_copy+0x8e3>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2493(%rip),%rax
mov    %ecx,(%rax)
mov    0x2482(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x58(%rbp),%edx
call   1080 <readlink@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
jne    1bc5 <mycp_do_copy+0x995>
mov    0x2454(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x54d(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1ba8 <mycp_do_copy+0x978>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x23fe(%rip),%rax
mov    %ecx,(%rax)
mov    0x23ed(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
mov    -0x68(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0x50(%rbp)
je     1d4f <mycp_do_copy+0xb1f>
cmpl   $0x0,-0x24(%rbp)
je     1ca6 <mycp_do_copy+0xa76>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
xor    %edx,%edx
call   1060 <unlinkat@plt>
cmp    $0x0,%rax
je     1c79 <mycp_do_copy+0xa49>
mov    0x23a4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rdx
mov    (%rax,%rdx,8),%r8
lea    0x4b1(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1c5c <mycp_do_copy+0xa2c>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x234a(%rip),%rax
mov    %ecx,(%rax)
mov    0x2339(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1ca1 <mycp_do_copy+0xa71>
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0x462(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1d4a <mycp_do_copy+0xb1a>
mov    -0x20(%rbp),%rdi
call   1040 <unlink@plt>
cmp    $0x0,%rax
je     1d29 <mycp_do_copy+0xaf9>
mov    0x22f0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x42b(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1d0c <mycp_do_copy+0xadc>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x229a(%rip),%rax
mov    %ecx,(%rax)
mov    0x2289(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1d45 <mycp_do_copy+0xb15>
mov    -0x20(%rbp),%rsi
lea    0x3e5(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1d4a <mycp_do_copy+0xb1a>
jmp    1d4f <mycp_do_copy+0xb1f>
cmpl   $0x0,-0x24(%rbp)
je     1e28 <mycp_do_copy+0xbf8>
mov    -0x68(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1130 <symlinkat@plt>
cmp    $0x0,%rax
je     1def <mycp_do_copy+0xbbf>
mov    0x222e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rdx
mov    (%rax,%rdx,8),%r8
lea    0x389(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1dd2 <mycp_do_copy+0xba2>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x21d4(%rip),%rax
mov    %ecx,(%rax)
mov    0x21c3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1e23 <mycp_do_copy+0xbf3>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x26a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1edc <mycp_do_copy+0xcac>
mov    -0x68(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <symlink@plt>
cmp    $0x0,%rax
je     1eaf <mycp_do_copy+0xc7f>
mov    0x216a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x2a5(%rip),%rdx
mov    $0x0,%al
call   10c0 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
cmpl   $0x0,-0x24(%rbp)
je     1e92 <mycp_do_copy+0xc62>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    -0x48(%rbp),%ecx
mov    0x2114(%rip),%rax
mov    %ecx,(%rax)
mov    0x2103(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1f19 <mycp_do_copy+0xce9>
cmpl   $0x0,0x10(%rbp)
je     1ed7 <mycp_do_copy+0xca7>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
lea    0x1dc(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1edc <mycp_do_copy+0xcac>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%edi
call   10d0 <close@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12f3 <mycp_do_copy+0xc3>
cmpl   $0x0,-0x24(%rbp)
je     1f0d <mycp_do_copy+0xcdd>
mov    -0x3c(%rbp),%edi
call   10d0 <close@plt>
mov    0x2084(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mycp_do_copy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9d,%r15d
mov    %r8,%rbp
mov    %esi,%ebx
mov    %rdi,%r14
mov    %ecx,0x14(%rsp)
test   %ecx,%ecx
mov    %rdx,0x18(%rsp)
je     12a6 <mycp_do_copy+0x76>
mov    0x2d7b(%rip),%rax
mov    0x2d54(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rdx,%rdi
xor    %eax,%eax
call   1100 <open@plt>
mov    %eax,%r13d
cmp    $0xffffffff,%eax
jne    12a6 <mycp_do_copy+0x76>
mov    0x2d2f(%rip),%r14
mov    (%r14),%ebx
mov    0x0(%rbp),%rdi
lea    0xd71(%rip),%rdx
mov    %r15d,%esi
mov    0x18(%rsp),%rcx
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %ebx,(%r14)
jmp    1b6b <mycp_do_copy+0x93b>
mov    %rbp,0x20(%rsp)
mov    %r15d,0xc(%rsp)
test   %ebx,%ebx
mov    0x18(%rsp),%rbp
jle    1855 <mycp_do_copy+0x625>
xor    %eax,%eax
cmpl   $0x0,0xa8(%rsp)
sete   %al
cmpl   $0x0,0xb0(%rsp)
setne  %cl
mov    %eax,0x2c(%rsp)
and    %al,%cl
mov    %cl,0x12(%rsp)
mov    %ebx,%eax
mov    %rax,0x40(%rsp)
mov    $0x1,%r12d
xor    %r15d,%r15d
jmp    1319 <mycp_do_copy+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %r12d,%r12d
mov    %ebx,%edi
call   10d0 <close@plt>
add    $0x1,%r15
cmp    %r15,0x40(%rsp)
je     1855 <mycp_do_copy+0x625>
cmpl   $0x0,0xa0(%rsp)
je     1360 <mycp_do_copy+0x130>
mov    (%r14,%r15,8),%rdi
lea    0x30(%rsp),%rsi
call   10f0 <stat@plt>
test   %eax,%eax
jne    1874 <mycp_do_copy+0x644>
mov    0x38(%rsp),%edi
call   1050 <S_ISLNK@plt>
test   %rax,%rax
je     1388 <mycp_do_copy+0x158>
mov    (%r14,%r15,8),%rdi
mov    0x2c86(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1100 <open@plt>
jmp    13ac <mycp_do_copy+0x17c>
nopl   (%rax)
mov    0x2c11(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%r15,8),%rsi
mov    0x2c2c(%rip),%rax
mov    (%rax),%ecx
lea    0x30(%rsp),%rdx
call   1150 <fstatat@plt>
test   %eax,%eax
jne    1874 <mycp_do_copy+0x644>
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%r15,8),%rsi
mov    0x2c3c(%rip),%rax
mov    (%rax),%edx
mov    0x2bfb(%rip),%rax
mov    (%rax),%ecx
call   1090 <openat@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     18b1 <mycp_do_copy+0x681>
cmpl   $0x0,0x14(%rsp)
je     1470 <mycp_do_copy+0x240>
mov    (%r14,%r15,8),%rsi
mov    0x2bb3(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
xor    %ecx,%ecx
call   1070 <faccessat@plt>
test   %rax,%rax
sete   0x13(%rsp)
je     1510 <mycp_do_copy+0x2e0>
test   %r12d,%r12d
je     1300 <mycp_do_copy+0xd0>
mov    0x38(%rsp),%edi
call   1050 <S_ISLNK@plt>
test   %rax,%rax
jne    1650 <mycp_do_copy+0x420>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edx
mov    0x2be6(%rip),%rax
or     (%rax),%edx
mov    (%r14,%r15,8),%rsi
mov    0x2bd1(%rip),%rax
or     (%rax),%edx
mov    0x38(%rsp),%ecx
mov    %r13d,%edi
call   1090 <openat@plt>
cmp    $0xffffffff,%eax
je     1aa5 <mycp_do_copy+0x875>
cmpl   $0x0,0x90(%rsp)
mov    %eax,0x28(%rsp)
je     1648 <mycp_do_copy+0x418>
mov    (%r14,%r15,8),%rcx
lea    0xc33(%rip),%rdi
mov    %rcx,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1650 <mycp_do_copy+0x420>
nopw   0x0(%rax,%rax,1)
mov    0x2b09(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1110 <access@plt>
test   %rax,%rax
sete   0x13(%rsp)
je     15b4 <mycp_do_copy+0x384>
test   %r12d,%r12d
je     1300 <mycp_do_copy+0xd0>
mov    0x38(%rsp),%edi
call   1050 <S_ISLNK@plt>
test   %rax,%rax
jne    1650 <mycp_do_copy+0x420>
mov    0x2ad7(%rip),%rax
mov    (%rax),%esi
mov    0x2b3e(%rip),%rax
or     (%rax),%esi
mov    0x2b2d(%rip),%rax
or     (%rax),%esi
mov    0x38(%rsp),%edx
mov    %rbp,%rdi
xor    %eax,%eax
call   1100 <open@plt>
cmp    $0xffffffff,%eax
je     1b3a <mycp_do_copy+0x90a>
cmpl   $0x0,0x90(%rsp)
mov    %eax,0x28(%rsp)
je     1650 <mycp_do_copy+0x420>
mov    (%r14,%r15,8),%rsi
lea    0xbb3(%rip),%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1650 <mycp_do_copy+0x420>
nopl   0x0(%rax,%rax,1)
mov    (%r14,%r15,8),%rsi
mov    0x2aad(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
xor    %ecx,%ecx
call   1070 <faccessat@plt>
test   %rax,%rax
jne    1967 <mycp_do_copy+0x737>
mov    (%r14,%r15,8),%rsi
mov    %r13d,%edi
lea    0x48(%rsp),%rdx
xor    %ecx,%ecx
call   1150 <fstatat@plt>
test   %eax,%eax
jne    1987 <mycp_do_copy+0x757>
cmpl   $0x0,0x98(%rsp)
je     1568 <mycp_do_copy+0x338>
mov    0x30(%rsp),%rax
xor    %r12d,%r12d
cmp    0x48(%rsp),%rax
jle    1303 <mycp_do_copy+0xd3>
mov    0x2c(%rsp),%r12d
cmpb   $0x0,0x12(%rsp)
je     13e7 <mycp_do_copy+0x1b7>
mov    (%r14,%r15,8),%rcx
lea    0xad3(%rip),%rdi
lea    0xb2f(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2a35(%rip),%rax
mov    (%rax),%edi
call   1140 <getc@plt>
and    $0xffffffdf,%eax
xor    %r12d,%r12d
cmp    $0x59,%eax
sete   %r12b
jmp    13e7 <mycp_do_copy+0x1b7>
mov    0x2a0d(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1110 <access@plt>
test   %rax,%rax
jne    1a57 <mycp_do_copy+0x827>
mov    %rbp,%rdi
lea    0x48(%rsp),%rsi
call   10f0 <stat@plt>
test   %eax,%eax
jne    1a84 <mycp_do_copy+0x854>
cmpl   $0x0,0x98(%rsp)
je     1600 <mycp_do_copy+0x3d0>
mov    0x30(%rsp),%rax
xor    %r12d,%r12d
cmp    0x48(%rsp),%rax
jle    1303 <mycp_do_copy+0xd3>
mov    0x2c(%rsp),%r12d
cmpb   $0x0,0x12(%rsp)
je     148f <mycp_do_copy+0x25f>
lea    0xa80(%rip),%rdi
lea    0xa9b(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x29a1(%rip),%rax
mov    (%rax),%edi
call   1140 <getc@plt>
and    $0xffffffdf,%eax
xor    %r12d,%r12d
cmp    $0x59,%eax
sete   %r12b
jmp    148f <mycp_do_copy+0x25f>
mov    0x18(%rsp),%rbp
nopl   (%rax)
mov    0x38(%rsp),%edi
call   1050 <S_ISLNK@plt>
test   %rax,%rax
jne    1681 <mycp_do_copy+0x451>
mov    %ebx,%r12d
mov    %ebx,%edi
mov    0x28(%rsp),%ebx
mov    %ebx,%esi
call   1120 <mycp_copy@plt>
test   %rax,%rax
jne    19b5 <mycp_do_copy+0x785>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    %r12d,%ebx
mov    0x38(%rsp),%edi
call   1050 <S_ISLNK@plt>
mov    $0x1,%r12d
test   %rax,%rax
je     1303 <mycp_do_copy+0xd3>
mov    %r13d,%ebp
mov    $0x400,%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
test   %rax,%rax
je     18fd <mycp_do_copy+0x6cd>
mov    %rax,%r13
mov    (%r14,%r15,8),%rdi
mov    %rax,%rsi
mov    $0x400,%edx
call   1080 <readlink@plt>
cmp    $0xffffffff,%eax
je     1920 <mycp_do_copy+0x6f0>
cltq
movb   $0x0,0x0(%r13,%rax,1)
cmpb   $0x0,0x13(%rsp)
je     173e <mycp_do_copy+0x50e>
cmpl   $0x0,0x14(%rsp)
je     178d <mycp_do_copy+0x55d>
mov    (%r14,%r15,8),%rsi
mov    %ebp,%edi
xor    %edx,%edx
call   1060 <unlinkat@plt>
test   %rax,%rax
jne    1aeb <mycp_do_copy+0x8bb>
mov    (%r14,%r15,8),%rdx
cmpl   $0x0,0x90(%rsp)
je     180d <mycp_do_copy+0x5dd>
lea    0x9e2(%rip),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%r14,%r15,8),%rdx
mov    %r13,%rdi
mov    %ebp,%esi
call   1130 <symlinkat@plt>
test   %rax,%rax
je     176e <mycp_do_copy+0x53e>
jmp    1a02 <mycp_do_copy+0x7d2>
cmpl   $0x0,0x14(%rsp)
je     17d4 <mycp_do_copy+0x5a4>
mov    (%r14,%r15,8),%rdx
mov    %r13,%rdi
mov    %ebp,%esi
call   1130 <symlinkat@plt>
test   %rax,%rax
jne    1a02 <mycp_do_copy+0x7d2>
cmpl   $0x0,0x90(%rsp)
je     1840 <mycp_do_copy+0x610>
mov    (%r14,%r15,8),%rcx
lea    0x90d(%rip),%rdi
mov    %rcx,%rsi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1840 <mycp_do_copy+0x610>
mov    0x18(%rsp),%rdi
call   1040 <unlink@plt>
test   %rax,%rax
jne    1a24 <mycp_do_copy+0x7f4>
cmpl   $0x0,0x90(%rsp)
je     1821 <mycp_do_copy+0x5f1>
lea    0x972(%rip),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r13,%rdi
mov    0x18(%rsp),%rsi
call   10b0 <symlink@plt>
test   %rax,%rax
je     17f4 <mycp_do_copy+0x5c4>
jmp    1a24 <mycp_do_copy+0x7f4>
mov    %r13,%rdi
mov    0x18(%rsp),%rsi
call   10b0 <symlink@plt>
test   %rax,%rax
jne    1a24 <mycp_do_copy+0x7f4>
cmpl   $0x0,0x90(%rsp)
je     1840 <mycp_do_copy+0x610>
mov    (%r14,%r15,8),%rsi
lea    0x8ad(%rip),%rdi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1840 <mycp_do_copy+0x610>
mov    %r13,%rdi
mov    %ebp,%esi
call   1130 <symlinkat@plt>
test   %rax,%rax
je     1840 <mycp_do_copy+0x610>
jmp    1a02 <mycp_do_copy+0x7d2>
mov    %r13,%rdi
mov    0x18(%rsp),%rsi
call   10b0 <symlink@plt>
test   %rax,%rax
jne    1a24 <mycp_do_copy+0x7f4>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <free@plt>
mov    %ebp,%r13d
mov    0x18(%rsp),%rbp
jmp    1303 <mycp_do_copy+0xd3>
mov    0x273c(%rip),%rbx
cmpl   $0x0,0x14(%rsp)
je     1b72 <mycp_do_copy+0x942>
mov    %r13d,%edi
call   10d0 <close@plt>
jmp    1b72 <mycp_do_copy+0x942>
mov    0x2735(%rip),%rbx
mov    (%rbx),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x784(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
cmpl   $0x0,0x14(%rsp)
je     18aa <mycp_do_copy+0x67a>
mov    %r13d,%edi
call   10d0 <close@plt>
mov    %ebp,(%rbx)
jmp    1b6b <mycp_do_copy+0x93b>
mov    0x26f0(%rip),%rbx
cmpl   $0x0,0x14(%rsp)
je     1b72 <mycp_do_copy+0x942>
mov    0x26e6(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x71f(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %r13d,%edi
call   10d0 <close@plt>
mov    %ebp,(%r12)
jmp    1b72 <mycp_do_copy+0x942>
mov    0x26ac(%rip),%r14
mov    (%r14),%r15d
mov    %ebx,%edi
call   10d0 <close@plt>
cmpl   $0x0,0x14(%rsp)
je     19fa <mycp_do_copy+0x7ca>
mov    %ebp,%edi
jmp    19f5 <mycp_do_copy+0x7c5>
mov    0x2689(%rip),%rax
mov    (%rax),%r12d
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x78e(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
cmpl   $0x0,0x14(%rsp)
jne    1b27 <mycp_do_copy+0x8f7>
jmp    1b2e <mycp_do_copy+0x8fe>
mov    0x2642(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x6a0(%rip),%rdx
jmp    19a5 <mycp_do_copy+0x775>
mov    0x2622(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x6a0(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
jmp    1ad3 <mycp_do_copy+0x8a3>
mov    0x25f4(%rip),%r14
mov    (%r14),%r15d
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
lea    0x6ec(%rip),%rdx
mov    0xc(%rsp),%esi
mov    %rbp,%rcx
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %r12d,%edi
call   10d0 <close@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
cmpl   $0x0,0x14(%rsp)
je     19fa <mycp_do_copy+0x7ca>
mov    %r13d,%edi
call   10d0 <close@plt>
mov    %r15d,(%r14)
jmp    1b6b <mycp_do_copy+0x93b>
mov    0x25a7(%rip),%rax
mov    (%rax),%r12d
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%r8
lea    0x712(%rip),%rdx
jmp    1b08 <mycp_do_copy+0x8d8>
mov    0x2585(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x6cb(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    1a80 <mycp_do_copy+0x850>
mov    0x2552(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%rcx
lea    0x5b0(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %ebx,%edi
jmp    1add <mycp_do_copy+0x8ad>
mov    0x2525(%rip),%r14
mov    %rbp,%rcx
mov    (%r14),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
lea    0x5a5(%rip),%rdx
jmp    1b56 <mycp_do_copy+0x926>
mov    0x2504(%rip),%r12
mov    (%r12),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%r8
lea    0x5ab(%rip),%rdx
mov    0xc(%rsp),%esi
mov    0x18(%rsp),%rcx
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    %r13d,%edi
call   10d0 <close@plt>
mov    %ebp,(%r12)
jmp    1b6b <mycp_do_copy+0x93b>
mov    0x24be(%rip),%rax
mov    (%rax),%r12d
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
mov    (%r14,%r15,8),%r8
lea    0x5db(%rip),%rdx
mov    0xc(%rsp),%esi
mov    0x18(%rsp),%rcx
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    %ebp,%edi
call   10d0 <close@plt>
mov    0x247b(%rip),%rax
mov    %r12d,(%rax)
jmp    1b6b <mycp_do_copy+0x93b>
mov    0x246f(%rip),%r14
mov    %rbp,%rcx
mov    (%r14),%ebp
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
lea    0x4aa(%rip),%rdx
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   10c0 <snprintf@plt>
mov    %ebx,%edi
call   10d0 <close@plt>
mov    %ebp,(%r14)
mov    0x2436(%rip),%rbx
mov    (%rbx),%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64, i32 }
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@errno = global i32 0
@.str = [20 x i8] c"failed to open '%s'\00"
@EXIT_FAILURE = global i32 0
@AT_FDCWD = global i32 0
@AT_SYMLINK_NOFOLLOW = global i32 0
@.str.1 = [17 x i8] c"cannot stat '%s'\00"
@F_OK = global i32 0
@W_OK = global i32 0
@.str.2 = [32 x i8] c"cannot create regular file '%s'\00"
@.str.3 = [17 x i8] c"connot stat '%s'\00"
@.str.4 = [24 x i8] c"%s: overwrite '%s/%s'? \00"
@.str.5 = [1 x i8] zeroinitializer
@stdin = global i32 0
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [24 x i8] c"failed to open '%s/%s':\00"
@.str.7 = [17 x i8] c"'%s' -> '%s/%s'\0A\00"
@.str.8 = [21 x i8] c"%s: overwrite '%s'? \00"
@.str.9 = [14 x i8] c"'%s' -> '%s'\0A\00"
@.str.10 = [17 x i8] c"cannot copy '%s'\00"
@.str.11 = [24 x i8] c"failed access link '%s'\00"
@.str.12 = [25 x i8] c"failed to remove '%s/%s'\00"
@.str.13 = [17 x i8] c"'%s/%s' removed\0A\00"
@.str.14 = [22 x i8] c"failed to remove '%s'\00"
@.str.15 = [14 x i8] c"'%s' removed\0A\00"
@.str.16 = [30 x i8] c"failed to create link '%s/%s'\00"
@EXIT_SUCCESS = global i32 0
define i32 @mycp_do_copy(i8** %0, i32 %1, i8* %2, i32 %3, i8** %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca i32
%13 = alloca i8**
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i8**
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i8*
%35 = alloca %struct.stat
%36 = alloca %struct.stat
store i8** %0, i8*** %13
store i32 %1, i32* %14
store i8* %2, i8** %15
store i32 %3, i32* %16
store i8** %4, i8*** %17
store i32 %5, i32* %18
store i32 %6, i32* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i32 %10, i32* %23
store i32 1, i32* %31
store i32 1024, i32* %32
%37 = load i32, i32* %16
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %57
39: ; preds = %11
%40 = load i8*, i8** %15
%41 = load i32, i32* @O_RDONLY
%42 = load i32, i32* @O_DIRECTORY
%43 = or i32 %41, %42
%44 = call i32 (i8*, i32, ...) @open(i8* %40, i32 %43)
store i32 %44, i32* %25
%45 = load i32, i32* %25
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %56
47: ; preds = %39
%48 = load i32, i32* @errno
store i32 %48, i32* %28
%49 = load i8**, i8*** %17
%50 = load i8*, i8** %49
%51 = load i32, i32* %18
%52 = load i8*, i8** %15
%53 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %50, i32 %51, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %52)
%54 = load i32, i32* %28
store i32 %54, i32* @errno
%55 = load i32, i32* @EXIT_FAILURE
store i32 %55, i32* %12
br label %738
56: ; preds = %39
br label %57
57: ; preds = %56, %11
store i32 0, i32* %27
br label %58
58: ; preds = %727, %57
%59 = load i32, i32* %27
%60 = load i32, i32* %14
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %730
62: ; preds = %58
%63 = load i32, i32* %21
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %72
65: ; preds = %62
%66 = load i8**, i8*** %13
%67 = load i32, i32* %27
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @stat(i8* %70, %struct.stat* %35)
store i32 %71, i32* %28
br label %81
72: ; preds = %62
%73 = load i32, i32* @AT_FDCWD
%74 = load i8**, i8*** %13
%75 = load i32, i32* %27
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8*, i8** %74, i64 %76
%78 = load i8*, i8** %77
%79 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%80 = call i32 @fstatat(i32 %73, i8* %78, %struct.stat* %35, i32 %79)
store i32 %80, i32* %28
br label %81
81: ; preds = %72, %65
%82 = load i32, i32* %28
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %103
84: ; preds = %81
%85 = load i32, i32* @errno
store i32 %85, i32* %28
%86 = load i8**, i8*** %17
%87 = load i8*, i8** %86
%88 = load i32, i32* %18
%89 = load i8**, i8*** %13
%90 = load i32, i32* %27
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8*, i8** %89, i64 %91
%93 = load i8*, i8** %92
%94 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %87, i32 %88, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %93)
%95 = load i32, i32* %16
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %84
%98 = load i32, i32* %25
%99 = call i32 @close(i32 %98)
br label %100
100: ; preds = %97, %84
%101 = load i32, i32* %28
store i32 %101, i32* @errno
%102 = load i32, i32* @EXIT_FAILURE
store i32 %102, i32* %12
br label %738
103: ; preds = %81
%104 = load i32, i32* %21
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %119
106: ; preds = %103
%107 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%108 = load i32, i32* %107
%109 = call i64 @S_ISLNK(i32 %108)
%110 = icmp ne i64 %109, 0
br i1 %110, label %111, label %119
111: ; preds = %106
%112 = load i8**, i8*** %13
%113 = load i32, i32* %27
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8*, i8** %112, i64 %114
%116 = load i8*, i8** %115
%117 = load i32, i32* @O_RDONLY
%118 = call i32 (i8*, i32, ...) @open(i8* %116, i32 %117)
store i32 %118, i32* %24
br label %129
119: ; preds = %106, %103
%120 = load i32, i32* @AT_FDCWD
%121 = load i8**, i8*** %13
%122 = load i32, i32* %27
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8*, i8** %121, i64 %123
%125 = load i8*, i8** %124
%126 = load i32, i32* @O_RDONLY
%127 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%128 = call i32 @openat(i32 %120, i8* %125, i32 %126, i32 %127)
store i32 %128, i32* %24
br label %129
129: ; preds = %119, %111
%130 = load i32, i32* %24
%131 = icmp eq i32 %130, -1
br i1 %131, label %132, label %151
132: ; preds = %129
%133 = load i32, i32* %16
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %149
135: ; preds = %132
%136 = load i32, i32* @errno
store i32 %136, i32* %28
%137 = load i8**, i8*** %17
%138 = load i8*, i8** %137
%139 = load i32, i32* %18
%140 = load i8**, i8*** %13
%141 = load i32, i32* %27
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8*, i8** %140, i64 %142
%144 = load i8*, i8** %143
%145 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %138, i32 %139, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %144)
%146 = load i32, i32* %25
%147 = call i32 @close(i32 %146)
%148 = load i32, i32* %28
store i32 %148, i32* @errno
br label %149
149: ; preds = %135, %132
%150 = load i32, i32* @EXIT_FAILURE
store i32 %150, i32* %12
br label %738
151: ; preds = %129
%152 = load i32, i32* %16
%153 = icmp ne i32 %152, 0
br i1 %153, label %154, label %321
154: ; preds = %151
%155 = load i32, i32* %25
%156 = load i8**, i8*** %13
%157 = load i32, i32* %27
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8*, i8** %156, i64 %158
%160 = load i8*, i8** %159
%161 = load i32, i32* @F_OK
%162 = call i64 @faccessat(i32 %155, i8* %160, i32 %161, i32 0)
%163 = icmp eq i64 %162, 0
%164 = zext i1 %163 to i32
store i32 %164, i32* %30
%165 = load i32, i32* %30
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %260
167: ; preds = %154
%168 = load i32, i32* %25
%169 = load i8**, i8*** %13
%170 = load i32, i32* %27
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8*, i8** %169, i64 %171
%173 = load i8*, i8** %172
%174 = load i32, i32* @W_OK
%175 = call i64 @faccessat(i32 %168, i8* %173, i32 %174, i32 0)
%176 = icmp ne i64 %175, 0
br i1 %176, label %177, label %194
177: ; preds = %167
%178 = load i32, i32* @errno
store i32 %178, i32* %28
%179 = load i8**, i8*** %17
%180 = load i8*, i8** %179
%181 = load i32, i32* %18
%182 = load i8**, i8*** %13
%183 = load i32, i32* %27
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i8*, i8** %182, i64 %184
%186 = load i8*, i8** %185
%187 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %180, i32 %181, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %186)
%188 = load i32, i32* %24
%189 = call i32 @close(i32 %188)
%190 = load i32, i32* %25
%191 = call i32 @close(i32 %190)
%192 = load i32, i32* %28
store i32 %192, i32* @errno
%193 = load i32, i32* @EXIT_FAILURE
store i32 %193, i32* %12
br label %738
194: ; preds = %167
%195 = load i32, i32* %25
%196 = load i8**, i8*** %13
%197 = load i32, i32* %27
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i8*, i8** %196, i64 %198
%200 = load i8*, i8** %199
%201 = call i32 @fstatat(i32 %195, i8* %200, %struct.stat* %36, i32 0)
%202 = icmp ne i32 %201, 0
br i1 %202, label %203, label %220
203: ; preds = %194
%204 = load i32, i32* @errno
store i32 %204, i32* %28
%205 = load i8**, i8*** %17
%206 = load i8*, i8** %205
%207 = load i32, i32* %18
%208 = load i8**, i8*** %13
%209 = load i32, i32* %27
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8*, i8** %208, i64 %210
%212 = load i8*, i8** %211
%213 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %206, i32 %207, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %212)
%214 = load i32, i32* %24
%215 = call i32 @close(i32 %214)
%216 = load i32, i32* %25
%217 = call i32 @close(i32 %216)
%218 = load i32, i32* %28
store i32 %218, i32* @errno
%219 = load i32, i32* @EXIT_FAILURE
store i32 %219, i32* %12
br label %738
220: ; preds = %194
%221 = load i32, i32* %20
%222 = icmp ne i32 %221, 0
br i1 %222, label %223, label %229
223: ; preds = %220
%224 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 0
%225 = load i64, i64* %224
%226 = getelementptr inbounds %struct.stat, %struct.stat* %36, i32 0, i32 0
%227 = load i64, i64* %226
%228 = icmp sgt i64 %225, %227
br i1 %228, label %229, label %233
229: ; preds = %223, %220
%230 = load i32, i32* %22
%231 = icmp ne i32 %230, 0
%232 = xor i1 %231, true
br label %233
233: ; preds = %229, %223
%234 = phi i1 [ false, %223 ], [ %232, %229 ]
%235 = zext i1 %234 to i32
store i32 %235, i32* %31
%236 = load i32, i32* %23
%237 = icmp ne i32 %236, 0
br i1 %237, label %238, label %259
238: ; preds = %233
%239 = load i32, i32* %31
%240 = icmp ne i32 %239, 0
br i1 %240, label %241, label %259
241: ; preds = %238
%242 = load i8*, i8** %15
%243 = load i8**, i8*** %13
%244 = load i32, i32* %27
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i8*, i8** %243, i64 %245
%247 = load i8*, i8** %246
%248 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %242, i8* %247)
%249 = load i32, i32* @stdin
%250 = call i32 @getc(i32 %249)
store i32 %250, i32* %29
%251 = load i32, i32* %29
%252 = icmp eq i32 %251, 121
br i1 %252, label %256, label %253
253: ; preds = %241
%254 = load i32, i32* %29
%255 = icmp eq i32 %254, 89
br label %256
256: ; preds = %253, %241
%257 = phi i1 [ true, %241 ], [ %255, %253 ]
%258 = zext i1 %257 to i32
store i32 %258, i32* %31
br label %259
259: ; preds = %256, %238, %233
br label %260
260: ; preds = %259, %154
%261 = load i32, i32* %31
%262 = icmp ne i32 %261, 0
br i1 %262, label %263, label %320
263: ; preds = %260
%264 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%265 = load i32, i32* %264
%266 = call i64 @S_ISLNK(i32 %265)
%267 = icmp ne i64 %266, 0
br i1 %267, label %320, label %268
268: ; preds = %263
%269 = load i32, i32* %25
%270 = load i8**, i8*** %13
%271 = load i32, i32* %27
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i8*, i8** %270, i64 %272
%274 = load i8*, i8** %273
%275 = load i32, i32* @O_CREAT
%276 = load i32, i32* @O_WRONLY
%277 = or i32 %275, %276
%278 = load i32, i32* @O_TRUNC
%279 = or i32 %277, %278
%280 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%281 = load i32, i32* %280
%282 = call i32 @openat(i32 %269, i8* %274, i32 %279, i32 %281)
store i32 %282, i32* %26
%283 = load i32, i32* %26
%284 = icmp eq i32 %283, -1
br i1 %284, label %285, label %303
285: ; preds = %268
%286 = load i32, i32* @errno
store i32 %286, i32* %28
%287 = load i8**, i8*** %17
%288 = load i8*, i8** %287
%289 = load i32, i32* %18
%290 = load i8*, i8** %15
%291 = load i8**, i8*** %13
%292 = load i32, i32* %27
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds i8*, i8** %291, i64 %293
%295 = load i8*, i8** %294
%296 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %288, i32 %289, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* %290, i8* %295)
%297 = load i32, i32* %24
%298 = call i32 @close(i32 %297)
%299 = load i32, i32* %25
%300 = call i32 @close(i32 %299)
%301 = load i32, i32* %28
store i32 %301, i32* @errno
%302 = load i32, i32* @EXIT_FAILURE
store i32 %302, i32* %12
br label %738
303: ; preds = %268
%304 = load i32, i32* %19
%305 = icmp ne i32 %304, 0
br i1 %305, label %306, label %319
306: ; preds = %303
%307 = load i8**, i8*** %13
%308 = load i32, i32* %27
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds i8*, i8** %307, i64 %309
%311 = load i8*, i8** %310
%312 = load i8*, i8** %15
%313 = load i8**, i8*** %13
%314 = load i32, i32* %27
%315 = sext i32 %314 to i64
%316 = getelementptr inbounds i8*, i8** %313, i64 %315
%317 = load i8*, i8** %316
%318 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %311, i8* %312, i8* %317)
br label %319
319: ; preds = %306, %303
br label %320
320: ; preds = %319, %263, %260
br label %443
321: ; preds = %151
%322 = load i8*, i8** %15
%323 = load i32, i32* @F_OK
%324 = call i64 @access(i8* %322, i32 %323)
%325 = icmp eq i64 %324, 0
%326 = zext i1 %325 to i32
store i32 %326, i32* %30
%327 = load i32, i32* %30
%328 = icmp ne i32 %327, 0
br i1 %328, label %329, label %399
329: ; preds = %321
%330 = load i8*, i8** %15
%331 = load i32, i32* @W_OK
%332 = call i64 @access(i8* %330, i32 %331)
%333 = icmp ne i64 %332, 0
br i1 %333, label %334, label %349
334: ; preds = %329
%335 = load i32, i32* @errno
store i32 %335, i32* %28
%336 = load i8**, i8*** %17
%337 = load i8*, i8** %336
%338 = load i32, i32* %18
%339 = load i8**, i8*** %13
%340 = load i32, i32* %27
%341 = sext i32 %340 to i64
%342 = getelementptr inbounds i8*, i8** %339, i64 %341
%343 = load i8*, i8** %342
%344 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %337, i32 %338, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %343)
%345 = load i32, i32* %24
%346 = call i32 @close(i32 %345)
%347 = load i32, i32* %28
store i32 %347, i32* @errno
%348 = load i32, i32* @EXIT_FAILURE
store i32 %348, i32* %12
br label %738
349: ; preds = %329
%350 = load i8*, i8** %15
%351 = call i32 @stat(i8* %350, %struct.stat* %36)
%352 = icmp ne i32 %351, 0
br i1 %352, label %353, label %364
353: ; preds = %349
%354 = load i32, i32* @errno
store i32 %354, i32* %28
%355 = load i8**, i8*** %17
%356 = load i8*, i8** %355
%357 = load i32, i32* %18
%358 = load i8*, i8** %15
%359 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %356, i32 %357, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %358)
%360 = load i32, i32* %24
%361 = call i32 @close(i32 %360)
%362 = load i32, i32* %28
store i32 %362, i32* @errno
%363 = load i32, i32* @EXIT_FAILURE
store i32 %363, i32* %12
br label %738
364: ; preds = %349
%365 = load i32, i32* %20
%366 = icmp ne i32 %365, 0
br i1 %366, label %367, label %373
367: ; preds = %364
%368 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 0
%369 = load i64, i64* %368
%370 = getelementptr inbounds %struct.stat, %struct.stat* %36, i32 0, i32 0
%371 = load i64, i64* %370
%372 = icmp sgt i64 %369, %371
br i1 %372, label %373, label %377
373: ; preds = %367, %364
%374 = load i32, i32* %22
%375 = icmp ne i32 %374, 0
%376 = xor i1 %375, true
br label %377
377: ; preds = %373, %367
%378 = phi i1 [ false, %367 ], [ %376, %373 ]
%379 = zext i1 %378 to i32
store i32 %379, i32* %31
%380 = load i32, i32* %23
%381 = icmp ne i32 %380, 0
br i1 %381, label %382, label %398
382: ; preds = %377
%383 = load i32, i32* %31
%384 = icmp ne i32 %383, 0
br i1 %384, label %385, label %398
385: ; preds = %382
%386 = load i8*, i8** %15
%387 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %386)
%388 = load i32, i32* @stdin
%389 = call i32 @getc(i32 %388)
store i32 %389, i32* %29
%390 = load i32, i32* %29
%391 = icmp eq i32 %390, 121
br i1 %391, label %395, label %392
392: ; preds = %385
%393 = load i32, i32* %29
%394 = icmp eq i32 %393, 89
br label %395
395: ; preds = %392, %385
%396 = phi i1 [ true, %385 ], [ %394, %392 ]
%397 = zext i1 %396 to i32
store i32 %397, i32* %31
br label %398
398: ; preds = %395, %382, %377
br label %399
399: ; preds = %398, %321
%400 = load i32, i32* %31
%401 = icmp ne i32 %400, 0
br i1 %401, label %402, label %442
402: ; preds = %399
%403 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%404 = load i32, i32* %403
%405 = call i64 @S_ISLNK(i32 %404)
%406 = icmp ne i64 %405, 0
br i1 %406, label %442, label %407
407: ; preds = %402
%408 = load i8*, i8** %15
%409 = load i32, i32* @O_CREAT
%410 = load i32, i32* @O_WRONLY
%411 = or i32 %409, %410
%412 = load i32, i32* @O_TRUNC
%413 = or i32 %411, %412
%414 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%415 = load i32, i32* %414
%416 = call i32 (i8*, i32, ...) @open(i8* %408, i32 %413, i32 %415)
store i32 %416, i32* %26
%417 = load i32, i32* %26
%418 = icmp eq i32 %417, -1
br i1 %418, label %419, label %430
419: ; preds = %407
%420 = load i32, i32* @errno
store i32 %420, i32* %28
%421 = load i8**, i8*** %17
%422 = load i8*, i8** %421
%423 = load i32, i32* %18
%424 = load i8*, i8** %15
%425 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %422, i32 %423, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %424)
%426 = load i32, i32* %24
%427 = call i32 @close(i32 %426)
%428 = load i32, i32* %28
store i32 %428, i32* @errno
%429 = load i32, i32* @EXIT_FAILURE
store i32 %429, i32* %12
br label %738
430: ; preds = %407
%431 = load i32, i32* %19
%432 = icmp ne i32 %431, 0
br i1 %432, label %433, label %441
433: ; preds = %430
%434 = load i8**, i8*** %13
%435 = load i32, i32* %27
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds i8*, i8** %434, i64 %436
%438 = load i8*, i8** %437
%439 = load i8*, i8** %15
%440 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %438, i8* %439)
br label %441
441: ; preds = %433, %430
br label %442
442: ; preds = %441, %402, %399
br label %443
443: ; preds = %442, %320
%444 = load i32, i32* %31
%445 = icmp ne i32 %444, 0
br i1 %445, label %446, label %478
446: ; preds = %443
%447 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%448 = load i32, i32* %447
%449 = call i64 @S_ISLNK(i32 %448)
%450 = icmp ne i64 %449, 0
br i1 %450, label %478, label %451
451: ; preds = %446
%452 = load i32, i32* %24
%453 = load i32, i32* %26
%454 = call i64 @mycp_copy(i32 %452, i32 %453)
%455 = icmp ne i64 %454, 0
br i1 %455, label %456, label %475
456: ; preds = %451
%457 = load i32, i32* @errno
store i32 %457, i32* %28
%458 = load i8**, i8*** %17
%459 = load i8*, i8** %458
%460 = load i32, i32* %18
%461 = load i8*, i8** %15
%462 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %459, i32 %460, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %461)
%463 = load i32, i32* %24
%464 = call i32 @close(i32 %463)
%465 = load i32, i32* %26
%466 = call i32 @close(i32 %465)
%467 = load i32, i32* %16
%468 = icmp ne i32 %467, 0
br i1 %468, label %469, label %472
469: ; preds = %456
%470 = load i32, i32* %25
%471 = call i32 @close(i32 %470)
br label %472
472: ; preds = %469, %456
%473 = load i32, i32* %28
store i32 %473, i32* @errno
%474 = load i32, i32* @EXIT_FAILURE
store i32 %474, i32* %12
br label %738
475: ; preds = %451
%476 = load i32, i32* %26
%477 = call i32 @close(i32 %476)
br label %478
478: ; preds = %475, %446, %443
%479 = load i32, i32* %31
%480 = icmp ne i32 %479, 0
br i1 %480, label %481, label %724
481: ; preds = %478
%482 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 1
%483 = load i32, i32* %482
%484 = call i64 @S_ISLNK(i32 %483)
%485 = icmp ne i64 %484, 0
br i1 %485, label %486, label %724
486: ; preds = %481
%487 = load i32, i32* %32
%488 = call i8* @calloc(i32 %487, i32 1)
store i8* %488, i8** %34
%489 = load i8*, i8** %34
%490 = icmp eq i8* %489, null
br i1 %490, label %491, label %503
491: ; preds = %486
%492 = load i32, i32* @errno
store i32 %492, i32* %28
%493 = load i32, i32* %24
%494 = call i32 @close(i32 %493)
%495 = load i32, i32* %16
%496 = icmp ne i32 %495, 0
br i1 %496, label %497, label %500
497: ; preds = %491
%498 = load i32, i32* %25
%499 = call i32 @close(i32 %498)
br label %500
500: ; preds = %497, %491
%501 = load i32, i32* %28
store i32 %501, i32* @errno
%502 = load i32, i32* @EXIT_FAILURE
store i32 %502, i32* %12
br label %738
503: ; preds = %486
%504 = load i8**, i8*** %13
%505 = load i32, i32* %27
%506 = sext i32 %505 to i64
%507 = getelementptr inbounds i8*, i8** %504, i64 %506
%508 = load i8*, i8** %507
%509 = load i8*, i8** %34
%510 = load i32, i32* %32
%511 = call i32 @readlink(i8* %508, i8* %509, i32 %510)
store i32 %511, i32* %33
%512 = load i32, i32* %33
%513 = icmp eq i32 %512, -1
br i1 %513, label %514, label %537
514: ; preds = %503
%515 = load i32, i32* @errno
store i32 %515, i32* %28
%516 = load i8**, i8*** %17
%517 = load i8*, i8** %516
%518 = load i32, i32* %18
%519 = load i8**, i8*** %13
%520 = load i32, i32* %27
%521 = sext i32 %520 to i64
%522 = getelementptr inbounds i8*, i8** %519, i64 %521
%523 = load i8*, i8** %522
%524 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %517, i32 %518, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %523)
%525 = load i8*, i8** %34
%526 = call i32 @free(i8* %525)
%527 = load i32, i32* %24
%528 = call i32 @close(i32 %527)
%529 = load i32, i32* %16
%530 = icmp ne i32 %529, 0
br i1 %530, label %531, label %534
531: ; preds = %514
%532 = load i32, i32* %25
%533 = call i32 @close(i32 %532)
br label %534
534: ; preds = %531, %514
%535 = load i32, i32* %28
store i32 %535, i32* @errno
%536 = load i32, i32* @EXIT_FAILURE
store i32 %536, i32* %12
br label %738
537: ; preds = %503
%538 = load i8*, i8** %34
%539 = load i32, i32* %33
%540 = sext i32 %539 to i64
%541 = getelementptr inbounds i8, i8* %538, i64 %540
store i8 0, i8* %541
%542 = load i32, i32* %30
%543 = icmp ne i32 %542, 0
br i1 %543, label %544, label %627
544: ; preds = %537
%545 = load i32, i32* %16
%546 = icmp ne i32 %545, 0
br i1 %546, label %547, label %592
547: ; preds = %544
%548 = load i32, i32* %25
%549 = load i8**, i8*** %13
%550 = load i32, i32* %27
%551 = sext i32 %550 to i64
%552 = getelementptr inbounds i8*, i8** %549, i64 %551
%553 = load i8*, i8** %552
%554 = call i64 @unlinkat(i32 %548, i8* %553, i32 0)
%555 = icmp ne i64 %554, 0
br i1 %555, label %556, label %580
556: ; preds = %547
%557 = load i32, i32* @errno
store i32 %557, i32* %28
%558 = load i8**, i8*** %17
%559 = load i8*, i8** %558
%560 = load i32, i32* %18
%561 = load i8*, i8** %15
%562 = load i8**, i8*** %13
%563 = load i32, i32* %27
%564 = sext i32 %563 to i64
%565 = getelementptr inbounds i8*, i8** %562, i64 %564
%566 = load i8*, i8** %565
%567 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %559, i32 %560, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i8* %561, i8* %566)
%568 = load i8*, i8** %34
%569 = call i32 @free(i8* %568)
%570 = load i32, i32* %24
%571 = call i32 @close(i32 %570)
%572 = load i32, i32* %16
%573 = icmp ne i32 %572, 0
br i1 %573, label %574, label %577
574: ; preds = %556
%575 = load i32, i32* %25
%576 = call i32 @close(i32 %575)
br label %577
577: ; preds = %574, %556
%578 = load i32, i32* %28
store i32 %578, i32* @errno
%579 = load i32, i32* @EXIT_FAILURE
store i32 %579, i32* %12
br label %738
580: ; preds = %547
%581 = load i32, i32* %19
%582 = icmp ne i32 %581, 0
br i1 %582, label %583, label %591
583: ; preds = %580
%584 = load i8*, i8** %15
%585 = load i8**, i8*** %13
%586 = load i32, i32* %27
%587 = sext i32 %586 to i64
%588 = getelementptr inbounds i8*, i8** %585, i64 %587
%589 = load i8*, i8** %588
%590 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %584, i8* %589)
br label %591
591: ; preds = %583, %580
br label %626
592: ; preds = %544
%593 = load i8*, i8** %15
%594 = call i64 @unlink(i8* %593)
%595 = icmp ne i64 %594, 0
br i1 %595, label %596, label %619
596: ; preds = %592
%597 = load i32, i32* @errno
store i32 %597, i32* %28
%598 = load i8**, i8*** %17
%599 = load i8*, i8** %598
%600 = load i32, i32* %18
%601 = load i8**, i8*** %13
%602 = load i32, i32* %27
%603 = sext i32 %602 to i64
%604 = getelementptr inbounds i8*, i8** %601, i64 %603
%605 = load i8*, i8** %604
%606 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %599, i32 %600, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8* %605)
%607 = load i8*, i8** %34
%608 = call i32 @free(i8* %607)
%609 = load i32, i32* %24
%610 = call i32 @close(i32 %609)
%611 = load i32, i32* %16
%612 = icmp ne i32 %611, 0
br i1 %612, label %613, label %616
613: ; preds = %596
%614 = load i32, i32* %25
%615 = call i32 @close(i32 %614)
br label %616
616: ; preds = %613, %596
%617 = load i32, i32* %28
store i32 %617, i32* @errno
%618 = load i32, i32* @EXIT_FAILURE
store i32 %618, i32* %12
br label %738
619: ; preds = %592
%620 = load i32, i32* %19
%621 = icmp ne i32 %620, 0
br i1 %621, label %622, label %625
622: ; preds = %619
%623 = load i8*, i8** %15
%624 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %623)
br label %625
625: ; preds = %622, %619
br label %626
626: ; preds = %625, %591
br label %627
627: ; preds = %626, %537
%628 = load i32, i32* %16
%629 = icmp ne i32 %628, 0
br i1 %629, label %630, label %681
630: ; preds = %627
%631 = load i8*, i8** %34
%632 = load i32, i32* %25
%633 = load i8**, i8*** %13
%634 = load i32, i32* %27
%635 = sext i32 %634 to i64
%636 = getelementptr inbounds i8*, i8** %633, i64 %635
%637 = load i8*, i8** %636
%638 = call i64 @symlinkat(i8* %631, i32 %632, i8* %637)
%639 = icmp ne i64 %638, 0
br i1 %639, label %640, label %664
640: ; preds = %630
%641 = load i32, i32* @errno
store i32 %641, i32* %28
%642 = load i8**, i8*** %17
%643 = load i8*, i8** %642
%644 = load i32, i32* %18
%645 = load i8*, i8** %15
%646 = load i8**, i8*** %13
%647 = load i32, i32* %27
%648 = sext i32 %647 to i64
%649 = getelementptr inbounds i8*, i8** %646, i64 %648
%650 = load i8*, i8** %649
%651 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %643, i32 %644, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i8* %645, i8* %650)
%652 = load i8*, i8** %34
%653 = call i32 @free(i8* %652)
%654 = load i32, i32* %24
%655 = call i32 @close(i32 %654)
%656 = load i32, i32* %16
%657 = icmp ne i32 %656, 0
br i1 %657, label %658, label %661
658: ; preds = %640
%659 = load i32, i32* %25
%660 = call i32 @close(i32 %659)
br label %661
661: ; preds = %658, %640
%662 = load i32, i32* %28
store i32 %662, i32* @errno
%663 = load i32, i32* @EXIT_FAILURE
store i32 %663, i32* %12
br label %738
664: ; preds = %630
%665 = load i32, i32* %19
%666 = icmp ne i32 %665, 0
br i1 %666, label %667, label %680
667: ; preds = %664
%668 = load i8**, i8*** %13
%669 = load i32, i32* %27
%670 = sext i32 %669 to i64
%671 = getelementptr inbounds i8*, i8** %668, i64 %670
%672 = load i8*, i8** %671
%673 = load i8*, i8** %15
%674 = load i8**, i8*** %13
%675 = load i32, i32* %27
%676 = sext i32 %675 to i64
%677 = getelementptr inbounds i8*, i8** %674, i64 %676
%678 = load i8*, i8** %677
%679 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %672, i8* %673, i8* %678)
br label %680
680: ; preds = %667, %664
br label %721
681: ; preds = %627
%682 = load i8*, i8** %34
%683 = load i8*, i8** %15
%684 = call i64 @symlink(i8* %682, i8* %683)
%685 = icmp ne i64 %684, 0
br i1 %685, label %686, label %709
686: ; preds = %681
%687 = load i32, i32* @errno
store i32 %687, i32* %28
%688 = load i8**, i8*** %17
%689 = load i8*, i8** %688
%690 = load i32, i32* %18
%691 = load i8**, i8*** %13
%692 = load i32, i32* %27
%693 = sext i32 %692 to i64
%694 = getelementptr inbounds i8*, i8** %691, i64 %693
%695 = load i8*, i8** %694
%696 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %689, i32 %690, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8* %695)
%697 = load i8*, i8** %34
%698 = call i32 @free(i8* %697)
%699 = load i32, i32* %24
%700 = call i32 @close(i32 %699)
%701 = load i32, i32* %16
%702 = icmp ne i32 %701, 0
br i1 %702, label %703, label %706
703: ; preds = %686
%704 = load i32, i32* %25
%705 = call i32 @close(i32 %704)
br label %706
706: ; preds = %703, %686
%707 = load i32, i32* %28
store i32 %707, i32* @errno
%708 = load i32, i32* @EXIT_FAILURE
store i32 %708, i32* %12
br label %738
709: ; preds = %681
%710 = load i32, i32* %19
%711 = icmp ne i32 %710, 0
br i1 %711, label %712, label %720
712: ; preds = %709
%713 = load i8**, i8*** %13
%714 = load i32, i32* %27
%715 = sext i32 %714 to i64
%716 = getelementptr inbounds i8*, i8** %713, i64 %715
%717 = load i8*, i8** %716
%718 = load i8*, i8** %15
%719 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %717, i8* %718)
br label %720
720: ; preds = %712, %709
br label %721
721: ; preds = %720, %680
%722 = load i8*, i8** %34
%723 = call i32 @free(i8* %722)
br label %724
724: ; preds = %721, %481, %478
%725 = load i32, i32* %24
%726 = call i32 @close(i32 %725)
br label %727
727: ; preds = %724
%728 = load i32, i32* %27
%729 = add nsw i32 %728, 1
store i32 %729, i32* %27
br label %58
730: ; preds = %58
%731 = load i32, i32* %16
%732 = icmp ne i32 %731, 0
br i1 %732, label %733, label %736
733: ; preds = %730
%734 = load i32, i32* %25
%735 = call i32 @close(i32 %734)
br label %736
736: ; preds = %733, %730
%737 = load i32, i32* @EXIT_SUCCESS
store i32 %737, i32* %12
br label %738
738: ; preds = %736, %706, %661, %616, %577, %534, %500, %472, %419, %353, %334, %285, %203, %177, %149, %100, %47
%739 = load i32, i32* %12
ret i32 %739
}

LLVM IR (-O2):
%struct.stat = type { i64, i32 }
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@errno = global i32 0
@.str = [20 x i8] c"failed to open '%s'\00"
@EXIT_FAILURE = global i32 0
@AT_FDCWD = global i32 0
@AT_SYMLINK_NOFOLLOW = global i32 0
@.str.1 = [17 x i8] c"cannot stat '%s'\00"
@F_OK = global i32 0
@W_OK = global i32 0
@.str.2 = [32 x i8] c"cannot create regular file '%s'\00"
@.str.3 = [17 x i8] c"connot stat '%s'\00"
@.str.4 = [24 x i8] c"%s: overwrite '%s/%s'? \00"
@.str.5 = [1 x i8] zeroinitializer
@stdin = global i32 0
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [24 x i8] c"failed to open '%s/%s':\00"
@.str.7 = [17 x i8] c"'%s' -> '%s/%s'\0A\00"
@.str.8 = [21 x i8] c"%s: overwrite '%s'? \00"
@.str.9 = [14 x i8] c"'%s' -> '%s'\0A\00"
@.str.10 = [17 x i8] c"cannot copy '%s'\00"
@.str.11 = [24 x i8] c"failed access link '%s'\00"
@.str.12 = [25 x i8] c"failed to remove '%s/%s'\00"
@.str.13 = [17 x i8] c"'%s/%s' removed\0A\00"
@.str.14 = [22 x i8] c"failed to remove '%s'\00"
@.str.15 = [14 x i8] c"'%s' removed\0A\00"
@.str.16 = [30 x i8] c"failed to create link '%s/%s'\00"
@EXIT_SUCCESS = global i32 0
define i32 @mycp_do_copy(i8** nocapture %0, i32 %1, i8* %2, i32 %3, i8** nocapture %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca %struct.stat
%13 = alloca %struct.stat
%14 = bitcast %struct.stat* %12 to i8*
%15 = bitcast %struct.stat* %13 to i8*
%16 = icmp eq i32 %3, 0
br i1 %16, label %27, label %17
17: ; preds = %11
%18 = load i32, i32* @O_RDONLY
%19 = load i32, i32* @O_DIRECTORY
%20 = or i32 %19, %18
%21 = tail call i32 (i8*, i32, ...) @open(i8* %2, i32 %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i32, i32* @errno
%25 = load i8*, i8** %4
%26 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %25, i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2)
store i32 %24, i32* @errno
br label %364
27: ; preds = %17, %11
%28 = phi i32 [ %21, %17 ], [ undef, %11 ]
%29 = icmp sgt i32 %1, 0
br i1 %29, label %30, label %361
30: ; preds = %27
%31 = icmp eq i32 %8, 0
%32 = getelementptr inbounds %struct.stat, %struct.stat* %12, i64 0, i32 1
%33 = icmp eq i32 %7, 0
%34 = getelementptr inbounds %struct.stat, %struct.stat* %12, i64 0, i32 0
%35 = getelementptr inbounds %struct.stat, %struct.stat* %13, i64 0, i32 0
%36 = icmp eq i32 %9, 0
%37 = zext i1 %36 to i32
%38 = icmp ne i32 %10, 0
%39 = and i1 %36, %38
%40 = icmp eq i32 %6, 0
%41 = zext i32 %1 to i64
br label %42
42: ; preds = %30, %355
%43 = phi i64 [ 0, %30 ], [ %359, %355 ]
%44 = phi i32 [ 1, %30 ], [ %356, %355 ]
%45 = phi i32 [ undef, %30 ], [ %357, %355 ]
br i1 %31, label %46, label %53
46: ; preds = %42
%47 = load i32, i32* @AT_FDCWD
%48 = getelementptr inbounds i8*, i8** %0, i64 %43
%49 = load i8*, i8** %48
%50 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%51 = call i32 @fstatat(i32 %47, i8* %49, %struct.stat* %12, i32 %50)
%52 = icmp eq i32 %51, 0
br i1 %52, label %76, label %58
53: ; preds = %42
%54 = getelementptr inbounds i8*, i8** %0, i64 %43
%55 = load i8*, i8** %54
%56 = call i32 @stat(i8* %55, %struct.stat* %12)
%57 = icmp eq i32 %56, 0
br i1 %57, label %68, label %58
58: ; preds = %53, %46
%59 = load i32, i32* @errno
%60 = load i8*, i8** %4
%61 = and i64 %43, 4294967295
%62 = getelementptr inbounds i8*, i8** %0, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %60, i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %63)
br i1 %16, label %67, label %65
65: ; preds = %58
%66 = call i32 @close(i32 %28)
br label %67
67: ; preds = %65, %58
store i32 %59, i32* @errno
br label %364
68: ; preds = %53
%69 = load i32, i32* %32
%70 = call i64 @S_ISLNK(i32 %69)
%71 = icmp eq i64 %70, 0
br i1 %71, label %76, label %72
72: ; preds = %68
%73 = load i8*, i8** %54
%74 = load i32, i32* @O_RDONLY
%75 = call i32 (i8*, i32, ...) @open(i8* %73, i32 %74)
br label %83
76: ; preds = %46, %68
%77 = load i32, i32* @AT_FDCWD
%78 = getelementptr inbounds i8*, i8** %0, i64 %43
%79 = load i8*, i8** %78
%80 = load i32, i32* @O_RDONLY
%81 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%82 = call i32 @openat(i32 %77, i8* %79, i32 %80, i32 %81)
br label %83
83: ; preds = %76, %72
%84 = phi i32 [ %75, %72 ], [ %82, %76 ]
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %95
86: ; preds = %83
br i1 %16, label %364, label %87
87: ; preds = %86
%88 = load i32, i32* @errno
%89 = load i8*, i8** %4
%90 = and i64 %43, 4294967295
%91 = getelementptr inbounds i8*, i8** %0, i64 %90
%92 = load i8*, i8** %91
%93 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %89, i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %92)
%94 = call i32 @close(i32 %28)
store i32 %88, i32* @errno
br label %364
95: ; preds = %83
br i1 %16, label %167, label %96
96: ; preds = %95
%97 = getelementptr inbounds i8*, i8** %0, i64 %43
%98 = load i8*, i8** %97
%99 = load i32, i32* @F_OK
%100 = call i64 @faccessat(i32 %28, i8* %98, i32 %99, i32 0)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %139
102: ; preds = %96
%103 = load i8*, i8** %97
%104 = load i32, i32* @W_OK
%105 = call i64 @faccessat(i32 %28, i8* %103, i32 %104, i32 0)
%106 = icmp eq i64 %105, 0
br i1 %106, label %114, label %107
107: ; preds = %102
%108 = load i32, i32* @errno
%109 = load i8*, i8** %4
%110 = load i8*, i8** %97
%111 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %109, i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %110)
%112 = call i32 @close(i32 %84)
%113 = call i32 @close(i32 %28)
store i32 %108, i32* @errno
br label %364
114: ; preds = %102
%115 = load i8*, i8** %97
%116 = call i32 @fstatat(i32 %28, i8* %115, %struct.stat* %13, i32 0)
%117 = icmp eq i32 %116, 0
br i1 %117, label %125, label %118
118: ; preds = %114
%119 = load i32, i32* @errno
%120 = load i8*, i8** %4
%121 = load i8*, i8** %97
%122 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %120, i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %121)
%123 = call i32 @close(i32 %84)
%124 = call i32 @close(i32 %28)
store i32 %119, i32* @errno
br label %364
125: ; preds = %114
br i1 %33, label %130, label %126
126: ; preds = %125
%127 = load i64, i64* %34
%128 = load i64, i64* %35
%129 = icmp sgt i64 %127, %128
br i1 %129, label %130, label %355
130: ; preds = %125, %126
br i1 %39, label %131, label %139
131: ; preds = %130
%132 = load i8*, i8** %97
%133 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* %132)
%134 = load i32, i32* @stdin
%135 = call i32 @getc(i32 %134)
%136 = and i32 %135, -33
%137 = icmp eq i32 %136, 89
%138 = zext i1 %137 to i32
br label %139
139: ; preds = %130, %131, %96
%140 = phi i32 [ %138, %131 ], [ %37, %130 ], [ %44, %96 ]
%141 = icmp eq i32 %140, 0
br i1 %141, label %355, label %142
142: ; preds = %139
%143 = load i32, i32* %32
%144 = call i64 @S_ISLNK(i32 %143)
%145 = icmp eq i64 %144, 0
br i1 %145, label %146, label %230
146: ; preds = %142
%147 = load i8*, i8** %97
%148 = load i32, i32* @O_CREAT
%149 = load i32, i32* @O_WRONLY
%150 = or i32 %149, %148
%151 = load i32, i32* @O_TRUNC
%152 = or i32 %150, %151
%153 = load i32, i32* %32
%154 = call i32 @openat(i32 %28, i8* %147, i32 %152, i32 %153)
%155 = icmp eq i32 %154, -1
br i1 %155, label %156, label %163
156: ; preds = %146
%157 = load i32, i32* @errno
%158 = load i8*, i8** %4
%159 = load i8*, i8** %97
%160 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %158, i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* %2, i8* %159)
%161 = call i32 @close(i32 %84)
%162 = call i32 @close(i32 %28)
store i32 %157, i32* @errno
br label %364
163: ; preds = %146
br i1 %40, label %230, label %164
164: ; preds = %163
%165 = load i8*, i8** %97
%166 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %165, i8* %2, i8* %165)
br label %230
167: ; preds = %95
%168 = load i32, i32* @F_OK
%169 = call i64 @access(i8* %2, i32 %168)
%170 = icmp eq i64 %169, 0
br i1 %170, label %171, label %204
171: ; preds = %167
%172 = load i32, i32* @W_OK
%173 = call i64 @access(i8* %2, i32 %172)
%174 = icmp eq i64 %173, 0
br i1 %174, label %183, label %175
175: ; preds = %171
%176 = load i32, i32* @errno
%177 = load i8*, i8** %4
%178 = and i64 %43, 4294967295
%179 = getelementptr inbounds i8*, i8** %0, i64 %178
%180 = load i8*, i8** %179
%181 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %177, i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %180)
%182 = call i32 @close(i32 %84)
store i32 %176, i32* @errno
br label %364
183: ; preds = %171
%184 = call i32 @stat(i8* %2, %struct.stat* %13)
%185 = icmp eq i32 %184, 0
br i1 %185, label %191, label %186
186: ; preds = %183
%187 = load i32, i32* @errno
%188 = load i8*, i8** %4
%189 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %188, i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%190 = call i32 @close(i32 %84)
store i32 %187, i32* @errno
br label %364
191: ; preds = %183
br i1 %33, label %196, label %192
192: ; preds = %191
%193 = load i64, i64* %34
%194 = load i64, i64* %35
%195 = icmp sgt i64 %193, %194
br i1 %195, label %196, label %355
196: ; preds = %191, %192
br i1 %39, label %197, label %204
197: ; preds = %196
%198 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%199 = load i32, i32* @stdin
%200 = call i32 @getc(i32 %199)
%201 = and i32 %200, -33
%202 = icmp eq i32 %201, 89
%203 = zext i1 %202 to i32
br label %204
204: ; preds = %196, %197, %167
%205 = phi i32 [ %203, %197 ], [ %37, %196 ], [ %44, %167 ]
%206 = icmp eq i32 %205, 0
br i1 %206, label %355, label %207
207: ; preds = %204
%208 = load i32, i32* %32
%209 = call i64 @S_ISLNK(i32 %208)
%210 = icmp eq i64 %209, 0
br i1 %210, label %211, label %230
211: ; preds = %207
%212 = load i32, i32* @O_CREAT
%213 = load i32, i32* @O_WRONLY
%214 = or i32 %213, %212
%215 = load i32, i32* @O_TRUNC
%216 = or i32 %214, %215
%217 = load i32, i32* %32
%218 = call i32 (i8*, i32, ...) @open(i8* %2, i32 %216, i32 %217)
%219 = icmp eq i32 %218, -1
br i1 %219, label %220, label %225
220: ; preds = %211
%221 = load i32, i32* @errno
%222 = load i8*, i8** %4
%223 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %222, i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2)
%224 = call i32 @close(i32 %84)
store i32 %221, i32* @errno
br label %364
225: ; preds = %211
br i1 %40, label %230, label %226
226: ; preds = %225
%227 = getelementptr inbounds i8*, i8** %0, i64 %43
%228 = load i8*, i8** %227
%229 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %228, i8* %2)
br label %230
230: ; preds = %142, %164, %163, %207, %226, %225
%231 = phi i32 [ %218, %225 ], [ %218, %226 ], [ %45, %207 ], [ %154, %163 ], [ %154, %164 ], [ %45, %142 ]
%232 = phi i1 [ %170, %225 ], [ %170, %226 ], [ %170, %207 ], [ %101, %163 ], [ %101, %164 ], [ %101, %142 ]
%233 = load i32, i32* %32
%234 = call i64 @S_ISLNK(i32 %233)
%235 = icmp eq i64 %234, 0
br i1 %235, label %236, label %250
236: ; preds = %230
%237 = call i64 @mycp_copy(i32 %84, i32 %231)
%238 = icmp eq i64 %237, 0
br i1 %238, label %248, label %239
239: ; preds = %236
%240 = load i32, i32* @errno
%241 = load i8*, i8** %4
%242 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %241, i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %2)
%243 = call i32 @close(i32 %84)
%244 = call i32 @close(i32 %231)
br i1 %16, label %247, label %245
245: ; preds = %239
%246 = call i32 @close(i32 %28)
br label %247
247: ; preds = %245, %239
store i32 %240, i32* @errno
br label %364
248: ; preds = %236
%249 = call i32 @close(i32 %231)
br label %250
250: ; preds = %230, %248
%251 = load i32, i32* %32
%252 = call i64 @S_ISLNK(i32 %251)
%253 = icmp eq i64 %252, 0
br i1 %253, label %355, label %254
254: ; preds = %250
%255 = call dereferenceable_or_null(1024) i8* @calloc(i32 1024, i32 1)
%256 = icmp eq i8* %255, null
br i1 %256, label %257, label %263
257: ; preds = %254
%258 = load i32, i32* @errno
%259 = call i32 @close(i32 %84)
br i1 %16, label %262, label %260
260: ; preds = %257
%261 = call i32 @close(i32 %28)
br label %262
262: ; preds = %260, %257
store i32 %258, i32* @errno
br label %364
263: ; preds = %254
%264 = getelementptr inbounds i8*, i8** %0, i64 %43
%265 = load i8*, i8** %264
%266 = call i32 @readlink(i8* %265, i8* %255, i32 1024)
%267 = icmp eq i32 %266, -1
br i1 %267, label %268, label %278
268: ; preds = %263
%269 = load i32, i32* @errno
%270 = load i8*, i8** %4
%271 = load i8*, i8** %264
%272 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %270, i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %271)
%273 = call i32 @free(i8* %255)
%274 = call i32 @close(i32 %84)
br i1 %16, label %277, label %275
275: ; preds = %268
%276 = call i32 @close(i32 %28)
br label %277
277: ; preds = %275, %268
store i32 %269, i32* @errno
br label %364
278: ; preds = %263
%279 = sext i32 %266 to i64
%280 = getelementptr inbounds i8, i8* %255, i64 %279
store i8 0, i8* %280
br i1 %232, label %281, label %307
281: ; preds = %278
br i1 %16, label %296, label %282
282: ; preds = %281
%283 = load i8*, i8** %264
%284 = call i64 @unlinkat(i32 %28, i8* %283, i32 0)
%285 = icmp eq i64 %284, 0
br i1 %285, label %294, label %286
286: ; preds = %282
%287 = load i32, i32* @errno
%288 = load i8*, i8** %4
%289 = load i8*, i8** %264
%290 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %288, i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i8* %2, i8* %289)
%291 = call i32 @free(i8* %255)
%292 = call i32 @close(i32 %84)
%293 = call i32 @close(i32 %28)
store i32 %287, i32* @errno
br label %364
294: ; preds = %282
%295 = load i8*, i8** %264
br i1 %40, label %312, label %315
296: ; preds = %281
%297 = call i64 @unlink(i8* %2)
%298 = icmp eq i64 %297, 0
br i1 %298, label %306, label %299
299: ; preds = %296
%300 = load i32, i32* @errno
%301 = load i8*, i8** %4
%302 = load i8*, i8** %264
%303 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %301, i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8* %302)
%304 = call i32 @free(i8* %255)
%305 = call i32 @close(i32 %84)
store i32 %300, i32* @errno
br label %364
306: ; preds = %296
br i1 %40, label %339, label %335
307: ; preds = %278
br i1 %16, label %332, label %308
308: ; preds = %307
%309 = load i8*, i8** %264
%310 = call i64 @symlinkat(i8* %255, i32 %28, i8* %309)
%311 = icmp eq i64 %310, 0
br i1 %311, label %328, label %320
312: ; preds = %294
%313 = call i64 @symlinkat(i8* %255, i32 %28, i8* %295)
%314 = icmp eq i64 %313, 0
br i1 %314, label %353, label %320
315: ; preds = %294
%316 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8* %2, i8* %295)
%317 = load i8*, i8** %264
%318 = call i64 @symlinkat(i8* %255, i32 %28, i8* %317)
%319 = icmp eq i64 %318, 0
br i1 %319, label %329, label %320
320: ; preds = %312, %315, %308
%321 = load i32, i32* @errno
%322 = load i8*, i8** %4
%323 = load i8*, i8** %264
%324 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %322, i32 %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i8* %2, i8* %323)
%325 = call i32 @free(i8* %255)
%326 = call i32 @close(i32 %84)
%327 = call i32 @close(i32 %28)
store i32 %321, i32* @errno
br label %364
328: ; preds = %308
br i1 %40, label %353, label %329
329: ; preds = %315, %328
%330 = load i8*, i8** %264
%331 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %330, i8* %2, i8* %330)
br label %353
332: ; preds = %307
%333 = call i64 @symlink(i8* %255, i8* %2)
%334 = icmp eq i64 %333, 0
br i1 %334, label %349, label %342
335: ; preds = %306
%336 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %2)
%337 = call i64 @symlink(i8* %255, i8* %2)
%338 = icmp eq i64 %337, 0
br i1 %338, label %350, label %342
339: ; preds = %306
%340 = call i64 @symlink(i8* %255, i8* %2)
%341 = icmp eq i64 %340, 0
br i1 %341, label %353, label %342
342: ; preds = %335, %339, %332
%343 = load i32, i32* @errno
%344 = load i8*, i8** %4
%345 = load i8*, i8** %264
%346 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %344, i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8* %345)
%347 = call i32 @free(i8* %255)
%348 = call i32 @close(i32 %84)
store i32 %343, i32* @errno
br label %364
349: ; preds = %332
br i1 %40, label %353, label %350
350: ; preds = %335, %349
%351 = load i8*, i8** %264
%352 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %351, i8* %2)
br label %353
353: ; preds = %312, %339, %349, %350, %328, %329
%354 = call i32 @free(i8* %255)
br label %355
355: ; preds = %192, %126, %139, %204, %353, %250
%356 = phi i32 [ 1, %353 ], [ 1, %250 ], [ 0, %139 ], [ 0, %204 ], [ 0, %126 ], [ 0, %192 ]
%357 = phi i32 [ %231, %353 ], [ %231, %250 ], [ %45, %139 ], [ %45, %204 ], [ %45, %126 ], [ %45, %192 ]
%358 = call i32 @close(i32 %84)
%359 = add nuw nsw i64 %43, 1
%360 = icmp eq i64 %359, %41
br i1 %360, label %361, label %42
361: ; preds = %355, %27
br i1 %16, label %364, label %362
362: ; preds = %361
%363 = call i32 @close(i32 %28)
br label %364
364: ; preds = %361, %362, %86, %87, %342, %320, %299, %286, %277, %262, %247, %220, %186, %175, %156, %118, %107, %67, %23
%365 = phi i32* [ @EXIT_FAILURE, %23 ], [ @EXIT_FAILURE, %67 ], [ @EXIT_FAILURE, %107 ], [ @EXIT_FAILURE, %118 ], [ @EXIT_FAILURE, %262 ], [ @EXIT_FAILURE, %277 ], [ @EXIT_FAILURE, %286 ], [ @EXIT_FAILURE, %320 ], [ @EXIT_FAILURE, %342 ], [ @EXIT_FAILURE, %299 ], [ @EXIT_FAILURE, %247 ], [ @EXIT_FAILURE, %156 ], [ @EXIT_FAILURE, %175 ], [ @EXIT_FAILURE, %186 ], [ @EXIT_FAILURE, %220 ], [ @EXIT_FAILURE, %87 ], [ @EXIT_FAILURE, %86 ], [ @EXIT_SUCCESS, %362 ], [ @EXIT_SUCCESS, %361 ]
%366 = load i32, i32* %365
ret i32 %366
}