#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__ isdigit(char);
int find_a8hz_mp3_output_read_offset(char *buf, int begin, int end) {
  int i;
  i = begin;
  do {
    while (buf[i] != 'F' && i <= end - 5)
      i++;
    if (buf[i + 1] == 'r' && isdigit(buf[i + 11]))
      return i + 5;
    else
      i++;
  } while (i <= end - 5);
  return -1;
}


x86 assembly (clang, -O0):
<find_a8hz_mp3_output_read_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <find_a8hz_mp3_output_read_offset+0x1d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x46,%ecx
mov    %al,-0x1d(%rbp)
je     1158 <find_a8hz_mp3_output_read_offset+0x48>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
setle  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1168 <find_a8hz_mp3_output_read_offset+0x58>
jmp    1176 <find_a8hz_mp3_output_read_offset+0x66>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <find_a8hz_mp3_output_read_offset+0x1d>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x72,%eax
jne    11be <find_a8hz_mp3_output_read_offset+0xae>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0xb,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11be <find_a8hz_mp3_output_read_offset+0xae>
mov    -0x1c(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x4(%rbp)
jmp    11e4 <find_a8hz_mp3_output_read_offset+0xd4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cc <find_a8hz_mp3_output_read_offset+0xbc>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
jle    1128 <find_a8hz_mp3_output_read_offset+0x18>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_a8hz_mp3_output_read_offset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
add    $0xfffffffb,%r14d
movslq %r14d,%r12
movabs $0xa00000000,%rsi
movabs $0x100000000,%r13
jmp    1158 <find_a8hz_mp3_output_read_offset+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xfffffffb,%ebp
cmp    %ebp,%r14d
jle    11b3 <find_a8hz_mp3_output_read_offset+0xa3>
movslq %r15d,%rcx
lea    0x4(%rcx),%ebp
mov    %rcx,%rax
shl    $0x20,%rax
add    %rsi,%rax
nopl   0x0(%rax,%rax,1)
add    %r13,%rax
add    $0x1,%ebp
cmpb   $0x46,(%rbx,%rcx,1)
je     1188 <find_a8hz_mp3_output_read_offset+0x78>
lea    0x1(%rcx),%rdi
cmp    %r12,%rcx
mov    %rdi,%rcx
jle    1170 <find_a8hz_mp3_output_read_offset+0x60>
lea    -0x4(%rbp),%r15d
movslq %r15d,%rcx
cmpb   $0x72,(%rbx,%rcx,1)
jne    1150 <find_a8hz_mp3_output_read_offset+0x40>
sar    $0x20,%rax
movsbl (%rbx,%rax,1),%edi
call   1030 <isdigit@plt>
movabs $0xa00000000,%rsi
test   %rax,%rax
je     1150 <find_a8hz_mp3_output_read_offset+0x40>
jmp    11b8 <find_a8hz_mp3_output_read_offset+0xa8>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_a8hz_mp3_output_read_offset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
store i32 %9, i32* %8
br label %10
10: ; preds = %54, %3
br label %11
11: ; preds = %26, %10
%12 = load i8*, i8** %5
%13 = load i32, i32* %8
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 70
br i1 %18, label %19, label %24
19: ; preds = %11
%20 = load i32, i32* %8
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 5
%23 = icmp sle i32 %20, %22
br label %24
24: ; preds = %19, %11
%25 = phi i1 [ false, %11 ], [ %23, %19 ]
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %11
29: ; preds = %24
%30 = load i8*, i8** %5
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 114
br i1 %37, label %38, label %50
38: ; preds = %29
%39 = load i8*, i8** %5
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
%44 = load i8, i8* %43
%45 = call i64 @isdigit(i8 signext %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %38
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 5
store i32 %49, i32* %4
br label %60
50: ; preds = %38, %29
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
br label %53
53: ; preds = %50
br label %54
54: ; preds = %53
%55 = load i32, i32* %8
%56 = load i32, i32* %7
%57 = sub nsw i32 %56, 5
%58 = icmp sle i32 %55, %57
br i1 %58, label %10, label %59
59: ; preds = %54
store i32 -1, i32* %4
br label %60
60: ; preds = %59, %47
%61 = load i32, i32* %4
ret i32 %61
}

LLVM IR (-O2):
define i32 @find_a8hz_mp3_output_read_offset(i8* nocapture %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -5
%5 = sext i32 %4 to i64
br label %6
6: ; preds = %35, %3
%7 = phi i32 [ %1, %3 ], [ %19, %35 ]
%8 = sext i32 %7 to i64
br label %9
9: ; preds = %9, %6
%10 = phi i64 [ %16, %9 ], [ %8, %6 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 70
%14 = icmp sle i64 %10, %5
%15 = select i1 %13, i1 %14, i1 false
%16 = add i64 %10, 1
br i1 %15, label %9, label %17
17: ; preds = %9
%18 = trunc i64 %10 to i32
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 114
br i1 %23, label %24, label %35
24: ; preds = %17
%25 = shl i64 %10, 32
%26 = add i64 %25, 47244640256
%27 = ashr exact i64 %26, 32
%28 = getelementptr inbounds i8, i8* %0, i64 %27
%29 = load i8, i8* %28
%30 = tail call i64 @isdigit(i8 signext %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %24
%33 = trunc i64 %10 to i32
%34 = add nsw i32 %33, 5
br label %37
35: ; preds = %24, %17
%36 = icmp sgt i32 %4, %18
br i1 %36, label %6, label %37
37: ; preds = %35, %32
%38 = phi i32 [ %34, %32 ], [ -1, %35 ]
ret i32 %38
}