#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_dev;
  scalar_t__ st_ino;
};

/* Variables and functions */
int /*<<< orphan*/ eprintf(char *, char const *, char const *);
int /*<<< orphan*/ stat(char const *, struct stat *);
void fnck(const char *a, const char *b,
          int (*fn)(const char *, const char *, int), int depth) {
  struct stat sta, stb;
  if (!stat(a, &sta) && !stat(b, &stb) && sta.st_dev == stb.st_dev &&
      sta.st_ino == stb.st_ino) {
    eprintf("%s -> %s: same file\n", a, b);
  }
  if (fn(a, b, depth) < 0)
    eprintf("%s -> %s:", a, b);
}


x86 assembly (clang, -O0):
<fnck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%eax
jne    1193 <fnck+0x73>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%eax
jne    1193 <fnck+0x73>
mov    -0x30(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    1193 <fnck+0x73>
mov    -0x28(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1193 <fnck+0x73>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe72(%rip),%rdi
call   1040 <eprintf@plt>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   *%rax
cmp    $0x0,%eax
jge    11c1 <fnck+0xa1>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe59(%rip),%rdi
call   1040 <eprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnck>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x18(%rsp),%rsi
call   1030 <stat@plt>
test   %eax,%eax
jne    117e <fnck+0x5e>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <stat@plt>
test   %eax,%eax
jne    117e <fnck+0x5e>
mov    0x18(%rsp),%rax
cmp    0x8(%rsp),%rax
jne    117e <fnck+0x5e>
mov    0x20(%rsp),%rax
cmp    0x10(%rsp),%rax
jne    117e <fnck+0x5e>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <eprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   *%r15
test   %eax,%eax
js     1198 <fnck+0x78>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe76(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <eprintf@plt>

LLVM IR (-O0):
%struct.stat = type { i64, i64 }
@.str = [21 x i8] c"%s -> %s: same file\0A\00"
@.str.1 = [10 x i8] c"%s -> %s:\00"
define void @fnck(i8* %0, i8* %1, i32 (i8*, i8*, i32)* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32 (i8*, i8*, i32)*
%8 = alloca i32
%9 = alloca %struct.stat
%10 = alloca %struct.stat
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 (i8*, i8*, i32)* %2, i32 (i8*, i8*, i32)** %7
store i32 %3, i32* %8
%11 = load i8*, i8** %5
%12 = call i32 @stat(i8* %11, %struct.stat* %9)
%13 = icmp ne i32 %12, 0
br i1 %13, label %34, label %14
14: ; preds = %4
%15 = load i8*, i8** %6
%16 = call i32 @stat(i8* %15, %struct.stat* %10)
%17 = icmp ne i32 %16, 0
br i1 %17, label %34, label %18
18: ; preds = %14
%19 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%22 = load i64, i64* %21
%23 = icmp eq i64 %20, %22
br i1 %23, label %24, label %34
24: ; preds = %18
%25 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 1
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%28 = load i64, i64* %27
%29 = icmp eq i64 %26, %28
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = load i8*, i8** %5
%32 = load i8*, i8** %6
%33 = call i32 @eprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %31, i8* %32)
br label %34
34: ; preds = %30, %24, %18, %14, %4
%35 = load i32 (i8*, i8*, i32)*, i32 (i8*, i8*, i32)** %7
%36 = load i8*, i8** %5
%37 = load i8*, i8** %6
%38 = load i32, i32* %8
%39 = call i32 %35(i8* %36, i8* %37, i32 %38)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %34
%42 = load i8*, i8** %5
%43 = load i8*, i8** %6
%44 = call i32 @eprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %42, i8* %43)
br label %45
45: ; preds = %41, %34
ret void
}

LLVM IR (-O2):
%struct.stat = type { i64, i64 }
@.str = [21 x i8] c"%s -> %s: same file\0A\00"
@.str.1 = [10 x i8] c"%s -> %s:\00"
define void @fnck(i8* %0, i8* %1, i32 (i8*, i8*, i32)* nocapture %2, i32 %3) {
%5 = alloca %struct.stat
%6 = alloca %struct.stat
%7 = bitcast %struct.stat* %5 to i8*
%8 = bitcast %struct.stat* %6 to i8*
%9 = call i32 @stat(i8* %0, %struct.stat* %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %4
%12 = call i32 @stat(i8* %1, %struct.stat* %6)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %11
%15 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%18 = load i64, i64* %17
%19 = icmp eq i64 %16, %18
br i1 %19, label %20, label %28
20: ; preds = %14
%21 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 1
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 1
%24 = load i64, i64* %23
%25 = icmp eq i64 %22, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 @eprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %28
28: ; preds = %26, %20, %14, %11, %4
%29 = tail call i32 %2(i8* %0, i8* %1, i32 %3)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 @eprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
br label %33
33: ; preds = %31, %28
ret void
}