#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*/ u_int;
typedef int /*<<< orphan*/ u_char;
typedef int __off64_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int lseek64(int, int, int /*<<< orphan*/);
int read(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int ifoReadLB(int fd, __off64_t pos, u_int count, u_char *data) {
  if ((pos = lseek64(fd, pos, SEEK_SET)) == -1) {
    fprintf(stderr, "%s/%d: error in lseek\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/jcsteele/dxr2-linux/refs/heads/master/"
            "player/ifo.c",
            17);
    return -1;
  }
  return read(fd, data, count);
}


x86 assembly (clang, -O0):
<ifoReadLB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek64@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1192 <ifoReadLB+0x62>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
lea    0xe9b(%rip),%rdx
mov    $0x11,%ecx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a4 <ifoReadLB+0x74>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifoReadLB>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebx
mov    %edi,%ebp
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek64@plt>
cmp    $0xffffffff,%eax
je     115e <ifoReadLB+0x2e>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <read@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
lea    0xea2(%rip),%rdx
mov    $0x11,%ecx
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"%s/%d: error in lseek\0A\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jcsteele/dxr2-linux/refs/heads/master/player/ifo.c\00"
define i32 @ifoReadLB(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* @SEEK_SET
%13 = call i32 @lseek64(i32 %10, i32 %11, i32 %12)
store i32 %13, i32* %7
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 17)
store i32 -1, i32* %5
br label %23
18: ; preds = %4
%19 = load i32, i32* %6
%20 = load i32*, i32** %9
%21 = load i32, i32* %8
%22 = call i32 @read(i32 %19, i32* %20, i32 %21)
store i32 %22, i32* %5
br label %23
23: ; preds = %18, %15
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"%s/%d: error in lseek\0A\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jcsteele/dxr2-linux/refs/heads/master/player/ifo.c\00"
define i32 @ifoReadLB(i32 %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @lseek64(i32 %0, i32 %1, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 17)
br label %13
11: ; preds = %4
%12 = tail call i32 @read(i32 %0, i32* %3, i32 %2)
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ -1, %8 ], [ %12, %11 ]
ret i32 %14
}