#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 /*<<< orphan*/ uid_t;
struct stat {
  int st_mode;
};
typedef int /*<<< orphan*/ curpath;

/* Variables and functions */
int S_IFDIR;
int /*<<< orphan*/ delay_signaling();
int /*<<< orphan*/ enable_signaling();
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ geteuid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ seteuid(int /*<<< orphan*/);
int stat(char *, struct stat *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *my_realpath(const char *pathname, char *result, char *chroot_path) {
  struct stat sbuf;
  char canary[] = "GOOD";
  char curpath[46], workpath[46], linkpath[46], namebuf[46], *where, *ptr,
      *last;
  int len;
  uid_t userid;
  int resultcode;
  if (result == NULL)
    return (NULL);
  if (pathname == NULL) {
    *result = '\0';
    return (NULL);
  }
  printf("MY_REALPATH: pathname passed in = %s\n", pathname);
  printf(
      "strcpy(curpath, pathname):Copying %d bytes into an array of size %d\n",
      strlen(pathname), sizeof(curpath));
  strcpy(curpath, pathname);
  printf("canary=[%s]\n", canary);
  if (*pathname != '/') {
    uid_t userid;
    if (!getcwd(workpath, 46)) {
      userid = geteuid();
      delay_signaling();
      seteuid(0);
      if (!getcwd(workpath, 46)) {
        strcpy(result, ".");
        seteuid(userid);
        enable_signaling();
        return (NULL);
      }
      seteuid(userid);
      enable_signaling();
    }
  } else
    *workpath = '\0';
  where = curpath;
  while (*where != '\0') {
    if (!strcmp(where, ".")) {
      where++;
      continue;
    }
    if (!strncmp(where, "./", 2)) {
      where += 2;
      continue;
    }
    if (!strncmp(where, "../", 3)) {
      where += 3;
      ptr = last = workpath;
      while (*ptr != '\0') {
        if (*ptr == '/')
          last = ptr;
        ptr++;
      }
      *last = '\0';
      continue;
    }
    ptr = strchr(where, '/');
    if (ptr == (char *)NULL)
      ptr = where + strlen(where) - 1;
    else
      *ptr = '\0';
    strcpy(namebuf, workpath);
    for (last = namebuf; *last; last++)
      continue;
    if ((last == namebuf) || (*--last != '/')) {
      strcat(namebuf, "/");
      printf("canary=[%s]\n", canary);
    }
    strcat(namebuf, where);
    printf("canary=[%s]\n", canary);
    where = ++ptr;
    userid = geteuid();
    delay_signaling();
    seteuid(0);
    resultcode = stat(namebuf, &sbuf);
    seteuid(userid);
    enable_signaling();
    if (resultcode == -1) {
      if (chroot_path == NULL) {
        strcpy(result, namebuf);
        printf("canary=[%s]\n", canary);
      } else {
        strcpy(result, chroot_path);
        printf("canary=[%s]\n", canary);
        if (namebuf[0] != '/') {
          strcat(result, namebuf);
          printf("canary=[%s]\n", canary);
        } else if (namebuf[1] != '\0') {
          for (ptr = result; *ptr != '\0'; ptr++)
            ;
          if (ptr == result || *--ptr != '/') {
            strcat(result, namebuf);
            printf("canary=[%s]\n", canary);
          } else {
            strcat(result, &namebuf[1]);
            printf("canary=[%s]\n", canary);
          }
        }
      }
      return (NULL);
    }
    if ((sbuf.st_mode & S_IFDIR) == S_IFDIR) {
      strcpy(workpath, namebuf);
      printf("canary=[%s]\n", canary);
      continue;
    }
    if (*where) {
      if (chroot_path == NULL) {
        strcpy(result, namebuf);
        printf("canary=[%s]\n", canary);
      } else {
        strcpy(result, chroot_path);
        if (namebuf[0] != '/') {
          strcat(result, namebuf);
          printf("canary=[%s]\n", canary);
        } else if (namebuf[1] != '\0') {
          for (ptr = result; *ptr != '\0'; ptr++)
            ;
          if (ptr == result || *--ptr != '/') {
            strcat(result, namebuf);
            printf("canary=[%s]\n", canary);
          } else {
            strcat(result, &namebuf[1]);
            printf("canary=[%s]\n", canary);
          }
        }
      }
      return (NULL);
    } else {
      strcpy(workpath, namebuf);
      printf("canary=[%s]\n", canary);
    }
  }
  if (chroot_path == NULL) {
    strcpy(result, workpath);
    printf("canary=[%s]\n", canary);
  } else {
    strcpy(result, chroot_path);
    printf("canary=[%s]\n", canary);
    if (workpath[0] != '/') {
      strcat(result, workpath);
      printf("canary=[%s]\n", canary);
    } else if (workpath[1] != '\0') {
      for (ptr = result; *ptr != '\0'; ptr++)
        ;
      if (ptr == result || *--ptr != '/') {
        strcat(result, workpath);
        printf("canary=[%s]\n", canary);
      } else {
        strcat(result, &workpath[1]);
        printf("canary=[%s]\n", canary);
      }
    }
  }
  return (result);
}


x86 assembly (clang, -O0):
<my_realpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0xe13(%rip),%eax
mov    %eax,-0x2d(%rbp)
mov    0xe0e(%rip),%al
mov    %al,-0x29(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1211 <my_realpath+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1aaa <my_realpath+0x8da>
cmpq   $0x0,-0x10(%rbp)
jne    1230 <my_realpath+0x60>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1aaa <my_realpath+0x8da>
mov    -0x10(%rbp),%rsi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%esi
lea    0xdd7(%rip),%rdi
mov    $0x2e,%edx
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1324 <my_realpath+0x154>
lea    -0x90(%rbp),%rdi
mov    $0x2e,%esi
call   1090 <getcwd@plt>
cmp    $0x0,%eax
jne    131f <my_realpath+0x14f>
mov    $0x0,%al
call   1080 <geteuid@plt>
mov    %eax,-0x118(%rbp)
mov    $0x0,%al
call   10c0 <delay_signaling@plt>
xor    %edi,%edi
call   10f0 <seteuid@plt>
lea    -0x90(%rbp),%rdi
mov    $0x2e,%esi
call   1090 <getcwd@plt>
cmp    $0x0,%eax
jne    130d <my_realpath+0x13d>
mov    -0x18(%rbp),%rdi
lea    0xd94(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x118(%rbp),%edi
call   10f0 <seteuid@plt>
mov    $0x0,%al
call   10d0 <enable_signaling@plt>
movq   $0x0,-0x8(%rbp)
jmp    1aaa <my_realpath+0x8da>
mov    -0x118(%rbp),%edi
call   10f0 <seteuid@plt>
mov    $0x0,%al
call   10d0 <enable_signaling@plt>
jmp    132b <my_realpath+0x15b>
movb   $0x0,-0x90(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0xf8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1941 <my_realpath+0x771>
mov    -0xf8(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    137c <my_realpath+0x1ac>
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    1336 <my_realpath+0x166>
mov    -0xf8(%rbp),%rdi
lea    0xcf6(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13b4 <my_realpath+0x1e4>
mov    -0xf8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0xf8(%rbp)
jmp    1336 <my_realpath+0x166>
mov    -0xf8(%rbp),%rdi
lea    0xcbd(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1456 <my_realpath+0x286>
mov    -0xf8(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0xf8(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    %rax,-0x100(%rbp)
mov    -0x100(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1447 <my_realpath+0x277>
mov    -0x100(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1430 <my_realpath+0x260>
mov    -0x100(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
jmp    13fc <my_realpath+0x22c>
mov    -0x108(%rbp),%rax
movb   $0x0,(%rax)
jmp    1336 <my_realpath+0x166>
mov    -0xf8(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
mov    %rax,-0x100(%rbp)
cmpq   $0x0,-0x100(%rbp)
jne    14b5 <my_realpath+0x2e5>
mov    -0xf8(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0xf8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x100(%rbp)
jmp    14bf <my_realpath+0x2ef>
mov    -0x100(%rbp),%rax
movb   $0x0,(%rax)
lea    -0xf0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0xf0(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x108(%rbp),%rax
cmpb   $0x0,(%rax)
je     150c <my_realpath+0x33c>
jmp    14f5 <my_realpath+0x325>
mov    -0x108(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x108(%rbp)
jmp    14e0 <my_realpath+0x310>
mov    -0x108(%rbp),%rax
lea    -0xf0(%rbp),%rcx
cmp    %rcx,%rax
je     1545 <my_realpath+0x375>
mov    -0x108(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x108(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
je     156a <my_realpath+0x39a>
lea    -0xf0(%rbp),%rdi
lea    0xb2e(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0xb0d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0xae8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
mov    %rax,-0xf8(%rbp)
mov    $0x0,%al
call   1080 <geteuid@plt>
mov    %eax,-0x110(%rbp)
mov    $0x0,%al
call   10c0 <delay_signaling@plt>
xor    %edi,%edi
call   10f0 <seteuid@plt>
lea    -0xf0(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10b0 <stat@plt>
mov    %eax,-0x114(%rbp)
mov    -0x110(%rbp),%edi
call   10f0 <seteuid@plt>
mov    $0x0,%al
call   10d0 <enable_signaling@plt>
cmpl   $0xffffffff,-0x114(%rbp)
jne    1766 <my_realpath+0x596>
cmpq   $0x0,-0x20(%rbp)
jne    162a <my_realpath+0x45a>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0xa52(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1759 <my_realpath+0x589>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0xa2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0xf0(%rbp),%eax
cmp    $0x2f,%eax
je     1680 <my_realpath+0x4b0>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x9fc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1754 <my_realpath+0x584>
movsbl -0xef(%rbp),%eax
cmp    $0x0,%eax
je     174f <my_realpath+0x57f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x100(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     16ca <my_realpath+0x4fa>
jmp    16b3 <my_realpath+0x4e3>
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
jmp    169b <my_realpath+0x4cb>
mov    -0x100(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     16fd <my_realpath+0x52d>
mov    -0x100(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x100(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
je     1724 <my_realpath+0x554>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x958(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    174a <my_realpath+0x57a>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
add    $0x1,%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x92d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    174f <my_realpath+0x57f>
jmp    1754 <my_realpath+0x584>
jmp    1759 <my_realpath+0x589>
movq   $0x0,-0x8(%rbp)
jmp    1aaa <my_realpath+0x8da>
mov    -0x28(%rbp),%eax
mov    0x2868(%rip),%rcx
and    (%rcx),%eax
mov    0x285f(%rip),%rcx
cmp    (%rcx),%eax
jne    17ab <my_realpath+0x5db>
lea    -0x90(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0x8d1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1336 <my_realpath+0x166>
mov    -0xf8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1917 <my_realpath+0x747>
cmpq   $0x0,-0x20(%rbp)
jne    17ed <my_realpath+0x61d>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0x88f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    190a <my_realpath+0x73a>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
movsbl -0xf0(%rbp),%eax
cmp    $0x2f,%eax
je     1831 <my_realpath+0x661>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x84b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1905 <my_realpath+0x735>
movsbl -0xef(%rbp),%eax
cmp    $0x0,%eax
je     1900 <my_realpath+0x730>
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x100(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     187b <my_realpath+0x6ab>
jmp    1864 <my_realpath+0x694>
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
jmp    184c <my_realpath+0x67c>
mov    -0x100(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     18ae <my_realpath+0x6de>
mov    -0x100(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x100(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
je     18d5 <my_realpath+0x705>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x7a7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    18fb <my_realpath+0x72b>
mov    -0x18(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
add    $0x1,%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x77c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1900 <my_realpath+0x730>
jmp    1905 <my_realpath+0x735>
jmp    190a <my_realpath+0x73a>
movq   $0x0,-0x8(%rbp)
jmp    1aaa <my_realpath+0x8da>
lea    -0x90(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0x73b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1336 <my_realpath+0x166>
cmpq   $0x0,-0x20(%rbp)
jne    1973 <my_realpath+0x7a3>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0x709(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1aa2 <my_realpath+0x8d2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x2d(%rbp),%rsi
lea    0x6e5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x90(%rbp),%eax
cmp    $0x2f,%eax
je     19c9 <my_realpath+0x7f9>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x6b3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1a9d <my_realpath+0x8cd>
movsbl -0x8f(%rbp),%eax
cmp    $0x0,%eax
je     1a98 <my_realpath+0x8c8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x100(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1a13 <my_realpath+0x843>
jmp    19fc <my_realpath+0x82c>
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
jmp    19e4 <my_realpath+0x814>
mov    -0x100(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1a46 <my_realpath+0x876>
mov    -0x100(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x100(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
je     1a6d <my_realpath+0x89d>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x60f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1a93 <my_realpath+0x8c3>
mov    -0x18(%rbp),%rdi
lea    -0x90(%rbp),%rsi
add    $0x1,%rsi
call   10e0 <strcat@plt>
lea    -0x2d(%rbp),%rsi
lea    0x5e4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1a98 <my_realpath+0x8c8>
jmp    1a9d <my_realpath+0x8cd>
jmp    1aa2 <my_realpath+0x8d2>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_realpath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movb   $0x0,0x4(%rsp)
movl   $0x444f4f47,(%rsp)
test   %rsi,%rsi
je     15ff <my_realpath+0x42f>
mov    %rsi,%rbp
mov    %rdi,%rbx
test   %rdi,%rdi
je     1267 <my_realpath+0x97>
mov    %rdx,%r14
lea    0xdfa(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe07(%rip),%rdi
mov    $0x2e,%edx
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0xe24(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0x2f,(%rbx)
mov    %r14,0x10(%rsp)
jne    1272 <my_realpath+0xa2>
movb   $0x0,0x50(%rsp)
jmp    12c1 <my_realpath+0xf1>
movb   $0x0,0x0(%rbp)
xor    %ebx,%ebx
jmp    1601 <my_realpath+0x431>
lea    0x50(%rsp),%rdi
mov    $0x2e,%esi
call   1090 <getcwd@plt>
test   %eax,%eax
jne    12c1 <my_realpath+0xf1>
xor    %eax,%eax
call   1080 <geteuid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10c0 <delay_signaling@plt>
xor    %edi,%edi
call   10f0 <seteuid@plt>
lea    0x50(%rsp),%rdi
mov    $0x2e,%esi
call   1090 <getcwd@plt>
test   %eax,%eax
je     158c <my_realpath+0x3bc>
mov    %ebx,%edi
call   10f0 <seteuid@plt>
xor    %eax,%eax
call   10d0 <enable_signaling@plt>
mov    %rbp,0x8(%rsp)
cmpb   $0x0,0x80(%rsp)
je     149d <my_realpath+0x2cd>
lea    0xda2(%rip),%r14
lea    0xd9e(%rip),%r15
jmp    1305 <my_realpath+0x135>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r13
mov    %r13,%r12
cmpb   $0x0,(%r12)
mov    %r12,%r13
je     149d <my_realpath+0x2cd>
mov    %r13,%rdi
mov    %r14,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     12f0 <my_realpath+0x120>
mov    %r13,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1360 <my_realpath+0x190>
mov    %r13,%rdi
lea    0xd4d(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1366 <my_realpath+0x196>
mov    %r13,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     138f <my_realpath+0x1bf>
mov    %rax,%r12
movb   $0x0,(%rax)
jmp    13a1 <my_realpath+0x1d1>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r13
jmp    12f4 <my_realpath+0x124>
lea    0x50(%rsp),%rcx
mov    %rcx,%rax
jmp    1377 <my_realpath+0x1a7>
mov    %rcx,%rax
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x2f,%dl
je     1370 <my_realpath+0x1a0>
test   %dl,%dl
jne    1373 <my_realpath+0x1a3>
add    $0x3,%r13
movb   $0x0,(%rax)
jmp    12f4 <my_realpath+0x124>
mov    %r13,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rax,%r13,1),%r12
add    $0xffffffffffffffff,%r12
lea    0x20(%rsp),%rdi
lea    0x50(%rsp),%rsi
call   1040 <strcpy@plt>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,0x20(%rsp,%rax,1)
lea    0x1(%rax),%rax
jne    13c0 <my_realpath+0x1f0>
cmp    $0x1,%rax
je     13d8 <my_realpath+0x208>
cmpb   $0x2f,0x1e(%rsp,%rax,1)
je     13fa <my_realpath+0x22a>
lea    0x20(%rsp),%rdi
lea    0xc9d(%rip),%rsi
call   10e0 <strcat@plt>
lea    0xc80(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   10e0 <strcat@plt>
lea    0xc5f(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <geteuid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10c0 <delay_signaling@plt>
xor    %edi,%edi
call   10f0 <seteuid@plt>
mov    %rbx,%rdi
lea    0x18(%rsp),%rsi
call   10b0 <stat@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   10f0 <seteuid@plt>
xor    %eax,%eax
call   10d0 <enable_signaling@plt>
cmp    $0xffffffff,%ebx
je     152e <my_realpath+0x35e>
add    $0x1,%r12
mov    0x18(%rsp),%eax
not    %eax
mov    0x2b6f(%rip),%rcx
test   %eax,(%rcx)
je     1478 <my_realpath+0x2a8>
cmpb   $0x0,(%r12)
jne    15ad <my_realpath+0x3dd>
lea    0x50(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1040 <strcpy@plt>
lea    0xbe2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    12f7 <my_realpath+0x127>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     1506 <my_realpath+0x336>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0xbb5(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0x2f,0x50(%rsp)
jne    14f7 <my_realpath+0x327>
cmpb   $0x0,0x51(%rsp)
je     1601 <my_realpath+0x431>
lea    0x51(%rsp),%rsi
xor    %eax,%eax
xchg   %ax,%ax
cmpb   $0x0,(%rbx,%rax,1)
lea    0x1(%rax),%rax
jne    14e0 <my_realpath+0x310>
cmp    $0x1,%rax
je     14f7 <my_realpath+0x327>
cmpb   $0x2f,-0x2(%rbx,%rax,1)
je     14fc <my_realpath+0x32c>
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
jmp    1518 <my_realpath+0x348>
lea    0x50(%rsp),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0xb51(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1601 <my_realpath+0x431>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     1616 <my_realpath+0x446>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0xb20(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0x2f,0x20(%rsp)
jne    15f0 <my_realpath+0x420>
cmpb   $0x0,0x21(%rsp)
je     15ff <my_realpath+0x42f>
lea    0x21(%rsp),%rsi
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rbx,%rax,1)
lea    0x1(%rax),%rax
jne    1580 <my_realpath+0x3b0>
jmp    15e3 <my_realpath+0x413>
lea    0xaea(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %ebx,%edi
call   10f0 <seteuid@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10d0 <enable_signaling@plt>
jmp    1601 <my_realpath+0x431>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     1616 <my_realpath+0x446>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
cmpb   $0x2f,0x20(%rsp)
jne    15f0 <my_realpath+0x420>
cmpb   $0x0,0x21(%rsp)
je     15ff <my_realpath+0x42f>
lea    0x21(%rsp),%rsi
xor    %eax,%eax
cmpb   $0x0,(%rbx,%rax,1)
lea    0x1(%rax),%rax
jne    15d9 <my_realpath+0x409>
cmp    $0x1,%rax
je     15f0 <my_realpath+0x420>
cmpb   $0x2f,-0x2(%rbx,%rax,1)
je     15f5 <my_realpath+0x425>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
jmp    1625 <my_realpath+0x455>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%rsi
mov    0x8(%rsp),%rdi
call   1040 <strcpy@plt>
lea    0xa44(%rip),%rdi
xor    %ebx,%ebx
jmp    151f <my_realpath+0x34f>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@__const.my_realpath.canary = [5 x i8] c"GOOD\00"
@.str = [38 x i8] c"MY_REALPATH: pathname passed in = %s\0A\00"
@.str.1 = [69 x i8] c"strcpy(curpath, pathname):Copying %d bytes into an array of size %d\0A\00"
@.str.2 = [13 x i8] c"canary=[%s]\0A\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"./\00"
@.str.5 = [4 x i8] c"../\00"
@.str.6 = [2 x i8] c"/\00"
@S_IFDIR = global i32 0
define i8* @my_realpath(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.stat
%5 = alloca [5 x i8]
%6 = alloca [46 x i8]
%7 = alloca [46 x i8]
%8 = alloca [46 x i8]
%9 = bitcast %struct.stat* %4 to i8*
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [46 x i8], [46 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [46 x i8], [46 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [46 x i8], [46 x i8]* %8, i64 0, i64 0
%14 = icmp eq i8* %1, null
br i1 %14, label %228, label %15
15: ; preds = %3
%16 = icmp eq i8* %0, null
br i1 %16, label %17, label %18
17: ; preds = %15
store i8 0, i8* %1
br label %228
18: ; preds = %15
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
%20 = tail call i32 @strlen(i8* %0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %20, i64 46)
%22 = call i32 @strcpy(i8* %11, i8* %0)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%24 = load i8, i8* %0
%25 = icmp eq i8 %24, 47
br i1 %25, label %42, label %26
26: ; preds = %18
%27 = call i32 @getcwd(i8* %12, i32 46)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = call i32 (...) @geteuid()
%31 = call i32 (...) @delay_signaling()
%32 = call i32 @seteuid(i32 0)
%33 = call i32 @getcwd(i8* %12, i32 46)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %29
%36 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @seteuid(i32 %30)
%38 = call i32 (...) @enable_signaling()
br label %228
39: ; preds = %29
%40 = call i32 @seteuid(i32 %30)
%41 = call i32 (...) @enable_signaling()
br label %43
42: ; preds = %18
store i8 0, i8* %12
br label %43
43: ; preds = %39, %26, %42
%44 = load i8, i8* %11
%45 = icmp eq i8 %44, 0
br i1 %45, label %194, label %46
46: ; preds = %43
%47 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
br label %48
48: ; preds = %46, %54
%49 = phi i8* [ %11, %46 ], [ %55, %54 ]
%50 = call i32 @strcmp(i8* %49, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = getelementptr inbounds i8, i8* %49, i64 1
br label %54
54: ; preds = %52, %61, %74, %152, %191
%55 = phi i8* [ %105, %152 ], [ %105, %191 ], [ %75, %74 ], [ %62, %61 ], [ %53, %52 ]
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 0
br i1 %57, label %194, label %48
58: ; preds = %48
%59 = call i32 @strncmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = getelementptr inbounds i8, i8* %49, i64 2
br label %54
63: ; preds = %58
%64 = call i32 @strncmp(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %76
66: ; preds = %63, %71
%67 = phi i8* [ %72, %71 ], [ %12, %63 ]
%68 = phi i8* [ %73, %71 ], [ %12, %63 ]
%69 = load i8, i8* %68
switch i8 %69, label %71 [
i8 0, label %74
i8 47, label %70
]
70: ; preds = %66
br label %71
71: ; preds = %66, %70
%72 = phi i8* [ %68, %70 ], [ %67, %66 ]
%73 = getelementptr inbounds i8, i8* %68, i64 1
br label %66
74: ; preds = %66
%75 = getelementptr inbounds i8, i8* %49, i64 3
store i8 0, i8* %67
br label %54
76: ; preds = %63
%77 = call i8* @strchr(i8* %49, i8 signext 47)
%78 = icmp eq i8* %77, null
br i1 %78, label %79, label %84
79: ; preds = %76
%80 = call i32 @strlen(i8* %49)
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %49, i64 -1
%83 = getelementptr inbounds i8, i8* %82, i64 %81
br label %85
84: ; preds = %76
store i8 0, i8* %77
br label %85
85: ; preds = %84, %79
%86 = phi i8* [ %83, %79 ], [ %77, %84 ]
%87 = call i32 @strcpy(i8* %13, i8* %12)
br label %88
88: ; preds = %88, %85
%89 = phi i8* [ %13, %85 ], [ %92, %88 ]
%90 = load i8, i8* %89
%91 = icmp eq i8 %90, 0
%92 = getelementptr inbounds i8, i8* %89, i64 1
br i1 %91, label %93, label %88
93: ; preds = %88
%94 = icmp eq i8* %89, %13
br i1 %94, label %99, label %95
95: ; preds = %93
%96 = getelementptr inbounds i8, i8* %89, i64 -1
%97 = load i8, i8* %96
%98 = icmp eq i8 %97, 47
br i1 %98, label %102, label %99
99: ; preds = %95, %93
%100 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %102
102: ; preds = %99, %95
%103 = call i32 @strcat(i8* %13, i8* %49)
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%105 = getelementptr inbounds i8, i8* %86, i64 1
%106 = call i32 (...) @geteuid()
%107 = call i32 (...) @delay_signaling()
%108 = call i32 @seteuid(i32 0)
%109 = call i32 @stat(i8* %13, %struct.stat* %4)
%110 = call i32 @seteuid(i32 %106)
%111 = call i32 (...) @enable_signaling()
%112 = icmp eq i32 %109, -1
br i1 %112, label %113, label %147
113: ; preds = %102
%114 = icmp eq i8* %2, null
br i1 %114, label %115, label %118
115: ; preds = %113
%116 = call i32 @strcpy(i8* %1, i8* %13)
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
118: ; preds = %113
%119 = call i32 @strcpy(i8* %1, i8* %2)
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%121 = load i8, i8* %13
%122 = icmp eq i8 %121, 47
br i1 %122, label %126, label %123
123: ; preds = %118
%124 = call i32 @strcat(i8* %1, i8* %13)
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
126: ; preds = %118
%127 = getelementptr inbounds [46 x i8], [46 x i8]* %8, i64 0, i64 1
%128 = load i8, i8* %127
%129 = icmp eq i8 %128, 0
br i1 %129, label %228, label %130
130: ; preds = %126, %130
%131 = phi i8* [ %134, %130 ], [ %1, %126 ]
%132 = load i8, i8* %131
%133 = icmp eq i8 %132, 0
%134 = getelementptr inbounds i8, i8* %131, i64 1
br i1 %133, label %135, label %130
135: ; preds = %130
%136 = icmp eq i8* %131, %1
br i1 %136, label %141, label %137
137: ; preds = %135
%138 = getelementptr inbounds i8, i8* %131, i64 -1
%139 = load i8, i8* %138
%140 = icmp eq i8 %139, 47
br i1 %140, label %144, label %141
141: ; preds = %137, %135
%142 = call i32 @strcat(i8* %1, i8* %13)
%143 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
144: ; preds = %137
%145 = call i32 @strcat(i8* %1, i8* %127)
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
147: ; preds = %102
%148 = load i32, i32* %47
%149 = load i32, i32* @S_IFDIR
%150 = and i32 %149, %148
%151 = icmp eq i32 %150, %149
br i1 %151, label %152, label %155
152: ; preds = %147
%153 = call i32 @strcpy(i8* %12, i8* %13)
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %54
155: ; preds = %147
%156 = load i8, i8* %105
%157 = icmp eq i8 %156, 0
br i1 %157, label %191, label %158
158: ; preds = %155
%159 = icmp eq i8* %2, null
br i1 %159, label %160, label %163
160: ; preds = %158
%161 = call i32 @strcpy(i8* %1, i8* %13)
%162 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
163: ; preds = %158
%164 = call i32 @strcpy(i8* %1, i8* %2)
%165 = load i8, i8* %13
%166 = icmp eq i8 %165, 47
br i1 %166, label %170, label %167
167: ; preds = %163
%168 = call i32 @strcat(i8* %1, i8* %13)
%169 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
170: ; preds = %163
%171 = getelementptr inbounds [46 x i8], [46 x i8]* %8, i64 0, i64 1
%172 = load i8, i8* %171
%173 = icmp eq i8 %172, 0
br i1 %173, label %228, label %174
174: ; preds = %170, %174
%175 = phi i8* [ %178, %174 ], [ %1, %170 ]
%176 = load i8, i8* %175
%177 = icmp eq i8 %176, 0
%178 = getelementptr inbounds i8, i8* %175, i64 1
br i1 %177, label %179, label %174
179: ; preds = %174
%180 = icmp eq i8* %175, %1
br i1 %180, label %185, label %181
181: ; preds = %179
%182 = getelementptr inbounds i8, i8* %175, i64 -1
%183 = load i8, i8* %182
%184 = icmp eq i8 %183, 47
br i1 %184, label %188, label %185
185: ; preds = %181, %179
%186 = call i32 @strcat(i8* %1, i8* %13)
%187 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
188: ; preds = %181
%189 = call i32 @strcat(i8* %1, i8* %171)
%190 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
191: ; preds = %155
%192 = call i32 @strcpy(i8* %12, i8* %13)
%193 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %54
194: ; preds = %54, %43
%195 = icmp eq i8* %2, null
br i1 %195, label %196, label %199
196: ; preds = %194
%197 = call i32 @strcpy(i8* %1, i8* %12)
%198 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
199: ; preds = %194
%200 = call i32 @strcpy(i8* %1, i8* %2)
%201 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%202 = load i8, i8* %12
%203 = icmp eq i8 %202, 47
br i1 %203, label %207, label %204
204: ; preds = %199
%205 = call i32 @strcat(i8* %1, i8* %12)
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
207: ; preds = %199
%208 = getelementptr inbounds [46 x i8], [46 x i8]* %7, i64 0, i64 1
%209 = load i8, i8* %208
%210 = icmp eq i8 %209, 0
br i1 %210, label %228, label %211
211: ; preds = %207, %211
%212 = phi i8* [ %215, %211 ], [ %1, %207 ]
%213 = load i8, i8* %212
%214 = icmp eq i8 %213, 0
%215 = getelementptr inbounds i8, i8* %212, i64 1
br i1 %214, label %216, label %211
216: ; preds = %211
%217 = icmp eq i8* %212, %1
br i1 %217, label %222, label %218
218: ; preds = %216
%219 = getelementptr inbounds i8, i8* %212, i64 -1
%220 = load i8, i8* %219
%221 = icmp eq i8 %220, 47
br i1 %221, label %225, label %222
222: ; preds = %218, %216
%223 = call i32 @strcat(i8* %1, i8* %12)
%224 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
225: ; preds = %218
%226 = call i32 @strcat(i8* %1, i8* %208)
%227 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %228
228: ; preds = %196, %207, %225, %222, %204, %160, %170, %188, %185, %167, %115, %126, %144, %141, %123, %35, %3, %17
%229 = phi i8* [ null, %17 ], [ null, %3 ], [ null, %35 ], [ null, %123 ], [ null, %141 ], [ null, %144 ], [ null, %126 ], [ null, %115 ], [ null, %167 ], [ null, %185 ], [ null, %188 ], [ null, %170 ], [ null, %160 ], [ %1, %204 ], [ %1, %222 ], [ %1, %225 ], [ %1, %207 ], [ %1, %196 ]
ret i8* %229
}