#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_size;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ link;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int PATH_MAX;
int S_IRUSR;
int S_IWUSR;
scalar_t__ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ lstat(char *, struct stat *);
int open(char *, int, int);
scalar_t__ readlink(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
scalar_t__ symlink(char *, char *);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char **argv) {
  char link[PATH_MAX];
  char buf[PATH_MAX];
  struct stat statbuf;
  int rc = (0);
  int fd;
  ssize_t n;
  if (argc < 2) {
    fprintf(stderr, "Usage: filename\n");
    exit((2));
  }
  if ((fd = open(argv[1], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) {
    fprintf(stderr, "cannot create %s : %s\n", argv[1], strerror(errno));
    exit((2));
  }
  if (close(fd) < 0) {
    fprintf(stderr, "close failed %s: %s\n", argv[1], strerror(errno));
    rc = (2);
    goto tidy_file;
  }
  snprintf(link, sizeof(link), "%s-symlink", argv[1]);
  if (symlink(argv[1], link) < 0) {
    fprintf(stderr, "symlink failed %s: %s\n", argv[1], strerror(errno));
    rc = (2);
    goto tidy_file;
  }
  n = readlink(link, buf, sizeof(buf));
  if (n < 0) {
    fprintf(stderr, "readlink failed %s: %s\n", argv[1], strerror(errno));
    rc = (2);
    goto tidy_symlink;
  }
  if (lstat(link, &statbuf) < 0) {
    fprintf(stderr, "lstat failed %s: %s\n", argv[1], strerror(errno));
    rc = (2);
    goto tidy_symlink;
  }
  if (statbuf.st_size != n)
    rc = (1);
tidy_symlink:
  unlink(link);
tidy_file:
  unlink(argv[1]);
  exit(rc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e28(%rip),%rax
mov    (%rax),%ecx
mov    %rcx,-0x60(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x58(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x20(%rbp)
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    123d <main+0x9d>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dac(%rip),%rax
mov    (%rax),%esi
mov    0x2d83(%rip),%rax
or     (%rax),%esi
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
mov    0x2d69(%rip),%rax
or     (%rax),%edx
call   10a0 <open@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jge    12c2 <main+0x122>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd60(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    -0x38(%rbp),%edi
call   1070 <close@plt>
cmp    $0x0,%rax
jge    131e <main+0x17e>
mov    0x2ce5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xd1d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x34(%rbp)
jmp    14b5 <main+0x315>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd06(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x58(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <symlink@plt>
cmp    $0x0,%rax
jge    13ad <main+0x20d>
mov    0x2c62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %rax,%rcx
lea    0xcae(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x34(%rbp)
jmp    14b5 <main+0x315>
mov    -0x48(%rbp),%rsi
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    %eax,%edx
call   1040 <readlink@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    1425 <main+0x285>
mov    0x2bea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rdx
mov    %rax,%rcx
lea    0xc4d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x34(%rbp)
jmp    14ac <main+0x30c>
mov    -0x58(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <lstat@plt>
cmp    $0x0,%rax
jge    1492 <main+0x2f2>
mov    0x2b7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2b57(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %rax,%rcx
lea    0xbf8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x34(%rbp)
jmp    14ac <main+0x30c>
mov    -0x30(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     14a7 <main+0x307>
movl   $0x1,-0x34(%rbp)
jmp    14ac <main+0x30c>
mov    -0x58(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unlink@plt>
mov    -0x34(%rbp),%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e32(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%r12
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x1,%edi
jg     11f9 <main+0x59>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
mov    0x2df1(%rip),%rax
mov    0x2dca(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d97(%rip),%rax
mov    0x2db0(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
call   10a0 <open@plt>
test   %eax,%eax
jns    1268 <main+0xc8>
mov    0x2d8c(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%r14
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xdc2(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    %eax,%edi
call   1070 <close@plt>
test   %rax,%rax
jns    1298 <main+0xf8>
mov    0x2d45(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%r15
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd92(%rip),%rsi
jmp    12e1 <main+0x141>
mov    0x8(%r14),%rcx
lea    0xd9a(%rip),%rdx
mov    %r12,%rdi
mov    %r15d,%esi
call   1060 <snprintf@plt>
mov    0x8(%r14),%rdi
mov    %r12,%rsi
call   1050 <symlink@plt>
test   %rax,%rax
jns    12fa <main+0x15a>
mov    0x2cfa(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%r15
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd67(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebx
jmp    138e <main+0x1ee>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1040 <readlink@plt>
test   %rax,%rax
jns    1331 <main+0x191>
mov    0x2cac(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%r15
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd30(%rip),%rsi
jmp    1367 <main+0x1c7>
mov    %rax,%r15
lea    -0x28(%rbp),%rsi
mov    %r12,%rdi
call   1080 <lstat@plt>
test   %rax,%rax
jns    137d <main+0x1dd>
mov    0x2c74(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%r15
mov    0x2c5f(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd10(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebx
jmp    1386 <main+0x1e6>
xor    %ebx,%ebx
cmp    %r15,-0x28(%rbp)
setne  %bl
mov    %r12,%rdi
call   1030 <unlink@plt>
mov    0x8(%r14),%rdi
call   1030 <unlink@plt>
mov    %ebx,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
@PATH_MAX = global i32 0
@stderr = global i32 0
@.str = [17 x i8] c"Usage: filename\0A\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [23 x i8] c"cannot create %s : %s\0A\00"
@errno = global i32 0
@.str.2 = [21 x i8] c"close failed %s: %s\0A\00"
@.str.3 = [11 x i8] c"%s-symlink\00"
@.str.4 = [23 x i8] c"symlink failed %s: %s\0A\00"
@.str.5 = [24 x i8] c"readlink failed %s: %s\0A\00"
@.str.6 = [21 x i8] c"lstat failed %s: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca %struct.stat
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @PATH_MAX
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %6
%16 = alloca i8, i64 %14
store i64 %14, i64* %7
%17 = load i32, i32* @PATH_MAX
%18 = zext i32 %17 to i64
%19 = alloca i8, i64 %18
store i64 %18, i64* %8
store i32 0, i32* %10
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 2)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i32, i32* @O_CREAT
%31 = load i32, i32* @O_RDWR
%32 = or i32 %30, %31
%33 = load i32, i32* @S_IRUSR
%34 = load i32, i32* @S_IWUSR
%35 = or i32 %33, %34
%36 = call i32 @open(i8* %29, i32 %32, i32 %35)
store i32 %36, i32* %11
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %26
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = load i32, i32* @errno
%44 = call i8* @strerror(i32 %43)
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %42, i8* %44)
%46 = call i32 @exit(i32 2)
unreachable
47: ; preds = %26
%48 = load i32, i32* %11
%49 = call i64 @close(i32 %48)
%50 = icmp slt i64 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = load i32, i32* @stderr
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %55, i8* %57)
store i32 2, i32* %10
br label %111
59: ; preds = %47
%60 = trunc i64 %14 to i32
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = call i32 @snprintf(i8* %16, i32 %60, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %63)
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = call i64 @symlink(i8* %67, i8* %16)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %78
70: ; preds = %59
%71 = load i32, i32* @stderr
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %74, i8* %76)
store i32 2, i32* %10
br label %111
78: ; preds = %59
%79 = trunc i64 %18 to i32
%80 = call i64 @readlink(i8* %16, i8* %19, i32 %79)
store i64 %80, i64* %12
%81 = load i64, i64* %12
%82 = icmp slt i64 %81, 0
br i1 %82, label %83, label %91
83: ; preds = %78
%84 = load i32, i32* @stderr
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = load i32, i32* @errno
%89 = call i8* @strerror(i32 %88)
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %87, i8* %89)
store i32 2, i32* %10
br label %109
91: ; preds = %78
%92 = call i64 @lstat(i8* %16, %struct.stat* %9)
%93 = icmp slt i64 %92, 0
br i1 %93, label %94, label %102
94: ; preds = %91
%95 = load i32, i32* @stderr
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 1
%98 = load i8*, i8** %97
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %98, i8* %100)
store i32 2, i32* %10
br label %109
102: ; preds = %91
%103 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%104 = load i64, i64* %103
%105 = load i64, i64* %12
%106 = icmp ne i64 %104, %105
br i1 %106, label %107, label %108
107: ; preds = %102
store i32 1, i32* %10
br label %108
108: ; preds = %107, %102
br label %109
109: ; preds = %108, %94, %83
%110 = call i32 @unlink(i8* %16)
br label %111
111: ; preds = %109, %70, %51
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i64 1
%114 = load i8*, i8** %113
%115 = call i32 @unlink(i8* %114)
%116 = load i32, i32* %10
%117 = call i32 @exit(i32 %116)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@PATH_MAX = global i32 0
@stderr = global i32 0
@.str = [17 x i8] c"Usage: filename\0A\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [23 x i8] c"cannot create %s : %s\0A\00"
@errno = global i32 0
@.str.2 = [21 x i8] c"close failed %s: %s\0A\00"
@.str.3 = [11 x i8] c"%s-symlink\00"
@.str.4 = [23 x i8] c"symlink failed %s: %s\0A\00"
@.str.5 = [24 x i8] c"readlink failed %s: %s\0A\00"
@.str.6 = [21 x i8] c"lstat failed %s: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = load i32, i32* @PATH_MAX
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = alloca i8, i64 %5
%8 = bitcast %struct.stat* %3 to i8*
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 2)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = load i32, i32* @O_CREAT
%18 = load i32, i32* @O_RDWR
%19 = or i32 %18, %17
%20 = load i32, i32* @S_IRUSR
%21 = load i32, i32* @S_IWUSR
%22 = or i32 %21, %20
%23 = tail call i32 @open(i8* %16, i32 %19, i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %14
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %15
%28 = load i32, i32* @errno
%29 = tail call i8* @strerror(i32 %28)
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %29)
%31 = tail call i32 @exit(i32 2)
unreachable
32: ; preds = %14
%33 = tail call i64 @close(i32 %23)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %15
%38 = load i32, i32* @errno
%39 = tail call i8* @strerror(i32 %38)
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %37, i8* %39)
br label %79
41: ; preds = %32
%42 = load i8*, i8** %15
%43 = call i32 @snprintf(i8* %6, i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %42)
%44 = load i8*, i8** %15
%45 = call i64 @symlink(i8* %44, i8* %6)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %15
%50 = load i32, i32* @errno
%51 = call i8* @strerror(i32 %50)
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %49, i8* %51)
br label %79
53: ; preds = %41
%54 = call i64 @readlink(i8* %6, i8* %7, i32 %4)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %15
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %58, i8* %60)
br label %76
62: ; preds = %53
%63 = call i64 @lstat(i8* %6, %struct.stat* %3)
%64 = icmp slt i64 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %15
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %67, i8* %69)
br label %76
71: ; preds = %62
%72 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%73 = load i64, i64* %72
%74 = icmp ne i64 %73, %54
%75 = zext i1 %74 to i32
br label %76
76: ; preds = %71, %65, %56
%77 = phi i32 [ 2, %56 ], [ 2, %65 ], [ %75, %71 ]
%78 = call i32 @unlink(i8* %6)
br label %79
79: ; preds = %76, %47, %35
%80 = phi i32 [ 2, %35 ], [ 2, %47 ], [ %77, %76 ]
%81 = load i8*, i8** %15
%82 = call i32 @unlink(i8* %81)
%83 = call i32 @exit(i32 %80)
unreachable
}