#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 */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ fatinvalidpathlong(int /*<<< orphan*/ const *);
scalar_t__ wcschr(int /*<<< orphan*/ const *, int);
int /*<<< orphan*/ wcscmp(int /*<<< orphan*/ const *, char *);
int fatinvalidnamelong(const wchar_t *name) {
  if (fatinvalidpathlong(name))
    return -1;
  if (wcschr(name, L'/'))
    return -1;
  if (!wcscmp(name, L".") || !wcscmp(name, L".."))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<fatinvalidnamelong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fatinvalidpathlong@plt>
cmp    $0x0,%rax
je     115b <fatinvalidnamelong+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c4 <fatinvalidnamelong+0x94>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <wcschr@plt>
cmp    $0x0,%rax
je     117f <fatinvalidnamelong+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c4 <fatinvalidnamelong+0x94>
mov    -0x10(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1030 <wcscmp@plt>
cmp    $0x0,%eax
je     11b1 <fatinvalidnamelong+0x81>
mov    -0x10(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1030 <wcscmp@plt>
cmp    $0x0,%eax
jne    11bd <fatinvalidnamelong+0x8d>
movl   $0x1,-0x4(%rbp)
jmp    11c4 <fatinvalidnamelong+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatinvalidnamelong>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <fatinvalidpathlong@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    1188 <fatinvalidnamelong+0x58>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <wcschr@plt>
test   %rax,%rax
jne    1188 <fatinvalidnamelong+0x58>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <wcscmp@plt>
test   %eax,%eax
je     1183 <fatinvalidnamelong+0x53>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <wcscmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
jmp    1188 <fatinvalidnamelong+0x58>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i32] [i32 46, i32 0]
@.str.1 = [3 x i32] [i32 46, i32 46, i32 0]
define i32 @fatinvalidnamelong(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @fatinvalidpathlong(i32* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %23
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i64 @wcschr(i32* %9, i32 47)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 -1, i32* %2
br label %23
13: ; preds = %8
%14 = load i32*, i32** %3
%15 = call i32 @wcscmp(i32* %14, i8* bitcast ([2 x i32]* @.str to i8*))
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32*, i32** %3
%19 = call i32 @wcscmp(i32* %18, i8* bitcast ([3 x i32]* @.str.1 to i8*))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17, %13
store i32 1, i32* %2
br label %23
22: ; preds = %17
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %12, %7
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@.str = [2 x i32] [i32 46, i32 0]
@.str.1 = [3 x i32] [i32 46, i32 46, i32 0]
define i32 @fatinvalidnamelong(i32* %0) {
%2 = tail call i64 @fatinvalidpathlong(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = tail call i64 @wcschr(i32* %0, i32 47)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = tail call i32 @wcscmp(i32* %0, i8* bitcast ([2 x i32]* @.str to i8*))
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @wcscmp(i32* %0, i8* bitcast ([3 x i32]* @.str.1 to i8*))
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i32 [ -1, %1 ], [ -1, %4 ], [ 1, %7 ], [ %13, %10 ]
ret i32 %15
}