#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 */
char file_match(char *, char *, char);
int /*<<< orphan*/ strchop(char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char dos_file_match_ignore_spaces(const char *a, const char *b, char is_dir) {
  char A[1024];
  char B[1024];
  if (a) {
    strncpy(A, a, 1024);
    strchop(A);
  }
  if (b) {
    strncpy(B, b, 1024);
    strchop(B);
  }
  char matched;
  matched = file_match(a ? A : 0, b ? B : 0, is_dir);
  return (matched);
}


x86 assembly (clang, -O0):
<dos_file_match_ignore_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1174 <dos_file_match_ignore_spaces+0x44>
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    -0x420(%rbp),%rdi
call   1040 <strchop@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a0 <dos_file_match_ignore_spaces+0x70>
lea    -0x820(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    -0x820(%rbp),%rdi
call   1040 <strchop@plt>
cmpq   $0x0,-0x8(%rbp)
je     11be <dos_file_match_ignore_spaces+0x8e>
lea    -0x420(%rbp),%rax
mov    %rax,-0x830(%rbp)
jmp    11cc <dos_file_match_ignore_spaces+0x9c>
xor    %eax,%eax
mov    %rax,-0x830(%rbp)
jmp    11cc <dos_file_match_ignore_spaces+0x9c>
mov    -0x830(%rbp),%rax
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11f8 <dos_file_match_ignore_spaces+0xc8>
lea    -0x820(%rbp),%rax
mov    %rax,-0x840(%rbp)
jmp    1206 <dos_file_match_ignore_spaces+0xd6>
xor    %eax,%eax
mov    %rax,-0x840(%rbp)
jmp    1206 <dos_file_match_ignore_spaces+0xd6>
mov    -0x838(%rbp),%rdi
mov    -0x840(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1050 <file_match@plt>
mov    %al,-0x821(%rbp)
movsbl -0x821(%rbp),%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dos_file_match_ignore_spaces>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x808,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
test   %rdi,%rdi
je     1166 <dos_file_match_ignore_spaces+0x36>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    %rbp,%rdi
call   1040 <strchop@plt>
test   %r15,%r15
je     118d <dos_file_match_ignore_spaces+0x5d>
lea    0x400(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
mov    %rbp,%rdi
call   1040 <strchop@plt>
jmp    118f <dos_file_match_ignore_spaces+0x5f>
xor    %ebp,%ebp
test   %rbx,%rbx
mov    %rsp,%rdi
cmove  %rbx,%rdi
movsbl %r14b,%edx
mov    %rbp,%rsi
call   1050 <file_match@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @dos_file_match_ignore_spaces(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32 @strncpy(i8* %13, i8* %14, i32 1024)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%17 = call i32 @strchop(i8* %16)
br label %18
18: ; preds = %12, %3
%19 = load i8*, i8** %5
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%23 = load i8*, i8** %5
%24 = call i32 @strncpy(i8* %22, i8* %23, i32 1024)
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%26 = call i32 @strchop(i8* %25)
br label %27
27: ; preds = %21, %18
%28 = load i8*, i8** %4
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
br label %33
32: ; preds = %27
br label %33
33: ; preds = %32, %30
%34 = phi i8* [ %31, %30 ], [ null, %32 ]
%35 = load i8*, i8** %5
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
br label %40
39: ; preds = %33
br label %40
40: ; preds = %39, %37
%41 = phi i8* [ %38, %37 ], [ null, %39 ]
%42 = load i8, i8* %6
%43 = call signext i8 @file_match(i8* %34, i8* %41, i8 signext %42)
store i8 %43, i8* %9
%44 = load i8, i8* %9
ret i8 %44
}

LLVM IR (-O2):
define signext i8 @dos_file_match_ignore_spaces(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%8 = icmp eq i8* %0, null
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = call i32 @strncpy(i8* %6, i8* %0, i32 1024)
%11 = call i32 @strchop(i8* %6)
br label %12
12: ; preds = %9, %3
%13 = icmp eq i8* %1, null
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = call i32 @strncpy(i8* %7, i8* %1, i32 1024)
%16 = call i32 @strchop(i8* %7)
br label %17
17: ; preds = %14, %12
%18 = phi i8* [ %7, %14 ], [ null, %12 ]
%19 = select i1 %8, i8* null, i8* %6
%20 = call signext i8 @file_match(i8* %19, i8* %18, i8 signext %2)
ret i8 %20
}