#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*/ free(char *);
char *parent_parent_base_name(char const *);
int /*<<< orphan*/ strcmp(char *, char const *);
int parent_parent_base_name_is(const char *path, const char *str) {
  char *parent_parent_base;
  int result;
  parent_parent_base = parent_parent_base_name(path);
  if (!parent_parent_base)
    return 0;
  result = !strcmp(parent_parent_base, str);
  free(parent_parent_base);
  return result;
}


x86 assembly (clang, -O0):
<parent_parent_base_name_is>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <parent_parent_base_name@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1164 <parent_parent_base_name_is+0x34>
movl   $0x0,-0x4(%rbp)
jmp    1190 <parent_parent_base_name_is+0x60>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent_parent_base_name_is>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbp
call   1050 <parent_parent_base_name@plt>
test   %rax,%rax
je     1160 <parent_parent_base_name_is+0x30>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1162 <parent_parent_base_name_is+0x32>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parent_parent_base_name_is(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @parent_parent_base_name(i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 0, i32* %3
br label %23
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %5
%16 = call i32 @strcmp(i8* %14, i8* %15)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
store i32 %19, i32* %7
%20 = load i8*, i8** %6
%21 = call i32 @free(i8* %20)
%22 = load i32, i32* %7
store i32 %22, i32* %3
br label %23
23: ; preds = %13, %12
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @parent_parent_base_name_is(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @parent_parent_base_name(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* %3, i8* dereferenceable(1) %1)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @free(i8* %3)
br label %10
10: ; preds = %2, %5
%11 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %11
}