#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*/ Str;

/* Variables and functions */
int /*<<< orphan*/ L3IsDir(char *);
int /*<<< orphan*/ strcatSafe(char *, int, char *);
int /*<<< orphan*/ strcpySafe(char *, int, char const *);
int DirHasPandPARTS(const char *PossibleLDrawDir) {
  char Str[1024];
  strcpySafe(Str, sizeof(Str), PossibleLDrawDir);
  strcatSafe(Str, sizeof(Str),
             "/"
             "P");
  if (!L3IsDir(Str))
    return 0;
  strcatSafe(Str, sizeof(Str), "ARTS");
  if (!L3IsDir(Str))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<DirHasPandPARTS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1040 <strcpySafe@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
lea    0xe99(%rip),%rdx
call   1030 <strcatSafe@plt>
lea    -0x410(%rbp),%rdi
call   1050 <L3IsDir@plt>
cmp    $0x0,%eax
jne    118d <DirHasPandPARTS+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    11cd <DirHasPandPARTS+0x9d>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
lea    0xe63(%rip),%rdx
call   1030 <strcatSafe@plt>
lea    -0x410(%rbp),%rdi
call   1050 <L3IsDir@plt>
cmp    $0x0,%eax
jne    11c6 <DirHasPandPARTS+0x96>
movl   $0x0,-0x4(%rbp)
jmp    11cd <DirHasPandPARTS+0x9d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DirHasPandPARTS>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <strcpySafe@plt>
lea    0xeae(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <strcatSafe@plt>
mov    %rbx,%rdi
call   1050 <L3IsDir@plt>
test   %eax,%eax
je     1195 <DirHasPandPARTS+0x65>
lea    0xe91(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <strcatSafe@plt>
mov    %rbx,%rdi
call   1050 <L3IsDir@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    1197 <DirHasPandPARTS+0x67>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"/P\00"
@.str.1 = [5 x i8] c"ARTS\00"
define i32 @DirHasPandPARTS(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @strcpySafe(i8* %5, i32 1024, i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = call i32 @strcatSafe(i8* %8, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @L3IsDir(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %1
store i32 0, i32* %2
br label %22
14: ; preds = %1
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%16 = call i32 @strcatSafe(i8* %15, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = call i32 @L3IsDir(i8* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %14
store i32 0, i32* %2
br label %22
21: ; preds = %14
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %13
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"/P\00"
@.str.1 = [5 x i8] c"ARTS\00"
define i32 @DirHasPandPARTS(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpySafe(i8* %3, i32 1024, i8* %0)
%5 = call i32 @strcatSafe(i8* %3, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @L3IsDir(i8* %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = call i32 @strcatSafe(i8* %3, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @L3IsDir(i8* %3)
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %1
%14 = phi i32 [ 0, %1 ], [ %12, %8 ]
ret i32 %14
}