#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);
int match_path(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void test_match_path(void) {
  char s[256];
  assert(!match_path(strcpy(s, "/g/g53/foo"), "/g/g5"));
  assert(match_path(strcpy(s, "/g/g53/foo"), "/g/g53"));
  assert(!match_path(strcpy(s, "/g/g5/foo"), "/g/g53"));
  assert(match_path(strcpy(s, "/g/g5/foo"), "/g/g5"));
  assert(match_path(strcpy(s, "/g/g53/a/b/c/d/e/f/g/h/i/j"), "/g"));
  assert(match_path(strcpy(s, "/g/g53//a/b/c/d/e/f/g/h/i/j"), "/g/g53"));
  assert(match_path(strcpy(s, "/home/foo"), "/home"));
  assert(match_path(strcpy(s, "/home/foo"), "/home/foo"));
  assert(match_path(strcpy(s, "/a"), "/"));
  assert(match_path(strcpy(s, "/home/foo"), "/"));
}


x86 assembly (clang, -O0):
<test_match_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xeb4(%rip),%rsi
call   1040 <match_path@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe87(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe5f(%rip),%rsi
call   1040 <match_path@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe26(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe30(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xddc(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xe09(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xdd7(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xdcd(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xdc2(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    -0x100(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
lea    0xd9a(%rip),%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_match_path>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xebb(%rip),%rbx
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xeb1(%rip),%r15
mov    %eax,%edi
mov    %r15,%rsi
call   1040 <match_path@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe8e(%rip),%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe7d(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <match_path@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe42(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
lea    0xe4e(%rip),%rsi
mov    %eax,%edi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe3c(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe38(%rip),%r14
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe30(%rip),%rsi
mov    %eax,%edi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe05(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
lea    0xdf9(%rip),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <match_path@plt>
mov    %eax,%edi
call   1050 <assert@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/g/g53/foo\00"
@.str.1 = [6 x i8] c"/g/g5\00"
@.str.2 = [7 x i8] c"/g/g53\00"
@.str.3 = [10 x i8] c"/g/g5/foo\00"
@.str.4 = [27 x i8] c"/g/g53/a/b/c/d/e/f/g/h/i/j\00"
@.str.5 = [3 x i8] c"/g\00"
@.str.6 = [28 x i8] c"/g/g53//a/b/c/d/e/f/g/h/i/j\00"
@.str.7 = [10 x i8] c"/home/foo\00"
@.str.8 = [6 x i8] c"/home\00"
@.str.9 = [3 x i8] c"/a\00"
@.str.10 = [2 x i8] c"/\00"
define void @test_match_path() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @match_path(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @match_path(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @assert(i32 %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @match_path(i32 %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @match_path(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @match_path(i32 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @assert(i32 %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 @match_path(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 @match_path(i32 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%37 = call i32 @strcpy(i8* %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%38 = call i32 @match_path(i32 %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%41 = call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%42 = call i32 @match_path(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%43 = call i32 @assert(i32 %42)
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%46 = call i32 @match_path(i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%47 = call i32 @assert(i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"/g/g53/foo\00"
@.str.1 = [6 x i8] c"/g/g5\00"
@.str.2 = [7 x i8] c"/g/g53\00"
@.str.3 = [10 x i8] c"/g/g5/foo\00"
@.str.4 = [27 x i8] c"/g/g53/a/b/c/d/e/f/g/h/i/j\00"
@.str.5 = [3 x i8] c"/g\00"
@.str.6 = [28 x i8] c"/g/g53//a/b/c/d/e/f/g/h/i/j\00"
@.str.7 = [10 x i8] c"/home/foo\00"
@.str.8 = [6 x i8] c"/home\00"
@.str.9 = [3 x i8] c"/a\00"
@.str.10 = [2 x i8] c"/\00"
define void @test_match_path() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @match_path(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @match_path(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @assert(i32 %9)
%11 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @match_path(i32 %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @match_path(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @assert(i32 %17)
%19 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @match_path(i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @assert(i32 %20)
%22 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @match_path(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @assert(i32 %23)
%25 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 @match_path(i32 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%27 = call i32 @assert(i32 %26)
%28 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 @match_path(i32 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 @assert(i32 %29)
%31 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%32 = call i32 @match_path(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%33 = call i32 @assert(i32 %32)
%34 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%35 = call i32 @match_path(i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%36 = call i32 @assert(i32 %35)
ret void
}