#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ errno;
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *strerror(int /*<<< orphan*/);
int sisSeek(FILE *fp, int off, char *err, int errlen) {
  if (fseek(fp, off, SEEK_SET) == -1) {
    snprintf(err, errlen, "seeking: %s", strerror(errno));
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sisSeek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
cmp    $0xffffffff,%eax
jne    11a2 <sisSeek+0x72>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    %rax,%rcx
lea    0xe6f(%rip),%rdx
call   1030 <snprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <sisSeek+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sisSeek>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    1176 <sisSeek+0x46>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe9c(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [12 x i8] c"seeking: %s\00"
@errno = global i32 0
define i32 @sisSeek(i32* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %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 @fseek(i32* %10, i32 %11, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %21
15: ; preds = %4
%16 = load i8*, i8** %8
%17 = load i32, i32* %9
%18 = load i32, i32* @errno
%19 = call i8* @strerror(i32 %18)
%20 = call i32 @snprintf(i8* %16, i32 %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %5
br label %22
21: ; preds = %4
store i32 0, i32* %5
br label %22
22: ; preds = %21, %15
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [12 x i8] c"seeking: %s\00"
@errno = global i32 0
define i32 @sisSeek(i32* nocapture %0, i32 %1, i8* %2, i32 %3) {
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 %1, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 @snprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %4, %8
%13 = phi i32 [ 1, %8 ], [ 0, %4 ]
ret i32 %13
}