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

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct stat {
  int /*<<< orphan*/ member_0;
};
struct dirent {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int chdir(char *);
int chmod(char *, int);
int chown(char *, int, int);
int closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getcwd(char *, int);
int getxattr(char *, char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int listxattr(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int mkdir(char *, int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int removexattr(char *, char *);
int rename(char *, char *);
int rmdir(char *);
int setxattr(char *, char *, char *, int, int /*<<< orphan*/);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int dir_based_fops(char *dirname) {
  int ret = -1;
  int result = 0;
  DIR *dp = NULL;
  char buff[255] = {
      0,
  };
  struct dirent *dbuff = {
      0,
  };
  struct stat stbuff = {
      0,
  };
  char newdname[255] = {
      0,
  };
  char *cwd = NULL;
  ret = mkdir(dirname, 0755);
  if (ret < 0) {
    fprintf(stderr, "mkdir failed: %s\n", strerror(errno));
    return ret;
  }
  dp = opendir(dirname);
  if (dp == NULL) {
    fprintf(stderr, "opendir failed: %s\n", strerror(errno));
    result |= ret;
  }
  dbuff = readdir(dp);
  if (NULL == dbuff) {
    fprintf(stderr, "readdir failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = closedir(dp);
  if (ret < 0) {
    fprintf(stderr, "closedir failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = stat(dirname, &stbuff);
  if (ret < 0) {
    fprintf(stderr, "stat failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = chmod(dirname, 0744);
  if (ret < 0) {
    fprintf(stderr, "chmod failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = chown(dirname, 10001, 10001);
  if (ret < 0) {
    fprintf(stderr, "chmod failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = setxattr(dirname, "trusted.xattr-test", "working", 8, 0);
  if (ret < 0) {
    fprintf(stderr, "setxattr failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = listxattr(dirname, NULL, 0);
  if (ret <= 0) {
    ret = -1;
    fprintf(stderr, "listxattr failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = getxattr(dirname, "trusted.xattr-test", NULL, 0);
  if (ret <= 0) {
    ret = -1;
    fprintf(stderr, "getxattr failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = removexattr(dirname, "trusted.xattr-test");
  if (ret < 0) {
    fprintf(stderr, "removexattr failed: %s\n", strerror(errno));
    result |= ret;
  }
  strcpy(newdname, dirname);
  strcat(newdname, "/../");
  ret = chdir(newdname);
  if (ret < 0) {
    fprintf(stderr, "chdir failed: %s\n", strerror(errno));
    result |= ret;
  }
  cwd = getcwd(buff, 255);
  if (NULL == cwd) {
    fprintf(stderr, "getcwd failed: %s\n", strerror(errno));
    result |= ret;
  }
  strcpy(newdname, dirname);
  strcat(newdname, "new");
  ret = rename(dirname, newdname);
  if (ret < 0) {
    fprintf(stderr, "rename failed: %s\n", strerror(errno));
    result |= ret;
  }
  ret = rmdir(newdname);
  if (ret < 0) {
    fprintf(stderr, "rmdir failed: %s\n", strerror(errno));
    result |= ret;
  }
  rmdir(dirname);
  return result;
}


x86 assembly (clang, -O0):
<dir_based_fops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1090 <memset@plt>
movq   $0x0,-0x128(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1090 <memset@plt>
lea    -0x230(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1090 <memset@plt>
movq   $0x0,-0x238(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    130c <dir_based_fops+0xcc>
mov    0x2d0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x23c(%rbp)
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x23c(%rbp),%edi
mov    %rax,%rdx
lea    0xd04(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1849 <dir_based_fops+0x609>
mov    -0x10(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    135f <dir_based_fops+0x11f>
mov    0x2cb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x240(%rbp)
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x240(%rbp),%edi
mov    %rax,%rdx
lea    0xcc1(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   10e0 <readdir@plt>
mov    %rax,-0x128(%rbp)
xor    %eax,%eax
cmp    -0x128(%rbp),%rax
jne    13b9 <dir_based_fops+0x179>
mov    0x2c5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x244(%rbp)
mov    0x2c44(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x244(%rbp),%edi
mov    %rax,%rdx
lea    0xc7b(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   10b0 <closedir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    140a <dir_based_fops+0x1ca>
mov    0x2c0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x248(%rbp)
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x248(%rbp),%edi
mov    %rax,%rdx
lea    0xc3e(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   10d0 <stat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1462 <dir_based_fops+0x222>
mov    0x2bb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24c(%rbp)
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x24c(%rbp),%edi
mov    %rax,%rdx
lea    0xbfb(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1e4,%esi
call   1100 <chmod@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    14b8 <dir_based_fops+0x278>
mov    0x2b5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x250(%rbp)
mov    0x2b45(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x250(%rbp),%edi
mov    %rax,%rdx
lea    0xbb6(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2711,%edx
mov    %edx,%esi
call   10f0 <chown@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1510 <dir_based_fops+0x2d0>
mov    0x2b04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x254(%rbp)
mov    0x2aed(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x254(%rbp),%edi
mov    %rax,%rdx
lea    0xb5e(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xb57(%rip),%rsi
lea    0xb63(%rip),%rdx
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1150 <setxattr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1577 <dir_based_fops+0x337>
mov    0x2a9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x258(%rbp)
mov    0x2a86(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x258(%rbp),%edi
mov    %rax,%rdx
lea    0xb24(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <listxattr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     15d5 <dir_based_fops+0x395>
movl   $0xffffffff,-0x14(%rbp)
mov    0x2a3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x25c(%rbp)
mov    0x2a28(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x25c(%rbp),%edi
mov    %rax,%rdx
lea    0xadb(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xa92(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1140 <getxattr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     163a <dir_based_fops+0x3fa>
movl   $0xffffffff,-0x14(%rbp)
mov    0x29da(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x260(%rbp)
mov    0x29c3(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x260(%rbp),%edi
mov    %rax,%rdx
lea    0xa8c(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xa2d(%rip),%rsi
call   1110 <removexattr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1692 <dir_based_fops+0x452>
mov    0x2982(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x264(%rbp)
mov    0x296b(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x264(%rbp),%edi
mov    %rax,%rdx
lea    0xa49(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x230(%rbp),%rdi
lea    0xa35(%rip),%rsi
call   1130 <strcat@plt>
lea    -0x230(%rbp),%rdi
call   1080 <chdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1709 <dir_based_fops+0x4c9>
mov    0x290b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x268(%rbp)
mov    0x28f4(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x268(%rbp),%edi
mov    %rax,%rdx
lea    0x9ef(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    $0xff,%esi
call   10a0 <getcwd@plt>
mov    %rax,-0x238(%rbp)
xor    %eax,%eax
cmp    -0x238(%rbp),%rax
jne    176b <dir_based_fops+0x52b>
mov    0x28a9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x26c(%rbp)
mov    0x2892(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x26c(%rbp),%edi
mov    %rax,%rdx
lea    0x99f(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x230(%rbp),%rdi
lea    0x986(%rip),%rsi
call   1130 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1120 <rename@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    17e6 <dir_based_fops+0x5a6>
mov    0x282e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x270(%rbp)
mov    0x2817(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x270(%rbp),%edi
mov    %rax,%rdx
lea    0x93b(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x230(%rbp),%rdi
call   1070 <rmdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    183a <dir_based_fops+0x5fa>
mov    0x27da(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x274(%rbp)
mov    0x27c3(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x274(%rbp),%edi
mov    %rax,%rdx
lea    0x8fa(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <rmdir@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_based_fops>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x218,%rsp
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movups %xmm0,0x1ff(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movl   $0x0,0x8(%rsp)
movups %xmm0,0xff(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
mov    %eax,%ebp
test   %eax,%eax
js     170b <dir_based_fops+0x4db>
mov    %r14,%rdi
call   1050 <opendir@plt>
mov    %rax,%rbx
xor    %r15d,%r15d
test   %rax,%rax
jne    138a <dir_based_fops+0x15a>
mov    0x2c7c(%rip),%rax
mov    (%rax),%r15d
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xc96(%rip),%rsi
mov    %r15d,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    %ebp,%r15d
mov    %rbx,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
jne    13c4 <dir_based_fops+0x194>
mov    0x2c42(%rip),%rax
mov    (%rax),%r15d
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xc70(%rip),%rsi
mov    %r15d,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    %ebp,%r15d
mov    %rbx,%rdi
call   10a0 <closedir@plt>
test   %eax,%eax
jns    13fd <dir_based_fops+0x1cd>
mov    %eax,%ebx
mov    0x2c07(%rip),%rax
mov    (%rax),%ebp
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xc4a(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   10c0 <stat@plt>
test   %eax,%eax
jns    143b <dir_based_fops+0x20b>
mov    %eax,%ebx
mov    0x2bc9(%rip),%rax
mov    (%rax),%ebp
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xc21(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
mov    %r14,%rdi
mov    $0x1e4,%esi
call   10f0 <chmod@plt>
test   %eax,%eax
jns    1479 <dir_based_fops+0x249>
mov    %eax,%ebx
mov    0x2b8b(%rip),%rax
mov    (%rax),%ebp
mov    0x2b7a(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xbf4(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
mov    %r14,%rdi
mov    $0x2711,%esi
mov    $0x2711,%edx
call   10e0 <chown@plt>
test   %eax,%eax
jns    14bc <dir_based_fops+0x28c>
mov    %eax,%ebx
mov    0x2b48(%rip),%rax
mov    (%rax),%ebp
mov    0x2b37(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xbb1(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0xbaf(%rip),%rsi
lea    0xbbb(%rip),%rdx
mov    %r14,%rdi
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1140 <setxattr@plt>
test   %eax,%eax
jns    150b <dir_based_fops+0x2db>
mov    %eax,%ebx
mov    0x2af9(%rip),%rax
mov    (%rax),%ebp
mov    0x2ae8(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xb8f(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <listxattr@plt>
test   %eax,%eax
jg     1549 <dir_based_fops+0x319>
mov    0x2abe(%rip),%rax
mov    (%rax),%ebx
mov    0x2aad(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xb69(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    $0xffffffff,%r15d
lea    0xb22(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1130 <getxattr@plt>
test   %eax,%eax
jg     158e <dir_based_fops+0x35e>
mov    0x2a79(%rip),%rax
mov    (%rax),%ebx
mov    0x2a68(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xb3a(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    $0xffffffff,%r15d
lea    0xadd(%rip),%rsi
mov    %r14,%rdi
call   1100 <removexattr@plt>
test   %eax,%eax
jns    15ce <dir_based_fops+0x39e>
mov    %eax,%ebx
mov    0x2a36(%rip),%rax
mov    (%rax),%ebp
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xb0c(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xb00(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strcat@plt>
mov    %rbx,%rdi
call   1080 <chdir@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1626 <dir_based_fops+0x3f6>
mov    0x29de(%rip),%rax
mov    (%rax),%ebp
mov    0x29cd(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xad1(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0x110(%rsp),%rdi
mov    $0xff,%esi
call   1090 <getcwd@plt>
test   %rax,%rax
jne    1668 <dir_based_fops+0x438>
mov    0x299c(%rip),%rax
mov    (%rax),%ebp
mov    0x298b(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xaa1(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xa90(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1110 <rename@plt>
test   %eax,%eax
jns    16c3 <dir_based_fops+0x493>
mov    %eax,%ebx
mov    0x2941(%rip),%rax
mov    (%rax),%ebp
mov    0x2930(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xa5d(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
lea    0x10(%rsp),%rdi
call   1070 <rmdir@plt>
test   %eax,%eax
jns    16fe <dir_based_fops+0x4ce>
mov    %eax,%ebx
mov    0x2906(%rip),%rax
mov    (%rax),%ebp
mov    0x28f5(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xa35(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
or     %ebx,%r15d
mov    %r14,%rdi
call   1070 <rmdir@plt>
mov    %r15d,%ebp
jmp    1733 <dir_based_fops+0x503>
mov    0x28ce(%rip),%rax
mov    (%rax),%ebx
mov    0x28bd(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0x8d7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    %ebp,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"mkdir failed: %s\0A\00"
@errno = global i32 0
@.str.1 = [20 x i8] c"opendir failed: %s\0A\00"
@.str.2 = [20 x i8] c"readdir failed: %s\0A\00"
@.str.3 = [21 x i8] c"closedir failed: %s\0A\00"
@.str.4 = [17 x i8] c"stat failed: %s\0A\00"
@.str.5 = [18 x i8] c"chmod failed: %s\0A\00"
@.str.6 = [19 x i8] c"trusted.xattr-test\00"
@.str.7 = [8 x i8] c"working\00"
@.str.8 = [21 x i8] c"setxattr failed: %s\0A\00"
@.str.9 = [22 x i8] c"listxattr failed: %s\0A\00"
@.str.10 = [21 x i8] c"getxattr failed: %s\0A\00"
@.str.11 = [24 x i8] c"removexattr failed: %s\0A\00"
@.str.12 = [5 x i8] c"/../\00"
@.str.13 = [18 x i8] c"chdir failed: %s\0A\00"
@.str.14 = [19 x i8] c"getcwd failed: %s\0A\00"
@.str.15 = [4 x i8] c"new\00"
@.str.16 = [19 x i8] c"rename failed: %s\0A\00"
@.str.17 = [18 x i8] c"rmdir failed: %s\0A\00"
define i32 @dir_based_fops(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [255 x i8]
%8 = alloca %struct.dirent*
%9 = alloca %struct.stat
%10 = alloca [255 x i8]
%11 = alloca i8*
store i8* %0, i8** %3
store i32 -1, i32* %4
store i32 0, i32* %5
store i32* null, i32** %6
%12 = bitcast [255 x i8]* %7 to i8*
store %struct.dirent* null, %struct.dirent** %8
%13 = bitcast %struct.stat* %9 to i8*
%14 = bitcast [255 x i8]* %10 to i8*
store i8* null, i8** %11
%15 = load i8*, i8** %3
%16 = call i32 @mkdir(i8* %15, i32 493)
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = call i8* @strerror(i32 %21)
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %4
store i32 %24, i32* %2
br label %222
25: ; preds = %1
%26 = load i8*, i8** %3
%27 = call i32* @opendir(i8* %26)
store i32* %27, i32** %6
%28 = load i32*, i32** %6
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %38
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = or i32 %36, %35
store i32 %37, i32* %5
br label %38
38: ; preds = %30, %25
%39 = load i32*, i32** %6
%40 = call %struct.dirent* @readdir(i32* %39)
store %struct.dirent* %40, %struct.dirent** %8
%41 = load %struct.dirent*, %struct.dirent** %8
%42 = icmp eq %struct.dirent* null, %41
br i1 %42, label %43, label %51
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = or i32 %49, %48
store i32 %50, i32* %5
br label %51
51: ; preds = %43, %38
%52 = load i32*, i32** %6
%53 = call i32 @closedir(i32* %52)
store i32 %53, i32* %4
%54 = load i32, i32* %4
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %64
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%61 = load i32, i32* %4
%62 = load i32, i32* %5
%63 = or i32 %62, %61
store i32 %63, i32* %5
br label %64
64: ; preds = %56, %51
%65 = load i8*, i8** %3
%66 = call i32 @stat(i8* %65, %struct.stat* %9)
store i32 %66, i32* %4
%67 = load i32, i32* %4
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %77
69: ; preds = %64
%70 = load i32, i32* @stderr
%71 = load i32, i32* @errno
%72 = call i8* @strerror(i32 %71)
%73 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %72)
%74 = load i32, i32* %4
%75 = load i32, i32* %5
%76 = or i32 %75, %74
store i32 %76, i32* %5
br label %77
77: ; preds = %69, %64
%78 = load i8*, i8** %3
%79 = call i32 @chmod(i8* %78, i32 484)
store i32 %79, i32* %4
%80 = load i32, i32* %4
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %77
%83 = load i32, i32* @stderr
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %85)
%87 = load i32, i32* %4
%88 = load i32, i32* %5
%89 = or i32 %88, %87
store i32 %89, i32* %5
br label %90
90: ; preds = %82, %77
%91 = load i8*, i8** %3
%92 = call i32 @chown(i8* %91, i32 10001, i32 10001)
store i32 %92, i32* %4
%93 = load i32, i32* %4
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %103
95: ; preds = %90
%96 = load i32, i32* @stderr
%97 = load i32, i32* @errno
%98 = call i8* @strerror(i32 %97)
%99 = call i32 @fprintf(i32 %96, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %98)
%100 = load i32, i32* %4
%101 = load i32, i32* %5
%102 = or i32 %101, %100
store i32 %102, i32* %5
br label %103
103: ; preds = %95, %90
%104 = load i8*, i8** %3
%105 = call i32 @setxattr(i8* %104, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 8, i32 0)
store i32 %105, i32* %4
%106 = load i32, i32* %4
%107 = icmp slt i32 %106, 0
br i1 %107, label %108, label %116
108: ; preds = %103
%109 = load i32, i32* @stderr
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %111)
%113 = load i32, i32* %4
%114 = load i32, i32* %5
%115 = or i32 %114, %113
store i32 %115, i32* %5
br label %116
116: ; preds = %108, %103
%117 = load i8*, i8** %3
%118 = call i32 @listxattr(i8* %117, i32* null, i32 0)
store i32 %118, i32* %4
%119 = load i32, i32* %4
%120 = icmp sle i32 %119, 0
br i1 %120, label %121, label %129
121: ; preds = %116
store i32 -1, i32* %4
%122 = load i32, i32* @stderr
%123 = load i32, i32* @errno
%124 = call i8* @strerror(i32 %123)
%125 = call i32 @fprintf(i32 %122, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %124)
%126 = load i32, i32* %4
%127 = load i32, i32* %5
%128 = or i32 %127, %126
store i32 %128, i32* %5
br label %129
129: ; preds = %121, %116
%130 = load i8*, i8** %3
%131 = call i32 @getxattr(i8* %130, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* null, i32 0)
store i32 %131, i32* %4
%132 = load i32, i32* %4
%133 = icmp sle i32 %132, 0
br i1 %133, label %134, label %142
134: ; preds = %129
store i32 -1, i32* %4
%135 = load i32, i32* @stderr
%136 = load i32, i32* @errno
%137 = call i8* @strerror(i32 %136)
%138 = call i32 @fprintf(i32 %135, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %137)
%139 = load i32, i32* %4
%140 = load i32, i32* %5
%141 = or i32 %140, %139
store i32 %141, i32* %5
br label %142
142: ; preds = %134, %129
%143 = load i8*, i8** %3
%144 = call i32 @removexattr(i8* %143, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i32 %144, i32* %4
%145 = load i32, i32* %4
%146 = icmp slt i32 %145, 0
br i1 %146, label %147, label %155
147: ; preds = %142
%148 = load i32, i32* @stderr
%149 = load i32, i32* @errno
%150 = call i8* @strerror(i32 %149)
%151 = call i32 @fprintf(i32 %148, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %150)
%152 = load i32, i32* %4
%153 = load i32, i32* %5
%154 = or i32 %153, %152
store i32 %154, i32* %5
br label %155
155: ; preds = %147, %142
%156 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%157 = load i8*, i8** %3
%158 = call i32 @strcpy(i8* %156, i8* %157)
%159 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%160 = call i32 @strcat(i8* %159, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%161 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%162 = call i32 @chdir(i8* %161)
store i32 %162, i32* %4
%163 = load i32, i32* %4
%164 = icmp slt i32 %163, 0
br i1 %164, label %165, label %173
165: ; preds = %155
%166 = load i32, i32* @stderr
%167 = load i32, i32* @errno
%168 = call i8* @strerror(i32 %167)
%169 = call i32 @fprintf(i32 %166, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i8* %168)
%170 = load i32, i32* %4
%171 = load i32, i32* %5
%172 = or i32 %171, %170
store i32 %172, i32* %5
br label %173
173: ; preds = %165, %155
%174 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%175 = call i8* @getcwd(i8* %174, i32 255)
store i8* %175, i8** %11
%176 = load i8*, i8** %11
%177 = icmp eq i8* null, %176
br i1 %177, label %178, label %186
178: ; preds = %173
%179 = load i32, i32* @stderr
%180 = load i32, i32* @errno
%181 = call i8* @strerror(i32 %180)
%182 = call i32 @fprintf(i32 %179, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i8* %181)
%183 = load i32, i32* %4
%184 = load i32, i32* %5
%185 = or i32 %184, %183
store i32 %185, i32* %5
br label %186
186: ; preds = %178, %173
%187 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%188 = load i8*, i8** %3
%189 = call i32 @strcpy(i8* %187, i8* %188)
%190 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%191 = call i32 @strcat(i8* %190, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%192 = load i8*, i8** %3
%193 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%194 = call i32 @rename(i8* %192, i8* %193)
store i32 %194, i32* %4
%195 = load i32, i32* %4
%196 = icmp slt i32 %195, 0
br i1 %196, label %197, label %205
197: ; preds = %186
%198 = load i32, i32* @stderr
%199 = load i32, i32* @errno
%200 = call i8* @strerror(i32 %199)
%201 = call i32 @fprintf(i32 %198, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i8* %200)
%202 = load i32, i32* %4
%203 = load i32, i32* %5
%204 = or i32 %203, %202
store i32 %204, i32* %5
br label %205
205: ; preds = %197, %186
%206 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%207 = call i32 @rmdir(i8* %206)
store i32 %207, i32* %4
%208 = load i32, i32* %4
%209 = icmp slt i32 %208, 0
br i1 %209, label %210, label %218
210: ; preds = %205
%211 = load i32, i32* @stderr
%212 = load i32, i32* @errno
%213 = call i8* @strerror(i32 %212)
%214 = call i32 @fprintf(i32 %211, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* %213)
%215 = load i32, i32* %4
%216 = load i32, i32* %5
%217 = or i32 %216, %215
store i32 %217, i32* %5
br label %218
218: ; preds = %210, %205
%219 = load i8*, i8** %3
%220 = call i32 @rmdir(i8* %219)
%221 = load i32, i32* %5
store i32 %221, i32* %2
br label %222
222: ; preds = %218, %19
%223 = load i32, i32* %2
ret i32 %223
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"mkdir failed: %s\0A\00"
@errno = global i32 0
@.str.1 = [20 x i8] c"opendir failed: %s\0A\00"
@.str.2 = [20 x i8] c"readdir failed: %s\0A\00"
@.str.3 = [21 x i8] c"closedir failed: %s\0A\00"
@.str.4 = [17 x i8] c"stat failed: %s\0A\00"
@.str.5 = [18 x i8] c"chmod failed: %s\0A\00"
@.str.6 = [19 x i8] c"trusted.xattr-test\00"
@.str.7 = [8 x i8] c"working\00"
@.str.8 = [21 x i8] c"setxattr failed: %s\0A\00"
@.str.9 = [22 x i8] c"listxattr failed: %s\0A\00"
@.str.10 = [21 x i8] c"getxattr failed: %s\0A\00"
@.str.11 = [24 x i8] c"removexattr failed: %s\0A\00"
@.str.12 = [5 x i8] c"/../\00"
@.str.13 = [18 x i8] c"chdir failed: %s\0A\00"
@.str.14 = [19 x i8] c"getcwd failed: %s\0A\00"
@.str.15 = [4 x i8] c"new\00"
@.str.16 = [19 x i8] c"rename failed: %s\0A\00"
@.str.17 = [18 x i8] c"rmdir failed: %s\0A\00"
define i32 @dir_based_fops(i8* %0) {
%2 = alloca [255 x i8]
%3 = alloca %struct.stat
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.stat* %3 to i8*
%7 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
store i32 0, i32* %7
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @mkdir(i8* %0, i32 493)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = tail call i8* @strerror(i32 %13)
%15 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %158
16: ; preds = %1
%17 = tail call i32* @opendir(i8* %0)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = tail call i8* @strerror(i32 %21)
%23 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %19, %16
%25 = phi i32 [ %9, %19 ], [ 0, %16 ]
%26 = tail call %struct.dirent* @readdir(i32* %17)
%27 = icmp eq %struct.dirent* %26, null
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = load i32, i32* @errno
%31 = tail call i8* @strerror(i32 %30)
%32 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %28, %24
%34 = phi i32 [ %9, %28 ], [ %25, %24 ]
%35 = tail call i32 @closedir(i32* %17)
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = load i32, i32* @errno
%40 = tail call i8* @strerror(i32 %39)
%41 = tail call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = or i32 %35, %34
br label %43
43: ; preds = %37, %33
%44 = phi i32 [ %42, %37 ], [ %34, %33 ]
%45 = call i32 @stat(i8* %0, %struct.stat* %3)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = tail call i8* @strerror(i32 %49)
%51 = tail call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %50)
%52 = or i32 %45, %44
br label %53
53: ; preds = %47, %43
%54 = phi i32 [ %52, %47 ], [ %44, %43 ]
%55 = tail call i32 @chmod(i8* %0, i32 484)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = load i32, i32* @errno
%60 = tail call i8* @strerror(i32 %59)
%61 = tail call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %60)
%62 = or i32 %55, %54
br label %63
63: ; preds = %57, %53
%64 = phi i32 [ %62, %57 ], [ %54, %53 ]
%65 = tail call i32 @chown(i8* %0, i32 10001, i32 10001)
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = load i32, i32* @errno
%70 = tail call i8* @strerror(i32 %69)
%71 = tail call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %70)
%72 = or i32 %65, %64
br label %73
73: ; preds = %67, %63
%74 = phi i32 [ %72, %67 ], [ %64, %63 ]
%75 = tail call i32 @setxattr(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 8, i32 0)
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %73
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = tail call i8* @strerror(i32 %79)
%81 = tail call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %80)
%82 = or i32 %75, %74
br label %83
83: ; preds = %77, %73
%84 = phi i32 [ %82, %77 ], [ %74, %73 ]
%85 = tail call i32 @listxattr(i8* %0, i32* null, i32 0)
%86 = icmp slt i32 %85, 1
br i1 %86, label %87, label %92
87: ; preds = %83
%88 = load i32, i32* @stderr
%89 = load i32, i32* @errno
%90 = tail call i8* @strerror(i32 %89)
%91 = tail call i32 @fprintf(i32 %88, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %90)
br label %92
92: ; preds = %87, %83
%93 = phi i32 [ -1, %87 ], [ %84, %83 ]
%94 = tail call i32 @getxattr(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32* null, i32 0)
%95 = icmp slt i32 %94, 1
br i1 %95, label %96, label %101
96: ; preds = %92
%97 = load i32, i32* @stderr
%98 = load i32, i32* @errno
%99 = tail call i8* @strerror(i32 %98)
%100 = tail call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %99)
br label %101
101: ; preds = %96, %92
%102 = phi i32 [ -1, %96 ], [ %93, %92 ]
%103 = tail call i32 @removexattr(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%104 = icmp slt i32 %103, 0
br i1 %104, label %105, label %111
105: ; preds = %101
%106 = load i32, i32* @stderr
%107 = load i32, i32* @errno
%108 = tail call i8* @strerror(i32 %107)
%109 = tail call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %108)
%110 = or i32 %103, %102
br label %111
111: ; preds = %105, %101
%112 = phi i32 [ %110, %105 ], [ %102, %101 ]
%113 = call i32 @strcpy(i8* %8, i8* %0)
%114 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%115 = call i32 @chdir(i8* %8)
%116 = icmp slt i32 %115, 0
br i1 %116, label %117, label %123
117: ; preds = %111
%118 = load i32, i32* @stderr
%119 = load i32, i32* @errno
%120 = call i8* @strerror(i32 %119)
%121 = call i32 @fprintf(i32 %118, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i8* %120)
%122 = or i32 %115, %112
br label %123
123: ; preds = %117, %111
%124 = phi i32 [ %122, %117 ], [ %112, %111 ]
%125 = call i8* @getcwd(i8* %5, i32 255)
%126 = icmp eq i8* %125, null
br i1 %126, label %127, label %133
127: ; preds = %123
%128 = load i32, i32* @stderr
%129 = load i32, i32* @errno
%130 = call i8* @strerror(i32 %129)
%131 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i8* %130)
%132 = or i32 %124, %115
br label %133
133: ; preds = %127, %123
%134 = phi i32 [ %132, %127 ], [ %124, %123 ]
%135 = call i32 @strcpy(i8* %8, i8* %0)
%136 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%137 = call i32 @rename(i8* %0, i8* %8)
%138 = icmp slt i32 %137, 0
br i1 %138, label %139, label %145
139: ; preds = %133
%140 = load i32, i32* @stderr
%141 = load i32, i32* @errno
%142 = call i8* @strerror(i32 %141)
%143 = call i32 @fprintf(i32 %140, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i8* %142)
%144 = or i32 %137, %134
br label %145
145: ; preds = %139, %133
%146 = phi i32 [ %144, %139 ], [ %134, %133 ]
%147 = call i32 @rmdir(i8* %8)
%148 = icmp slt i32 %147, 0
br i1 %148, label %149, label %155
149: ; preds = %145
%150 = load i32, i32* @stderr
%151 = load i32, i32* @errno
%152 = call i8* @strerror(i32 %151)
%153 = call i32 @fprintf(i32 %150, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* %152)
%154 = or i32 %147, %146
br label %155
155: ; preds = %149, %145
%156 = phi i32 [ %154, %149 ], [ %146, %145 ]
%157 = call i32 @rmdir(i8* %0)
br label %158
158: ; preds = %155, %11
%159 = phi i32 [ %9, %11 ], [ %156, %155 ]
ret i32 %159
}