#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 cnfresult {
  int dummy;
};
struct cnfnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _cnf_find_entry(struct cnfresult **, struct cnfnode *,
                                   char *, char const *, int);
struct cnfresult *create_cnfresult(struct cnfnode *, char const *);
scalar_t__ strcmp(char const *, char *);
struct cnfresult *cnf_find_entry_f(struct cnfnode *cn_root, const char *path,
                                   int flags) {
  struct cnfresult *cnf_res = NULL;
  char fullpath[256];
  fullpath[0] = 0;
  if (strcmp(path, ".") == 0)
    cnf_res = create_cnfresult(cn_root, path);
  else
    _cnf_find_entry(&cnf_res, cn_root, flags & 0x01 ? NULL : fullpath, path,
                    flags);
  return cnf_res;
}


x86 assembly (clang, -O0):
<cnf_find_entry_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movb   $0x0,-0x120(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1185 <cnf_find_entry_f+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <create_cnfresult@plt>
mov    %rax,-0x20(%rbp)
jmp    11da <cnf_find_entry_f+0xaa>
mov    -0x8(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11ad <cnf_find_entry_f+0x7d>
xor    %eax,%eax
mov    %rax,-0x130(%rbp)
jmp    11bb <cnf_find_entry_f+0x8b>
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x128(%rbp),%rsi
mov    -0x130(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    -0x20(%rbp),%rdi
call   1050 <_cnf_find_entry@plt>
mov    -0x20(%rbp),%rax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnf_find_entry_f>:
push   %rbp
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1198 <cnf_find_entry_f+0x68>
xor    %eax,%eax
test   $0x1,%bpl
lea    0x10(%rsp),%rdx
cmovne %rax,%rdx
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
mov    %rbx,%rcx
mov    %ebp,%r8d
call   1050 <_cnf_find_entry@plt>
mov    0x8(%rsp),%rax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <create_cnfresult@plt>

LLVM IR (-O0):
%struct.cnfresult = type { i32 }
%struct.cnfnode = type { i32 }
@.str = [2 x i8] c".\00"
define %struct.cnfresult* @cnf_find_entry_f(%struct.cnfnode* %0, i8* %1, i32 %2) {
%4 = alloca %struct.cnfnode*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.cnfresult*
%8 = alloca [256 x i8]
store %struct.cnfnode* %0, %struct.cnfnode** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store %struct.cnfresult* null, %struct.cnfresult** %7
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
store i8 0, i8* %9
%10 = load i8*, i8** %5
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load %struct.cnfnode*, %struct.cnfnode** %4
%15 = load i8*, i8** %5
%16 = call %struct.cnfresult* @create_cnfresult(%struct.cnfnode* %14, i8* %15)
store %struct.cnfresult* %16, %struct.cnfresult** %7
br label %30
17: ; preds = %3
%18 = load %struct.cnfnode*, %struct.cnfnode** %4
%19 = load i32, i32* %6
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %25
23: ; preds = %17
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
br label %25
25: ; preds = %23, %22
%26 = phi i8* [ null, %22 ], [ %24, %23 ]
%27 = load i8*, i8** %5
%28 = load i32, i32* %6
%29 = call i32 @_cnf_find_entry(%struct.cnfresult** %7, %struct.cnfnode* %18, i8* %26, i8* %27, i32 %28)
br label %30
30: ; preds = %25, %13
%31 = load %struct.cnfresult*, %struct.cnfresult** %7
ret %struct.cnfresult* %31
}

LLVM IR (-O2):
%struct.cnfresult = type { i32 }
%struct.cnfnode = type { i32 }
@.str = [2 x i8] c".\00"
define %struct.cnfresult* @cnf_find_entry_f(%struct.cnfnode* %0, i8* %1, i32 %2) {
%4 = alloca %struct.cnfresult*
%5 = alloca [256 x i8]
%6 = bitcast %struct.cnfresult** %4 to i8*
store %struct.cnfresult* null, %struct.cnfresult** %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
store i8 0, i8* %7
%8 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call %struct.cnfresult* @create_cnfresult(%struct.cnfnode* %0, i8* %1)
br label %18
12: ; preds = %3
%13 = and i32 %2, 1
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* %7, i8* null
%16 = call i32 @_cnf_find_entry(%struct.cnfresult** %4, %struct.cnfnode* %0, i8* %15, i8* %1, i32 %2)
%17 = load %struct.cnfresult*, %struct.cnfresult** %4
br label %18
18: ; preds = %12, %10
%19 = phi %struct.cnfresult* [ %17, %12 ], [ %11, %10 ]
ret %struct.cnfresult* %19
}