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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
scalar_t__ fseeko(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void check_fseeko(FILE *stream, off_t offset, int whence) {
  if (fseeko(stream, offset, whence) < 0) {
    fprintf(stderr, "[Error] Seek error in fileno %d: ", fileno(stream));
    perror(NULL);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_fseeko>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <fseeko@plt>
cmp    $0x0,%rax
jge    11b4 <check_fseeko+0x64>
mov    0x2e5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fileno@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
lea    0xe64(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fseeko>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <fseeko@plt>
test   %rax,%rax
js     1167 <check_fseeko+0x17>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e72(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1040 <fileno@plt>
lea    0xe81(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"[Error] Seek error in fileno %d: \00"
define void @check_fseeko(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @fseeko(i32* %7, i32 %8, i32 %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = load i32*, i32** %4
%15 = call i32 @fileno(i32* %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @perror(i32* null)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"[Error] Seek error in fileno %d: \00"
define void @check_fseeko(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i64 @fseeko(i32* %0, i32 %1, i32 %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fileno(i32* %0)
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @perror(i32* null)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3
ret void
}