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


x86 assembly (clang, -O0):
<filename_substring_filter_nocase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%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   1050 <strstr@plt>
cmp    $0x0,%rax
jne    117d <filename_substring_filter_nocase+0x4d>
movl   $0x0,-0x24(%rbp)
jmp    1184 <filename_substring_filter_nocase+0x54>
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):
<filename_substring_filter_nocase>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <strToLower@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strToLower@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <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 @filename_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* @strToLower(i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = call i8* @strToLower(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32* @strstr(i8* %12, i8* %13)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 0, i32* %7
br label %18
17: ; preds = %2
store i32 1, i32* %7
br label %18
18: ; preds = %17, %16
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* %7
ret i32 %23
}

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