#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 */
scalar_t__ find_in_line(int, char *);
scalar_t__ is_range_in_range(int, int);
void find_in_range(int start, int end, char searchstr[80]) {
  int i = 0;
  if (is_range_in_range(start, end)) {
    for (i = start; i <= end; i++) {
      if (find_in_line(i, searchstr) == 0) {
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<find_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <is_range_in_range@plt>
cmp    $0x0,%rax
je     1193 <find_in_range+0x73>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     118e <find_in_range+0x6e>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <find_in_line@plt>
cmp    $0x0,%rax
jne    117b <find_in_range+0x5b>
jmp    118e <find_in_range+0x6e>
jmp    1180 <find_in_range+0x60>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <find_in_range+0x34>
jmp    1193 <find_in_range+0x73>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_in_range>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <is_range_in_range@plt>
test   %rax,%rax
je     1158 <find_in_range+0x38>
cmp    %ebp,%ebx
jg     1158 <find_in_range+0x38>
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <find_in_line@plt>
test   %rax,%rax
je     1158 <find_in_range+0x38>
lea    0x1(%rbx),%eax
cmp    %ebx,%ebp
mov    %eax,%ebx
jne    1140 <find_in_range+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @find_in_range(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i64 @is_range_in_range(i32 %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %3
%13 = load i32, i32* %4
store i32 %13, i32* %7
br label %14
14: ; preds = %25, %12
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32, i32* %7
%20 = load i8*, i8** %6
%21 = call i64 @find_in_line(i32 %19, i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
br label %28
24: ; preds = %18
br label %25
25: ; preds = %24
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %14
28: ; preds = %23, %14
br label %29
29: ; preds = %28, %3
ret void
}

LLVM IR (-O2):
define void @find_in_range(i32 %0, i32 %1, i8* %2) {
%4 = tail call i64 @is_range_in_range(i32 %0, i32 %1)
%5 = icmp eq i64 %4, 0
%6 = icmp sgt i32 %0, %1
%7 = or i1 %5, %6
br i1 %7, label %15, label %8
8: ; preds = %3, %8
%9 = phi i32 [ %12, %8 ], [ %0, %3 ]
%10 = tail call i64 @find_in_line(i32 %9, i8* %2)
%11 = icmp eq i64 %10, 0
%12 = add i32 %9, 1
%13 = icmp eq i32 %9, %1
%14 = or i1 %11, %13
br i1 %14, label %15, label %8
15: ; preds = %8, %3
ret void
}