#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 {
  int st_dev;
  int st_ino;
  int st_nlink;
  scalar_t__ st_rdev;
  int st_size;
  int st_atime;
  int st_mtime;
  int st_ctime;
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int S_ISCHR(int /*<<< orphan*/);
int S_ISDIR(int /*<<< orphan*/);
int S_ISLNK(int /*<<< orphan*/);
int S_ISREG(int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int fstat(int /*<<< orphan*/, struct stat *);
int lstat(char *, struct stat *);
scalar_t__ makedev(int, int);
int /*<<< orphan*/ memset(struct stat *, int /*<<< orphan*/, int);
int /*<<< orphan*/ open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int stat(char *, struct stat *);
void test() {
  int err;
  struct stat s;
  memset(&s, 0, sizeof(s));
  err = stat("folder", &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISDIR(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == 0);
  assert(s.st_size);
  assert(s.st_atime == 1200000000);
  assert(s.st_mtime == 1200000000);
  assert(s.st_ctime);
  memset(&s, 0, sizeof(s));
  err = stat("folder/file", &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISREG(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == 0);
  assert(s.st_size == 6);
  assert(s.st_atime == 1200000000);
  assert(s.st_mtime == 1200000000);
  assert(s.st_ctime);
  memset(&s, 0, sizeof(s));
  err = fstat(open("folder/file", O_RDONLY), &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISREG(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == 0);
  assert(s.st_size == 6);
  assert(s.st_atime == 1200000000);
  assert(s.st_mtime == 1200000000);
  assert(s.st_ctime);
  memset(&s, 0, sizeof(s));
  err = stat("/dev/null", &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISCHR(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == makedev(1, 3));
  assert(!s.st_size);
  assert(s.st_atime);
  assert(s.st_mtime);
  assert(s.st_ctime);
  memset(&s, 0, sizeof(s));
  err = stat("folder/file-link", &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISREG(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == 0);
  assert(s.st_size == 6);
  assert(s.st_atime == 1200000000);
  assert(s.st_mtime == 1200000000);
  assert(s.st_ctime);
  memset(&s, 0, sizeof(s));
  err = lstat("folder/file-link", &s);
  assert(!err);
  assert(s.st_dev);
  assert(s.st_ino);
  assert(S_ISLNK(s.st_mode));
  assert(s.st_nlink);
  assert(s.st_rdev == 0);
  assert(s.st_size == 4);
  assert(s.st_atime != 1200000000);
  assert(s.st_mtime != 1200000000);
  assert(s.st_ctime);
  puts("success");
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xe21(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   1050 <S_ISDIR@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x20(%rbp),%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xd81(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x6,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
mov    0x2cb2(%rip),%rax
mov    (%rax),%esi
lea    0xcc8(%rip),%rdi
call   10c0 <open@plt>
mov    %eax,%edi
lea    -0x38(%rbp),%rsi
call   10e0 <fstat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x6,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xc1d(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   10b0 <S_ISCHR@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x1,%edi
mov    $0x3,%esi
call   10d0 <makedev@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x1c(%rbp),%edi
call   1080 <assert@plt>
mov    -0x18(%rbp),%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xb71(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x6,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xac1(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <lstat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%edi
call   1080 <assert@plt>
mov    -0x34(%rbp),%edi
call   1080 <assert@plt>
mov    -0x10(%rbp),%edi
call   1030 <S_ISLNK@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    -0x30(%rbp),%edi
call   1080 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x4,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x1c(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpl   $0x47868c00,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x14(%rbp),%edi
call   1080 <assert@plt>
lea    0xa32(%rip),%rdi
call   1040 <puts@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xe1e(%rip),%rdi
mov    %r15,%rsi
call   1090 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   1050 <S_ISDIR@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x10(%rsp)
sete   %dil
call   1080 <assert@plt>
mov    0x18(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x1c(%rsp)
47
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x20(%rsp)
47
sete   %dil
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xd87(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x10(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x6,0x18(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x1c(%rsp)
47
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x20(%rsp)
47
sete   %dil
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10c0 <open@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   10e0 <fstat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x10(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x6,0x18(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x1c(%rsp)
47
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x20(%rsp)
47
sete   %dil
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xc3a(%rip),%rdi
mov    %r15,%rsi
call   1090 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   10b0 <S_ISCHR@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
mov    0x10(%rsp),%rbx
mov    $0x1,%edi
mov    $0x3,%esi
call   10d0 <makedev@plt>
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0x18(%rsp)
sete   %dil
call   1080 <assert@plt>
mov    0x1c(%rsp),%edi
call   1080 <assert@plt>
mov    0x20(%rsp),%edi
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xba2(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   10a0 <S_ISREG@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x10(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x6,0x18(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x1c(%rsp)
47
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x20(%rsp)
47
sete   %dil
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <lstat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%edi
call   1080 <assert@plt>
mov    0x4(%rsp),%edi
call   1080 <assert@plt>
mov    0x28(%rsp),%edi
call   1030 <S_ISLNK@plt>
mov    %eax,%edi
call   1080 <assert@plt>
mov    0x8(%rsp),%edi
call   1080 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,0x10(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x4,0x18(%rsp)
sete   %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x1c(%rsp)
47
setne  %dil
call   1080 <assert@plt>
xor    %edi,%edi
cmpl   $0x47868c00,0x20(%rsp)
47
setne  %dil
call   1080 <assert@plt>
mov    0x24(%rsp),%edi
call   1080 <assert@plt>
lea    0xa79(%rip),%rdi
call   1040 <puts@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i64, i32, i32, i32, i32, i32 }
@.str = [7 x i8] c"folder\00"
@.str.1 = [12 x i8] c"folder/file\00"
@O_RDONLY = global i32 0
@.str.2 = [10 x i8] c"/dev/null\00"
@.str.3 = [17 x i8] c"folder/file-link\00"
@.str.4 = [8 x i8] c"success\00"
define void @test() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%4 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @assert(i32 %11)
%13 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%14 = load i32, i32* %13
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%17 = load i32, i32* %16
%18 = call i32 @S_ISDIR(i32 %17)
%19 = call i32 @assert(i32 %18)
%20 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%21 = load i32, i32* %20
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%24 = load i64, i64* %23
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%29 = load i32, i32* %28
%30 = call i32 @assert(i32 %29)
%31 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 1200000000
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 1200000000
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%42 = load i32, i32* %41
%43 = call i32 @assert(i32 %42)
%44 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%45 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %2)
store i32 %45, i32* %1
%46 = load i32, i32* %1
%47 = icmp ne i32 %46, 0
%48 = xor i1 %47, true
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%52 = load i32, i32* %51
%53 = call i32 @assert(i32 %52)
%54 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%55 = load i32, i32* %54
%56 = call i32 @assert(i32 %55)
%57 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%58 = load i32, i32* %57
%59 = call i32 @S_ISREG(i32 %58)
%60 = call i32 @assert(i32 %59)
%61 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%62 = load i32, i32* %61
%63 = call i32 @assert(i32 %62)
%64 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%65 = load i64, i64* %64
%66 = icmp eq i64 %65, 0
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
%69 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%70 = load i32, i32* %69
%71 = icmp eq i32 %70, 6
%72 = zext i1 %71 to i32
%73 = call i32 @assert(i32 %72)
%74 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%75 = load i32, i32* %74
%76 = icmp eq i32 %75, 1200000000
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%80 = load i32, i32* %79
%81 = icmp eq i32 %80, 1200000000
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%85 = load i32, i32* %84
%86 = call i32 @assert(i32 %85)
%87 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%88 = load i32, i32* @O_RDONLY
%89 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %88)
%90 = call i32 @fstat(i32 %89, %struct.stat* %2)
store i32 %90, i32* %1
%91 = load i32, i32* %1
%92 = icmp ne i32 %91, 0
%93 = xor i1 %92, true
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%97 = load i32, i32* %96
%98 = call i32 @assert(i32 %97)
%99 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%100 = load i32, i32* %99
%101 = call i32 @assert(i32 %100)
%102 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%103 = load i32, i32* %102
%104 = call i32 @S_ISREG(i32 %103)
%105 = call i32 @assert(i32 %104)
%106 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%107 = load i32, i32* %106
%108 = call i32 @assert(i32 %107)
%109 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%110 = load i64, i64* %109
%111 = icmp eq i64 %110, 0
%112 = zext i1 %111 to i32
%113 = call i32 @assert(i32 %112)
%114 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%115 = load i32, i32* %114
%116 = icmp eq i32 %115, 6
%117 = zext i1 %116 to i32
%118 = call i32 @assert(i32 %117)
%119 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%120 = load i32, i32* %119
%121 = icmp eq i32 %120, 1200000000
%122 = zext i1 %121 to i32
%123 = call i32 @assert(i32 %122)
%124 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%125 = load i32, i32* %124
%126 = icmp eq i32 %125, 1200000000
%127 = zext i1 %126 to i32
%128 = call i32 @assert(i32 %127)
%129 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%130 = load i32, i32* %129
%131 = call i32 @assert(i32 %130)
%132 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%133 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
store i32 %133, i32* %1
%134 = load i32, i32* %1
%135 = icmp ne i32 %134, 0
%136 = xor i1 %135, true
%137 = zext i1 %136 to i32
%138 = call i32 @assert(i32 %137)
%139 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%140 = load i32, i32* %139
%141 = call i32 @assert(i32 %140)
%142 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%143 = load i32, i32* %142
%144 = call i32 @assert(i32 %143)
%145 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%146 = load i32, i32* %145
%147 = call i32 @S_ISCHR(i32 %146)
%148 = call i32 @assert(i32 %147)
%149 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%150 = load i32, i32* %149
%151 = call i32 @assert(i32 %150)
%152 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%153 = load i64, i64* %152
%154 = call i64 @makedev(i32 1, i32 3)
%155 = icmp eq i64 %153, %154
%156 = zext i1 %155 to i32
%157 = call i32 @assert(i32 %156)
%158 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%159 = load i32, i32* %158
%160 = icmp ne i32 %159, 0
%161 = xor i1 %160, true
%162 = zext i1 %161 to i32
%163 = call i32 @assert(i32 %162)
%164 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%165 = load i32, i32* %164
%166 = call i32 @assert(i32 %165)
%167 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%168 = load i32, i32* %167
%169 = call i32 @assert(i32 %168)
%170 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%171 = load i32, i32* %170
%172 = call i32 @assert(i32 %171)
%173 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%174 = call i32 @stat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %struct.stat* %2)
store i32 %174, i32* %1
%175 = load i32, i32* %1
%176 = icmp ne i32 %175, 0
%177 = xor i1 %176, true
%178 = zext i1 %177 to i32
%179 = call i32 @assert(i32 %178)
%180 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%181 = load i32, i32* %180
%182 = call i32 @assert(i32 %181)
%183 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%184 = load i32, i32* %183
%185 = call i32 @assert(i32 %184)
%186 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%187 = load i32, i32* %186
%188 = call i32 @S_ISREG(i32 %187)
%189 = call i32 @assert(i32 %188)
%190 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%191 = load i32, i32* %190
%192 = call i32 @assert(i32 %191)
%193 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%194 = load i64, i64* %193
%195 = icmp eq i64 %194, 0
%196 = zext i1 %195 to i32
%197 = call i32 @assert(i32 %196)
%198 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%199 = load i32, i32* %198
%200 = icmp eq i32 %199, 6
%201 = zext i1 %200 to i32
%202 = call i32 @assert(i32 %201)
%203 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%204 = load i32, i32* %203
%205 = icmp eq i32 %204, 1200000000
%206 = zext i1 %205 to i32
%207 = call i32 @assert(i32 %206)
%208 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%209 = load i32, i32* %208
%210 = icmp eq i32 %209, 1200000000
%211 = zext i1 %210 to i32
%212 = call i32 @assert(i32 %211)
%213 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%214 = load i32, i32* %213
%215 = call i32 @assert(i32 %214)
%216 = call i32 @memset(%struct.stat* %2, i32 0, i32 48)
%217 = call i32 @lstat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %struct.stat* %2)
store i32 %217, i32* %1
%218 = load i32, i32* %1
%219 = icmp ne i32 %218, 0
%220 = xor i1 %219, true
%221 = zext i1 %220 to i32
%222 = call i32 @assert(i32 %221)
%223 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%224 = load i32, i32* %223
%225 = call i32 @assert(i32 %224)
%226 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 1
%227 = load i32, i32* %226
%228 = call i32 @assert(i32 %227)
%229 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 8
%230 = load i32, i32* %229
%231 = call i32 @S_ISLNK(i32 %230)
%232 = call i32 @assert(i32 %231)
%233 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 2
%234 = load i32, i32* %233
%235 = call i32 @assert(i32 %234)
%236 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 3
%237 = load i64, i64* %236
%238 = icmp eq i64 %237, 0
%239 = zext i1 %238 to i32
%240 = call i32 @assert(i32 %239)
%241 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 4
%242 = load i32, i32* %241
%243 = icmp eq i32 %242, 4
%244 = zext i1 %243 to i32
%245 = call i32 @assert(i32 %244)
%246 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 5
%247 = load i32, i32* %246
%248 = icmp ne i32 %247, 1200000000
%249 = zext i1 %248 to i32
%250 = call i32 @assert(i32 %249)
%251 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 6
%252 = load i32, i32* %251
%253 = icmp ne i32 %252, 1200000000
%254 = zext i1 %253 to i32
%255 = call i32 @assert(i32 %254)
%256 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 7
%257 = load i32, i32* %256
%258 = call i32 @assert(i32 %257)
%259 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i64, i32, i32, i32, i32, i32 }
@.str = [7 x i8] c"folder\00"
@.str.1 = [12 x i8] c"folder/file\00"
@O_RDONLY = global i32 0
@.str.2 = [10 x i8] c"/dev/null\00"
@.str.3 = [17 x i8] c"folder/file-link\00"
@.str.4 = [8 x i8] c"success\00"
define void @test() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%4 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 8
%15 = load i32, i32* %14
%16 = call i32 @S_ISDIR(i32 %15)
%17 = call i32 @assert(i32 %16)
%18 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 2
%19 = load i32, i32* %18
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 3
%22 = load i64, i64* %21
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 4
%27 = load i32, i32* %26
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 5
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 1200000000
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 6
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 1200000000
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 7
%40 = load i32, i32* %39
%41 = call i32 @assert(i32 %40)
%42 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%43 = call i32 @stat(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %1)
%44 = icmp eq i32 %43, 0
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = load i32, i32* %8
%48 = call i32 @assert(i32 %47)
%49 = load i32, i32* %11
%50 = call i32 @assert(i32 %49)
%51 = load i32, i32* %14
%52 = call i32 @S_ISREG(i32 %51)
%53 = call i32 @assert(i32 %52)
%54 = load i32, i32* %18
%55 = call i32 @assert(i32 %54)
%56 = load i64, i64* %21
%57 = icmp eq i64 %56, 0
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = load i32, i32* %26
%61 = icmp eq i32 %60, 6
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = load i32, i32* %29
%65 = icmp eq i32 %64, 1200000000
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i32, i32* %34
%69 = icmp eq i32 %68, 1200000000
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = load i32, i32* %39
%73 = call i32 @assert(i32 %72)
%74 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%75 = load i32, i32* @O_RDONLY
%76 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %75)
%77 = call i32 @fstat(i32 %76, %struct.stat* %1)
%78 = icmp eq i32 %77, 0
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load i32, i32* %8
%82 = call i32 @assert(i32 %81)
%83 = load i32, i32* %11
%84 = call i32 @assert(i32 %83)
%85 = load i32, i32* %14
%86 = call i32 @S_ISREG(i32 %85)
%87 = call i32 @assert(i32 %86)
%88 = load i32, i32* %18
%89 = call i32 @assert(i32 %88)
%90 = load i64, i64* %21
%91 = icmp eq i64 %90, 0
%92 = zext i1 %91 to i32
%93 = call i32 @assert(i32 %92)
%94 = load i32, i32* %26
%95 = icmp eq i32 %94, 6
%96 = zext i1 %95 to i32
%97 = call i32 @assert(i32 %96)
%98 = load i32, i32* %29
%99 = icmp eq i32 %98, 1200000000
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = load i32, i32* %34
%103 = icmp eq i32 %102, 1200000000
%104 = zext i1 %103 to i32
%105 = call i32 @assert(i32 %104)
%106 = load i32, i32* %39
%107 = call i32 @assert(i32 %106)
%108 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%109 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%110 = icmp eq i32 %109, 0
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
%113 = load i32, i32* %8
%114 = call i32 @assert(i32 %113)
%115 = load i32, i32* %11
%116 = call i32 @assert(i32 %115)
%117 = load i32, i32* %14
%118 = call i32 @S_ISCHR(i32 %117)
%119 = call i32 @assert(i32 %118)
%120 = load i32, i32* %18
%121 = call i32 @assert(i32 %120)
%122 = load i64, i64* %21
%123 = call i64 @makedev(i32 1, i32 3)
%124 = icmp eq i64 %122, %123
%125 = zext i1 %124 to i32
%126 = call i32 @assert(i32 %125)
%127 = load i32, i32* %26
%128 = icmp eq i32 %127, 0
%129 = zext i1 %128 to i32
%130 = call i32 @assert(i32 %129)
%131 = load i32, i32* %29
%132 = call i32 @assert(i32 %131)
%133 = load i32, i32* %34
%134 = call i32 @assert(i32 %133)
%135 = load i32, i32* %39
%136 = call i32 @assert(i32 %135)
%137 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%138 = call i32 @stat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %struct.stat* %1)
%139 = icmp eq i32 %138, 0
%140 = zext i1 %139 to i32
%141 = call i32 @assert(i32 %140)
%142 = load i32, i32* %8
%143 = call i32 @assert(i32 %142)
%144 = load i32, i32* %11
%145 = call i32 @assert(i32 %144)
%146 = load i32, i32* %14
%147 = call i32 @S_ISREG(i32 %146)
%148 = call i32 @assert(i32 %147)
%149 = load i32, i32* %18
%150 = call i32 @assert(i32 %149)
%151 = load i64, i64* %21
%152 = icmp eq i64 %151, 0
%153 = zext i1 %152 to i32
%154 = call i32 @assert(i32 %153)
%155 = load i32, i32* %26
%156 = icmp eq i32 %155, 6
%157 = zext i1 %156 to i32
%158 = call i32 @assert(i32 %157)
%159 = load i32, i32* %29
%160 = icmp eq i32 %159, 1200000000
%161 = zext i1 %160 to i32
%162 = call i32 @assert(i32 %161)
%163 = load i32, i32* %34
%164 = icmp eq i32 %163, 1200000000
%165 = zext i1 %164 to i32
%166 = call i32 @assert(i32 %165)
%167 = load i32, i32* %39
%168 = call i32 @assert(i32 %167)
%169 = call i32 @memset(%struct.stat* %1, i32 0, i32 48)
%170 = call i32 @lstat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %struct.stat* %1)
%171 = icmp eq i32 %170, 0
%172 = zext i1 %171 to i32
%173 = call i32 @assert(i32 %172)
%174 = load i32, i32* %8
%175 = call i32 @assert(i32 %174)
%176 = load i32, i32* %11
%177 = call i32 @assert(i32 %176)
%178 = load i32, i32* %14
%179 = call i32 @S_ISLNK(i32 %178)
%180 = call i32 @assert(i32 %179)
%181 = load i32, i32* %18
%182 = call i32 @assert(i32 %181)
%183 = load i64, i64* %21
%184 = icmp eq i64 %183, 0
%185 = zext i1 %184 to i32
%186 = call i32 @assert(i32 %185)
%187 = load i32, i32* %26
%188 = icmp eq i32 %187, 4
%189 = zext i1 %188 to i32
%190 = call i32 @assert(i32 %189)
%191 = load i32, i32* %29
%192 = icmp ne i32 %191, 1200000000
%193 = zext i1 %192 to i32
%194 = call i32 @assert(i32 %193)
%195 = load i32, i32* %34
%196 = icmp ne i32 %195, 1200000000
%197 = zext i1 %196 to i32
%198 = call i32 @assert(i32 %197)
%199 = load i32, i32* %39
%200 = call i32 @assert(i32 %199)
%201 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
ret void
}