#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 strlen(char *);
int /*<<< orphan*/ strxcmp(char *, char *, int);
char strxstr(char s[], char str[]) {
  int i, n = strlen(s), n1 = strlen(str);
  for (i = 0; s[i]; i++)
    if (!strxcmp(s + i, str, n1))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<strxstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     119d <strxstr+0x7d>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strxcmp@plt>
cmp    $0x0,%eax
jne    118a <strxstr+0x6a>
movb   $0x1,-0x1(%rbp)
jmp    11a1 <strxstr+0x81>
jmp    118f <strxstr+0x6f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <strxstr+0x2f>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxstr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cmpb   $0x0,(%rbx)
je     115b <strxstr+0x3b>
mov    %eax,%ebp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <strxcmp@plt>
test   %eax,%eax
je     115f <strxstr+0x3f>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1140 <strxstr+0x20>
xor    %eax,%eax
jmp    1161 <strxstr+0x41>
mov    $0x1,%al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @strxstr(i8* %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %8
store i32 0, i32* %6
br label %13
13: ; preds = %31, %2
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %34
20: ; preds = %13
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8*, i8** %5
%26 = load i32, i32* %8
%27 = call i32 @strxcmp(i8* %24, i8* %25, i32 %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %20
store i8 1, i8* %3
br label %35
30: ; preds = %20
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %13
34: ; preds = %13
store i8 0, i8* %3
br label %35
35: ; preds = %34, %29
%36 = load i8, i8* %3
ret i8 %36
}

LLVM IR (-O2):
define signext i8 @strxstr(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %17, label %11
7: ; preds = %11
%8 = getelementptr inbounds i8, i8* %0, i64 %16
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %2, %7
%12 = phi i64 [ %16, %7 ], [ 0, %2 ]
%13 = phi i8* [ %8, %7 ], [ %0, %2 ]
%14 = tail call i32 @strxcmp(i8* %13, i8* %1, i32 %4)
%15 = icmp eq i32 %14, 0
%16 = add nuw i64 %12, 1
br i1 %15, label %17, label %7
17: ; preds = %11, %7, %2
%18 = phi i8 [ 0, %2 ], [ 0, %7 ], [ 1, %11 ]
ret i8 %18
}