#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_cdparanoia_output_read_offset(char *buf, int begin, int end) {
  int i;
  i = begin;
  do {
    while (buf[i] != '=' && i <= end - 16)
      i++;
    if (buf[i + 3] == 'P' && isdigit(buf[i + 16 + 30 + 3]))
      return i + 16;
    else
      i++;
  } while (i <= end - 16);
  return -1;
}


x86 assembly (clang, -O0):
<find_cdparanoia_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_cdparanoia_output_read_offset+0x1d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x3d,%ecx
mov    %al,-0x1d(%rbp)
je     1158 <find_cdparanoia_output_read_offset+0x48>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x10,%ecx
cmp    %ecx,%eax
setle  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1168 <find_cdparanoia_output_read_offset+0x58>
jmp    1176 <find_cdparanoia_output_read_offset+0x66>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <find_cdparanoia_output_read_offset+0x1d>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x50,%eax
jne    11c4 <find_cdparanoia_output_read_offset+0xb4>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x10,%ecx
add    $0x1e,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11c4 <find_cdparanoia_output_read_offset+0xb4>
mov    -0x1c(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x4(%rbp)
jmp    11ea <find_cdparanoia_output_read_offset+0xda>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d2 <find_cdparanoia_output_read_offset+0xc2>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x10,%ecx
cmp    %ecx,%eax
jle    1128 <find_cdparanoia_output_read_offset+0x18>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_cdparanoia_output_read_offset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %esi,%ebx
mov    %rdi,%rbp
movabs $0x100000000,%r15
add    $0xfffffff0,%r13d
movslq %r13d,%r12
movabs $0x3000000000,%r9
movabs $0x200000000,%r14
jmp    115b <find_cdparanoia_output_read_offset+0x4b>
nopw   0x0(%rax,%rax,1)
lea    -0x10(%rbx),%eax
add    $0xfffffff1,%ebx
cmp    %eax,%r13d
jle    11b6 <find_cdparanoia_output_read_offset+0xa6>
movslq %ebx,%rsi
lea    0xf(%rsi),%ebx
mov    %rsi,%rcx
shl    $0x20,%rcx
lea    (%rcx,%r9,1),%rax
add    %r14,%rcx
nop
add    $0x1,%ebx
add    %r15,%rax
add    %r15,%rcx
cmpb   $0x3d,0x0(%rbp,%rsi,1)
je     118c <find_cdparanoia_output_read_offset+0x7c>
lea    0x1(%rsi),%rdi
cmp    %r12,%rsi
mov    %rdi,%rsi
jle    1170 <find_cdparanoia_output_read_offset+0x60>
sar    $0x20,%rcx
cmpb   $0x50,0x0(%rbp,%rcx,1)
jne    1150 <find_cdparanoia_output_read_offset+0x40>
sar    $0x20,%rax
movsbl 0x0(%rbp,%rax,1),%edi
call   1030 <isdigit@plt>
movabs $0x3000000000,%r9
test   %rax,%rax
je     1150 <find_cdparanoia_output_read_offset+0x40>
jmp    11bb <find_cdparanoia_output_read_offset+0xab>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_cdparanoia_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 = %56, %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, 61
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, 16
%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, 3
%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, 80
br i1 %37, label %38, label %52
38: ; preds = %29
%39 = load i8*, i8** %5
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 16
%42 = add nsw i32 %41, 30
%43 = add nsw i32 %42, 3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %39, i64 %44
%46 = load i8, i8* %45
%47 = call i64 @isdigit(i8 signext %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %38
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 16
store i32 %51, i32* %4
br label %62
52: ; preds = %38, %29
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %55
55: ; preds = %52
br label %56
56: ; preds = %55
%57 = load i32, i32* %8
%58 = load i32, i32* %7
%59 = sub nsw i32 %58, 16
%60 = icmp sle i32 %57, %59
br i1 %60, label %10, label %61
61: ; preds = %56
store i32 -1, i32* %4
br label %62
62: ; preds = %61, %49
%63 = load i32, i32* %4
ret i32 %63
}

LLVM IR (-O2):
define i32 @find_cdparanoia_output_read_offset(i8* nocapture %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -16
%5 = sext i32 %4 to i64
br label %6
6: ; preds = %36, %3
%7 = phi i32 [ %1, %3 ], [ %37, %36 ]
%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, 61
%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 = shl i64 %10, 32
%20 = add i64 %19, 12884901888
%21 = ashr exact i64 %20, 32
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 80
br i1 %24, label %25, label %36
25: ; preds = %17
%26 = shl i64 %10, 32
%27 = add i64 %26, 210453397504
%28 = ashr exact i64 %27, 32
%29 = getelementptr inbounds i8, i8* %0, i64 %28
%30 = load i8, i8* %29
%31 = tail call i64 @isdigit(i8 signext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %25
%34 = trunc i64 %10 to i32
%35 = add nsw i32 %34, 16
br label %39
36: ; preds = %25, %17
%37 = add nsw i32 %18, 1
%38 = icmp sgt i32 %4, %18
br i1 %38, label %6, label %39
39: ; preds = %36, %33
%40 = phi i32 [ %35, %33 ], [ -1, %36 ]
ret i32 %40
}