#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 __get_array_length(char const *);
int __infer_nondet_int();
int /*<<< orphan*/ __require_allocated_array(char const *);
char *strstr(const char *s1, const char *s2) {
  int size1, size2;
  int nondet;
  int offset;
  nondet = __infer_nondet_int();
  offset = __infer_nondet_int();
  __require_allocated_array(s1);
  size1 = __get_array_length(s1);
  __require_allocated_array(s2);
  if (nondet)
    return 0;
  if (offset < 0 || offset >= size1)
    while (1)
      ;
  return (char *)s1 + offset;
}


x86 assembly (clang, -O0):
<strstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <__require_allocated_array@plt>
mov    -0x10(%rbp),%rdi
call   1050 <__get_array_length@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <__require_allocated_array@plt>
cmpl   $0x0,-0x24(%rbp)
je     1189 <strstr+0x59>
movq   $0x0,-0x8(%rbp)
jmp    11b8 <strstr+0x88>
cmpl   $0x0,-0x28(%rbp)
jl     119f <strstr+0x6f>
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11a9 <strstr+0x79>
jmp    11a4 <strstr+0x74>
jmp    11a4 <strstr+0x74>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1040 <__require_allocated_array@plt>
mov    %rbx,%rdi
call   1050 <__get_array_length@plt>
mov    %eax,%r15d
mov    %r13,%rdi
call   1040 <__require_allocated_array@plt>
test   %ebp,%ebp
jne    1189 <strstr+0x59>
test   %r12d,%r12d
js     11a0 <strstr+0x70>
cmp    %r15d,%r12d
jge    11a0 <strstr+0x70>
mov    %r12d,%eax
add    %rax,%rbx
mov    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)
jmp    11a0 <strstr+0x70>

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

LLVM IR (-O2):
define i8* @strstr(i8* %0, i8* %1) {
%3 = tail call i32 (...) @__infer_nondet_int()
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = tail call i32 @__require_allocated_array(i8* %0)
%6 = tail call i32 @__get_array_length(i8* %0)
%7 = tail call i32 @__require_allocated_array(i8* %1)
%8 = icmp eq i32 %3, 0
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = icmp sgt i32 %4, -1
%11 = icmp slt i32 %4, %6
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %14, label %13
13: ; preds = %9, %13
br label %13
14: ; preds = %9
%15 = zext i32 %4 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
br label %17
17: ; preds = %2, %14
%18 = phi i8* [ %16, %14 ], [ null, %2 ]
ret i8* %18
}