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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
void ConvertEntryPath(char *path, char *filename, char *extension) {
  char *p;
  assert(path && filename && extension);
  memcpy(path, filename, 8);
  p = path + 7;
  while (*p == ' ')
    p--;
  if (memcmp(extension, "   ", 3) != 0) {
    p++;
    *p = '.';
    p++;
    memcpy(p, extension, 3);
    p += 2;
    while (*p == ' ')
      p--;
  }
  *(p + 1) = '\0';
}


x86 assembly (clang, -O0):
<ConvertEntryPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x21(%rbp)
je     116f <ConvertEntryPath+0x3f>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     116f <ConvertEntryPath+0x3f>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11bb <ConvertEntryPath+0x8b>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    119a <ConvertEntryPath+0x6a>
mov    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     123d <ConvertEntryPath+0x10d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x2e,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1238 <ConvertEntryPath+0x108>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1217 <ConvertEntryPath+0xe7>
jmp    123d <ConvertEntryPath+0x10d>
mov    -0x20(%rbp),%rax
movb   $0x0,0x1(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertEntryPath>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
test   %rdx,%rdx
setne  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
add    $0xd,%rbx
cmpb   $0x20,-0x6(%rbx)
lea    -0x1(%rbx),%rbx
je     1170 <ConvertEntryPath+0x40>
lea    0xe7f(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
je     11bf <ConvertEntryPath+0x8f>
movb   $0x2e,-0x4(%rbx)
lea    -0x3(%rbx),%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%rax
cmpb   $0x20,-0x1(%rbx)
mov    %rax,%rbx
je     11b0 <ConvertEntryPath+0x80>
jmp    11c6 <ConvertEntryPath+0x96>
add    $0xfffffffffffffffb,%rbx
mov    %rbx,%rax
movb   $0x0,0x1(%rax)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \00"
define void @ConvertEntryPath(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br label %16
16: ; preds = %13, %10, %3
%17 = phi i1 [ false, %10 ], [ false, %3 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = call i32 @memcpy(i8* %20, i8* %21, i32 8)
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 7
store i8* %24, i8** %7
br label %25
25: ; preds = %30, %16
%26 = load i8*, i8** %7
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 32
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i8*, i8** %7
%32 = getelementptr inbounds i8, i8* %31, i32 -1
store i8* %32, i8** %7
br label %25
33: ; preds = %25
%34 = load i8*, i8** %6
%35 = call i64 @memcmp(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %57
37: ; preds = %33
%38 = load i8*, i8** %7
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %7
%40 = load i8*, i8** %7
store i8 46, i8* %40
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %7
%43 = load i8*, i8** %7
%44 = load i8*, i8** %6
%45 = call i32 @memcpy(i8* %43, i8* %44, i32 3)
%46 = load i8*, i8** %7
%47 = getelementptr inbounds i8, i8* %46, i64 2
store i8* %47, i8** %7
br label %48
48: ; preds = %53, %37
%49 = load i8*, i8** %7
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 32
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = load i8*, i8** %7
%55 = getelementptr inbounds i8, i8* %54, i32 -1
store i8* %55, i8** %7
br label %48
56: ; preds = %48
br label %57
57: ; preds = %56, %33
%58 = load i8*, i8** %7
%59 = getelementptr inbounds i8, i8* %58, i64 1
store i8 0, i8* %59
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \00"
define void @ConvertEntryPath(i8* %0, i8* %1, i8* %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
%7 = icmp ne i8* %2, null
%8 = and i1 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @memcpy(i8* %0, i8* %1, i32 8)
%12 = getelementptr inbounds i8, i8* %0, i64 7
br label %13
13: ; preds = %13, %3
%14 = phi i8* [ %12, %3 ], [ %17, %13 ]
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 32
%17 = getelementptr inbounds i8, i8* %14, i64 -1
br i1 %16, label %13, label %18
18: ; preds = %13
%19 = tail call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%20 = icmp eq i64 %19, 0
br i1 %20, label %31, label %21
21: ; preds = %18
%22 = getelementptr inbounds i8, i8* %14, i64 1
store i8 46, i8* %22
%23 = getelementptr inbounds i8, i8* %14, i64 2
%24 = tail call i32 @memcpy(i8* %23, i8* %2, i32 3)
%25 = getelementptr inbounds i8, i8* %14, i64 4
br label %26
26: ; preds = %26, %21
%27 = phi i8* [ %25, %21 ], [ %30, %26 ]
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 32
%30 = getelementptr inbounds i8, i8* %27, i64 -1
br i1 %29, label %26, label %31
31: ; preds = %26, %18
%32 = phi i8* [ %14, %18 ], [ %27, %26 ]
%33 = getelementptr inbounds i8, i8* %32, i64 1
store i8 0, i8* %33
ret void
}