#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 yaffs_dev {
  int dummy;
};

/* Variables and functions */
struct yaffs_dev *yaffsfs_FindDevice(char const *, char **);
struct yaffs_dev *yaffsfs_FindMountPoint(const char *path) {
  struct yaffs_dev *dev;
  char *restOfPath = (0);
  dev = yaffsfs_FindDevice(path, &restOfPath);
  if (dev && restOfPath && *restOfPath)
    dev = (0);
  return dev;
}


x86 assembly (clang, -O0):
<yaffsfs_FindMountPoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <yaffsfs_FindDevice@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1163 <yaffsfs_FindMountPoint+0x53>
cmpq   $0x0,-0x18(%rbp)
je     1163 <yaffsfs_FindMountPoint+0x53>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1163 <yaffsfs_FindMountPoint+0x53>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaffsfs_FindMountPoint>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <yaffsfs_FindDevice@plt>
test   %rax,%rax
je     1138 <yaffsfs_FindMountPoint+0x28>
mov    (%rsp),%rcx
test   %rcx,%rcx
je     1138 <yaffsfs_FindMountPoint+0x28>
xor    %edx,%edx
cmpb   $0x0,(%rcx)
cmovne %rdx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.yaffs_dev = type { i32 }
define %struct.yaffs_dev* @yaffsfs_FindMountPoint(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.yaffs_dev*
%4 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %4
%5 = load i8*, i8** %2
%6 = call %struct.yaffs_dev* @yaffsfs_FindDevice(i8* %5, i8** %4)
store %struct.yaffs_dev* %6, %struct.yaffs_dev** %3
%7 = load %struct.yaffs_dev*, %struct.yaffs_dev** %3
%8 = icmp ne %struct.yaffs_dev* %7, null
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
store %struct.yaffs_dev* null, %struct.yaffs_dev** %3
br label %18
18: ; preds = %17, %12, %9, %1
%19 = load %struct.yaffs_dev*, %struct.yaffs_dev** %3
ret %struct.yaffs_dev* %19
}

LLVM IR (-O2):
%struct.yaffs_dev = type { i32 }
define %struct.yaffs_dev* @yaffsfs_FindMountPoint(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call %struct.yaffs_dev* @yaffsfs_FindDevice(i8* %0, i8** %2)
%5 = icmp ne %struct.yaffs_dev* %4, null
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
%12 = select i1 %11, %struct.yaffs_dev* %4, %struct.yaffs_dev* null
br label %13
13: ; preds = %9, %1
%14 = phi %struct.yaffs_dev* [ %4, %1 ], [ %12, %9 ]
ret %struct.yaffs_dev* %14
}