#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 super_block {
  int dummy;
};
struct dentry {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DLNPair(struct dentry *);
int /*<<< orphan*/ LKTRTrace(char *, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ do_is_overlap(struct super_block *, struct dentry *,
                         struct dentry *);
scalar_t__ unlikely(int);
int is_overlap(struct super_block *sb, struct dentry *hidden_d1,
               struct dentry *hidden_d2) {
  LKTRTrace("d1 %.*s, d2 %.*s\n", DLNPair(hidden_d1), DLNPair(hidden_d2));
  if (unlikely(hidden_d1 == hidden_d2))
    return 1;
  return do_is_overlap(sb, hidden_d1, hidden_d2) ||
         do_is_overlap(sb, hidden_d2, hidden_d1) || 0 || 0;
}


x86 assembly (clang, -O0):
<is_overlap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <DLNPair@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <DLNPair@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
call   1050 <LKTRTrace@plt>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <unlikely@plt>
cmp    $0x0,%rax
je     11a5 <is_overlap+0x65>
movl   $0x1,-0x4(%rbp)
jmp    1200 <is_overlap+0xc0>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <do_is_overlap@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x25(%rbp)
jne    11f5 <is_overlap+0xb5>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <do_is_overlap@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x25(%rbp)
jne    11f5 <is_overlap+0xb5>
xor    %eax,%eax
mov    %al,-0x25(%rbp)
jmp    11f5 <is_overlap+0xb5>
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_overlap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <DLNPair@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <DLNPair@plt>
lea    0xe97(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <LKTRTrace@plt>
xor    %edi,%edi
cmp    %r14,%rbx
sete   %dil
call   1060 <unlikely@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    11b4 <is_overlap+0x74>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <do_is_overlap@plt>
test   %rax,%rax
jne    11b4 <is_overlap+0x74>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <do_is_overlap@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.super_block = type { i32 }
%struct.dentry = type { i32 }
@.str = [18 x i8] c"d1 %.*s, d2 %.*s\0A\00"
define i32 @is_overlap(%struct.super_block* %0, %struct.dentry* %1, %struct.dentry* %2) {
%4 = alloca i32
%5 = alloca %struct.super_block*
%6 = alloca %struct.dentry*
%7 = alloca %struct.dentry*
store %struct.super_block* %0, %struct.super_block** %5
store %struct.dentry* %1, %struct.dentry** %6
store %struct.dentry* %2, %struct.dentry** %7
%8 = load %struct.dentry*, %struct.dentry** %6
%9 = call i32 @DLNPair(%struct.dentry* %8)
%10 = load %struct.dentry*, %struct.dentry** %7
%11 = call i32 @DLNPair(%struct.dentry* %10)
%12 = call i32 @LKTRTrace(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = load %struct.dentry*, %struct.dentry** %6
%14 = load %struct.dentry*, %struct.dentry** %7
%15 = icmp eq %struct.dentry* %13, %14
%16 = zext i1 %15 to i32
%17 = call i64 @unlikely(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %3
store i32 1, i32* %4
br label %36
20: ; preds = %3
%21 = load %struct.super_block*, %struct.super_block** %5
%22 = load %struct.dentry*, %struct.dentry** %6
%23 = load %struct.dentry*, %struct.dentry** %7
%24 = call i64 @do_is_overlap(%struct.super_block* %21, %struct.dentry* %22, %struct.dentry* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %20
%27 = load %struct.super_block*, %struct.super_block** %5
%28 = load %struct.dentry*, %struct.dentry** %7
%29 = load %struct.dentry*, %struct.dentry** %6
%30 = call i64 @do_is_overlap(%struct.super_block* %27, %struct.dentry* %28, %struct.dentry* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %26
br label %33
33: ; preds = %32, %26, %20
%34 = phi i1 [ true, %26 ], [ true, %20 ], [ false, %32 ]
%35 = zext i1 %34 to i32
store i32 %35, i32* %4
br label %36
36: ; preds = %33, %19
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
%struct.super_block = type { i32 }
%struct.dentry = type { i32 }
@.str = [18 x i8] c"d1 %.*s, d2 %.*s\0A\00"
define i32 @is_overlap(%struct.super_block* %0, %struct.dentry* %1, %struct.dentry* %2) {
%4 = tail call i32 @DLNPair(%struct.dentry* %1)
%5 = tail call i32 @DLNPair(%struct.dentry* %2)
%6 = tail call i32 @LKTRTrace(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = icmp eq %struct.dentry* %1, %2
%8 = zext i1 %7 to i32
%9 = tail call i64 @unlikely(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %3
%12 = tail call i64 @do_is_overlap(%struct.super_block* %0, %struct.dentry* %1, %struct.dentry* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = tail call i64 @do_is_overlap(%struct.super_block* %0, %struct.dentry* %2, %struct.dentry* %1)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %11, %14, %3
%19 = phi i32 [ 1, %3 ], [ 1, %11 ], [ %17, %14 ]
ret i32 %19
}