#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 */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
unsigned char *binary_search(int /*<<< orphan*/ *, unsigned char *,
                             unsigned char *);
unsigned char *linear_search(int /*<<< orphan*/ *, unsigned char *,
                             unsigned char *);
int /*<<< orphan*/ print_from(int /*<<< orphan*/ *, unsigned char *,
                              unsigned char *);
int look(wchar_t *string, unsigned char *front, unsigned char *back) {
  front = binary_search(string, front, back);
  front = linear_search(string, front, back);
  if (front)
    print_from(string, front, back);
  return (front ? 0 : 1);
}


x86 assembly (clang, -O0):
<look>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <binary_search@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <linear_search@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <look+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <print_from@plt>
mov    -0x10(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<look>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%r15
call   1050 <binary_search@plt>
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <linear_search@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1164 <look+0x34>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <print_from@plt>
xor    %eax,%eax
test   %rbx,%rbx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @look(i32* %0, i8* %1, i8* %2) {
%4 = tail call i8* @binary_search(i32* %0, i8* %1, i8* %2)
%5 = tail call i8* @linear_search(i32* %0, i8* %4, i8* %2)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @print_from(i32* %0, i8* %5, i8* %2)
br label %9
9: ; preds = %7, %3
%10 = zext i1 %6 to i32
ret i32 %10
}