#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);
scalar_t__ path_isparent(char *, char *);
void test_path_isparent() {
  assert(path_isparent("/dir1/dir2/", "/dir1/") != 0);
  assert(path_isparent("/dir1/dir2/", "/dir1") != 0);
  assert(path_isparent("/dir1/dir2/", "/dir") == 0);
  assert(path_isparent("/dir1/dir2/", "/dir1/dir2/sub/") == 0);
  assert(path_isparent("/dir1/dir2/", "/var/") == 0);
}


x86 assembly (clang, -O0):
<test_path_isparent>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1040 <path_isparent@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xeb1(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1040 <path_isparent@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe8d(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <path_isparent@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe69(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1040 <path_isparent@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xe45(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <path_isparent@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_path_isparent>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xedd(%rip),%rsi
mov    %rbx,%rdi
call   1040 <path_isparent@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <path_isparent@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <path_isparent@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
call   1040 <path_isparent@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <path_isparent@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"/dir1/dir2/\00"
@.str.1 = [7 x i8] c"/dir1/\00"
@.str.2 = [6 x i8] c"/dir1\00"
@.str.3 = [5 x i8] c"/dir\00"
@.str.4 = [16 x i8] c"/dir1/dir2/sub/\00"
@.str.5 = [6 x i8] c"/var/\00"
define void @test_path_isparent() {
%1 = call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dir1/dir2/\00"
@.str.1 = [7 x i8] c"/dir1/\00"
@.str.2 = [6 x i8] c"/dir1\00"
@.str.3 = [5 x i8] c"/dir\00"
@.str.4 = [16 x i8] c"/dir1/dir2/sub/\00"
@.str.5 = [6 x i8] c"/var/\00"
define void @test_path_isparent() {
%1 = tail call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i64 @path_isparent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
ret void
}