#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*/ EINVAL;
scalar_t__ KMP(char const *, int /*<<< orphan*/, int /*<<< orphan*/,
               char const *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strlen(char const *);
int IsSubstringOf(const char *target, const char *substring) {
  if (!target) {
    errno = EINVAL;
    return 0;
  }
  if (!substring) {
    errno = EINVAL;
    return 0;
  }
  return KMP(target, 0, strlen(target), substring, strlen(substring)) >= 0;
}


x86 assembly (clang, -O0):
<IsSubstringOf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <IsSubstringOf+0x39>
mov    0x2e96(%rip),%rax
mov    (%rax),%ecx
mov    0x2e95(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11cb <IsSubstringOf+0xab>
cmpq   $0x0,-0x18(%rbp)
jne    1182 <IsSubstringOf+0x62>
mov    0x2e6d(%rip),%rax
mov    (%rax),%ecx
mov    0x2e6c(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11cb <IsSubstringOf+0xab>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    %eax,%r8d
xor    %esi,%esi
call   1040 <KMP@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsSubstringOf>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     115e <IsSubstringOf+0x3e>
mov    %rsi,%r14
test   %rsi,%rsi
je     115e <IsSubstringOf+0x3e>
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
mov    %r14,%rcx
mov    %eax,%r8d
call   1040 <KMP@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
jmp    1172 <IsSubstringOf+0x52>
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
mov    0x2e72(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @IsSubstringOf(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = load i32, i32* @EINVAL
store i32 %9, i32* @errno
store i32 0, i32* %3
br label %25
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = load i32, i32* @EINVAL
store i32 %14, i32* @errno
store i32 0, i32* %3
br label %25
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = load i8*, i8** %5
%20 = load i8*, i8** %5
%21 = call i32 @strlen(i8* %20)
%22 = call i64 @KMP(i8* %16, i32 0, i32 %18, i8* %19, i32 %21)
%23 = icmp sge i64 %22, 0
%24 = zext i1 %23 to i32
store i32 %24, i32* %3
br label %25
25: ; preds = %15, %13, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @IsSubstringOf(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
br label %17
6: ; preds = %2
%7 = icmp eq i8* %1, null
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = load i32, i32* @EINVAL
store i32 %9, i32* @errno
br label %17
10: ; preds = %6
%11 = tail call i32 @strlen(i8* %0)
%12 = tail call i32 @strlen(i8* %1)
%13 = tail call i64 @KMP(i8* %0, i32 0, i32 %11, i8* %1, i32 %12)
%14 = lshr i64 %13, 63
%15 = trunc i64 %14 to i32
%16 = xor i32 %15, 1
br label %17
17: ; preds = %10, %8, %4
%18 = phi i32 [ %16, %10 ], [ 0, %8 ], [ 0, %4 ]
ret i32 %18
}