#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_ino;
};
typedef scalar_t__ ino_t;

/* Variables and functions */
scalar_t__ ELOOP;
scalar_t__ ENOENT;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
scalar_t__ lstat(char *, struct stat *);
int open(char *, int, int /*<<< orphan*/);
int stat(char *, struct stat *);
scalar_t__ symlink(char *, char *);
int /*<<< orphan*/ unlink(char *);
void test_vfs_symlink_vnr(void) {
  int n;
  struct stat sb;
  ino_t fileino;
  n = open("/tmp"
           "/file",
           O_RDWR | O_CREAT, 0);
  assert(n == 0 + 3);
  ;
  assert(stat("/tmp"
              "/file",
              &sb) == 0);
  fileino = sb.st_ino;
  assert(symlink("/tmp"
                 "/file",
                 "/tmp"
                 "/alink") == 0);
  assert(stat("/tmp"
              "/alink",
              &sb) == 0);
  assert(fileino == sb.st_ino);
  assert(symlink("/tmp"
                 "/alink",
                 "/tmp"
                 "/alink2") == 0);
  assert(stat("/tmp"
              "/alink2",
              &sb) == 0);
  assert(fileino == sb.st_ino);
  assert(symlink("file", "/tmp"
                         "/rlink") == 0);
  assert(stat("/tmp"
              "/rlink",
              &sb) == 0);
  assert(fileino == sb.st_ino);
  assert(symlink("alink2", "/tmp"
                           "/rlink2") == 0);
  assert(stat("/tmp"
              "/rlink2",
              &sb) == 0);
  assert(fileino == sb.st_ino);
  assert(lstat("/tmp"
               "/alink2",
               &sb) == 0);
  assert(fileino != sb.st_ino);
  unlink("/tmp"
         "/alink");
  unlink("/tmp"
         "/alink2");
  unlink("/tmp"
         "/rlink");
  unlink("/tmp"
         "/rlink2");
  assert(symlink("/tmp", "/tmp"
                         "/dlink") == 0);
  assert(stat("/tmp"
              "/dlink/file",
              &sb) == 0);
  assert(fileino == sb.st_ino);
  unlink("/tmp"
         "/dlink");
  assert(symlink("/tmp"
                 "/slink",
                 "/tmp"
                 "/slink") == 0);
  assert(stat("/tmp"
              "/slink",
              &sb) == -1 &&
         errno == ELOOP);
  unlink("/tmp"
         "/slink");
  assert(symlink("/tmp"
                 "/nofile",
                 "/tmp"
                 "/blink") == 0);
  assert(stat("/tmp"
              "/blink",
              &sb) == -1 &&
         errno == ENOENT);
  unlink("/tmp"
         "/blink");
  unlink("/tmp"
         "/file");
}


x86 assembly (clang, -O0):
<test_vfs_symlink_vnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e71(%rip),%rax
mov    (%rax),%esi
mov    0x2e80(%rip),%rax
or     (%rax),%esi
lea    0xe7f(%rip),%rdi
xor    %edx,%edx
call   1080 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe5d(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe35(%rip),%rdi
lea    0xe38(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe1b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xde6(%rip),%rdi
lea    0xdea(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xdcd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xdd6(%rip),%rdi
lea    0xd9d(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd80(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd44(%rip),%rdi
lea    0xd4f(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd32(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xce6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <lstat@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xca5(%rip),%rdi
call   1030 <unlink@plt>
lea    0xca4(%rip),%rdi
call   1030 <unlink@plt>
lea    0xca4(%rip),%rdi
call   1030 <unlink@plt>
lea    0xca3(%rip),%rdi
call   1030 <unlink@plt>
lea    0xca3(%rip),%rdi
lea    0xca1(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xc8f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xc4f(%rip),%rdi
call   1030 <unlink@plt>
lea    0xc5e(%rip),%rsi
mov    %rsi,%rdi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xc3e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x19(%rbp)
jne    144d <test_vfs_symlink_vnr+0x2ed>
mov    0x2b8e(%rip),%rax
mov    (%rax),%rax
mov    0x2b94(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xbf7(%rip),%rdi
call   1030 <unlink@plt>
lea    0xbf6(%rip),%rdi
lea    0xbfb(%rip),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xbde(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x1a(%rbp)
jne    14c4 <test_vfs_symlink_vnr+0x364>
mov    0x2b17(%rip),%rax
mov    (%rax),%rax
mov    0x2afd(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xb97(%rip),%rdi
call   1030 <unlink@plt>
lea    0xb1c(%rip),%rdi
call   1030 <unlink@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vfs_symlink_vnr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e6e(%rip),%rax
mov    0x2e7f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe7c(%rip),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
call   1080 <open@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rsp,%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%rsp),%r14
lea    0xe48(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
sete   %dil
call   1060 <assert@plt>
lea    0xe0c(%rip),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
sete   %dil
call   1060 <assert@plt>
lea    0xe03(%rip),%rdi
lea    0xdca(%rip),%rbx
mov    %rbx,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
sete   %dil
call   1060 <assert@plt>
lea    0xd7f(%rip),%rdi
lea    0xd8a(%rip),%rbp
mov    %rbp,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
sete   %dil
call   1060 <assert@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <lstat@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
setne  %dil
call   1060 <assert@plt>
mov    %r15,%rdi
call   1030 <unlink@plt>
mov    %r12,%rdi
call   1030 <unlink@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    %rbp,%rdi
call   1030 <unlink@plt>
lea    0xd0a(%rip),%rdi
lea    0xd08(%rip),%rbx
mov    %rbx,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
lea    0xcf6(%rip),%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%r14
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xcd3(%rip),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
cmp    $0xffffffff,%eax
sete   %al
mov    0x2c12(%rip),%rbp
mov    0x0(%rbp),%rcx
mov    0x2c17(%rip),%rdx
cmp    (%rdx),%rcx
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xc83(%rip),%rdi
lea    0xc88(%rip),%rbx
mov    %rbx,%rsi
call   1040 <symlink@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <stat@plt>
cmp    $0xffffffff,%eax
sete   %al
mov    0x0(%rbp),%rcx
mov    0x2b9f(%rip),%rdx
cmp    (%rdx),%rcx
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xbc8(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <unlink@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [10 x i8] c"/tmp/file\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.1 = [11 x i8] c"/tmp/alink\00"
@.str.2 = [12 x i8] c"/tmp/alink2\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [11 x i8] c"/tmp/rlink\00"
@.str.5 = [7 x i8] c"alink2\00"
@.str.6 = [12 x i8] c"/tmp/rlink2\00"
@.str.7 = [5 x i8] c"/tmp\00"
@.str.8 = [11 x i8] c"/tmp/dlink\00"
@.str.9 = [16 x i8] c"/tmp/dlink/file\00"
@.str.10 = [11 x i8] c"/tmp/slink\00"
@errno = global i64 0
@ELOOP = global i64 0
@.str.11 = [12 x i8] c"/tmp/nofile\00"
@.str.12 = [11 x i8] c"/tmp/blink\00"
@ENOENT = global i64 0
define void @test_vfs_symlink_vnr() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = alloca i64
%4 = load i32, i32* @O_RDWR
%5 = load i32, i32* @O_CREAT
%6 = or i32 %4, %5
%7 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6, i32 0)
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 3
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%17 = load i64, i64* %16
store i64 %17, i64* %3
%18 = call i64 @symlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %2)
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i64, i64* %3
%27 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%28 = load i64, i64* %27
%29 = icmp eq i64 %26, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i64 @symlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i64, i64* %3
%41 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%42 = load i64, i64* %41
%43 = icmp eq i64 %40, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %2)
%51 = icmp eq i32 %50, 0
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load i64, i64* %3
%55 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%56 = load i64, i64* %55
%57 = icmp eq i64 %54, %56
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = call i64 @symlink(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %2)
%65 = icmp eq i32 %64, 0
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i64, i64* %3
%69 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%70 = load i64, i64* %69
%71 = icmp eq i64 %68, %70
%72 = zext i1 %71 to i32
%73 = call i32 @assert(i32 %72)
%74 = call i64 @lstat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%75 = icmp eq i64 %74, 0
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = load i64, i64* %3
%79 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%80 = load i64, i64* %79
%81 = icmp ne i64 %78, %80
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%85 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%86 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%87 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%88 = call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = call i32 @stat(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), %struct.stat* %2)
%93 = icmp eq i32 %92, 0
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = load i64, i64* %3
%97 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%98 = load i64, i64* %97
%99 = icmp eq i64 %96, %98
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%103 = call i64 @symlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %struct.stat* %2)
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %113
109: ; preds = %0
%110 = load i64, i64* @errno
%111 = load i64, i64* @ELOOP
%112 = icmp eq i64 %110, %111
br label %113
113: ; preds = %109, %0
%114 = phi i1 [ false, %0 ], [ %112, %109 ]
%115 = zext i1 %114 to i32
%116 = call i32 @assert(i32 %115)
%117 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%118 = call i64 @symlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%119 = icmp eq i64 %118, 0
%120 = zext i1 %119 to i32
%121 = call i32 @assert(i32 %120)
%122 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), %struct.stat* %2)
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %128
124: ; preds = %113
%125 = load i64, i64* @errno
%126 = load i64, i64* @ENOENT
%127 = icmp eq i64 %125, %126
br label %128
128: ; preds = %124, %113
%129 = phi i1 [ false, %113 ], [ %127, %124 ]
%130 = zext i1 %129 to i32
%131 = call i32 @assert(i32 %130)
%132 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%133 = call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [10 x i8] c"/tmp/file\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.1 = [11 x i8] c"/tmp/alink\00"
@.str.2 = [12 x i8] c"/tmp/alink2\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [11 x i8] c"/tmp/rlink\00"
@.str.5 = [7 x i8] c"alink2\00"
@.str.6 = [12 x i8] c"/tmp/rlink2\00"
@.str.7 = [5 x i8] c"/tmp\00"
@.str.8 = [11 x i8] c"/tmp/dlink\00"
@.str.9 = [16 x i8] c"/tmp/dlink/file\00"
@.str.10 = [11 x i8] c"/tmp/slink\00"
@errno = global i64 0
@ELOOP = global i64 0
@.str.11 = [12 x i8] c"/tmp/nofile\00"
@.str.12 = [11 x i8] c"/tmp/blink\00"
@ENOENT = global i64 0
define void @test_vfs_symlink_vnr() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 0)
%7 = icmp eq i32 %6, 3
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%15 = load i64, i64* %14
%16 = tail call i64 @symlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %1)
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = load i64, i64* %14
%25 = icmp eq i64 %15, %24
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call i64 @symlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = tail call i32 @assert(i32 %34)
%36 = load i64, i64* %14
%37 = icmp eq i64 %15, %36
%38 = zext i1 %37 to i32
%39 = tail call i32 @assert(i32 %38)
%40 = tail call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
%43 = tail call i32 @assert(i32 %42)
%44 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %1)
%45 = icmp eq i32 %44, 0
%46 = zext i1 %45 to i32
%47 = tail call i32 @assert(i32 %46)
%48 = load i64, i64* %14
%49 = icmp eq i64 %15, %48
%50 = zext i1 %49 to i32
%51 = tail call i32 @assert(i32 %50)
%52 = tail call i64 @symlink(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
%54 = zext i1 %53 to i32
%55 = tail call i32 @assert(i32 %54)
%56 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %1)
%57 = icmp eq i32 %56, 0
%58 = zext i1 %57 to i32
%59 = tail call i32 @assert(i32 %58)
%60 = load i64, i64* %14
%61 = icmp eq i64 %15, %60
%62 = zext i1 %61 to i32
%63 = tail call i32 @assert(i32 %62)
%64 = call i64 @lstat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%65 = icmp eq i64 %64, 0
%66 = zext i1 %65 to i32
%67 = tail call i32 @assert(i32 %66)
%68 = load i64, i64* %14
%69 = icmp ne i64 %15, %68
%70 = zext i1 %69 to i32
%71 = tail call i32 @assert(i32 %70)
%72 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%73 = tail call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%74 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%75 = tail call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%76 = tail call i64 @symlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
%78 = zext i1 %77 to i32
%79 = tail call i32 @assert(i32 %78)
%80 = call i32 @stat(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), %struct.stat* %1)
%81 = icmp eq i32 %80, 0
%82 = zext i1 %81 to i32
%83 = tail call i32 @assert(i32 %82)
%84 = load i64, i64* %14
%85 = icmp eq i64 %15, %84
%86 = zext i1 %85 to i32
%87 = tail call i32 @assert(i32 %86)
%88 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%89 = tail call i64 @symlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
%91 = zext i1 %90 to i32
%92 = tail call i32 @assert(i32 %91)
%93 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %struct.stat* %1)
%94 = icmp eq i32 %93, -1
%95 = load i64, i64* @errno
%96 = load i64, i64* @ELOOP
%97 = icmp eq i64 %95, %96
%98 = select i1 %94, i1 %97, i1 false
%99 = zext i1 %98 to i32
%100 = tail call i32 @assert(i32 %99)
%101 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%102 = tail call i64 @symlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%103 = icmp eq i64 %102, 0
%104 = zext i1 %103 to i32
%105 = tail call i32 @assert(i32 %104)
%106 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), %struct.stat* %1)
%107 = icmp eq i32 %106, -1
%108 = load i64, i64* @errno
%109 = load i64, i64* @ENOENT
%110 = icmp eq i64 %108, %109
%111 = select i1 %107, i1 %110, i1 false
%112 = zext i1 %111 to i32
%113 = tail call i32 @assert(i32 %112)
%114 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%115 = tail call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}