#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 *basename(char *);
int /*<<< orphan*/ free(char *);
char *strToLower(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int basename_substring_filter_nocase(char *filename, char *textcontent) {
  char *basenamei;
  basenamei = strToLower(basename(filename));
  char *textcontenti = strToLower(textcontent);
  int retval;
  if (strstr(basenamei, textcontenti) == NULL)
    retval = 0;
  else
    retval = 1;
  free(basenamei);
  free(textcontenti);
  return retval;
}


x86 assembly (clang, -O0):
<basename_substring_filter_nocase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rdi
call   1040 <strToLower@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strToLower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
jne    1195 <basename_substring_filter_nocase+0x55>
movl   $0x0,-0x24(%rbp)
jmp    119c <basename_substring_filter_nocase+0x5c>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename_substring_filter_nocase>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <basename@plt>
mov    %rax,%rdi
call   1040 <strToLower@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strToLower@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1060 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @basename_substring_filter_nocase(i8* %0, i8* %1) {
%3 = tail call i8* @basename(i8* %0)
%4 = tail call i8* @strToLower(i8* %3)
%5 = tail call i8* @strToLower(i8* %1)
%6 = tail call i32* @strstr(i8* dereferenceable(1) %4, i8* dereferenceable(1) %5)
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @free(i8* %4)
%10 = tail call i32 @free(i8* %5)
ret i32 %8
}