#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_CUR;
int /*<<< orphan*/ error(char *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void seekfiles(FILE *fp[], int nscores, int d) {
  if (!d)
    return;
  int f;
  for (f = 0; f < nscores; f++)
    if (fseek(fp[f], d * sizeof(float), SEEK_CUR))
      error("Failed to seek\n");
}


x86 assembly (clang, -O0):
<seekfiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1141 <seekfiles+0x21>
jmp    11a1 <seekfiles+0x81>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a1 <seekfiles+0x81>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
call   1030 <fseek@plt>
cmp    $0x0,%rax
je     118e <seekfiles+0x6e>
lea    0xe77(%rip),%rdi
call   1040 <error@plt>
jmp    1193 <seekfiles+0x73>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <seekfiles+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seekfiles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
je     1188 <seekfiles+0x68>
test   %esi,%esi
jle    1188 <seekfiles+0x68>
mov    %edx,%r12d
mov    %rdi,%r14
shl    $0x2,%r12d
mov    %esi,%ebx
xor    %ebp,%ebp
mov    0x2ea0(%rip),%r13
lea    0xeb1(%rip),%r15
jmp    1169 <seekfiles+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1188 <seekfiles+0x68>
mov    (%r14,%rbp,8),%rdi
mov    0x0(%r13),%edx
mov    %r12d,%esi
call   1030 <fseek@plt>
test   %rax,%rax
je     1160 <seekfiles+0x40>
mov    %r15,%rdi
call   1040 <error@plt>
jmp    1160 <seekfiles+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@.str = [16 x i8] c"Failed to seek\0A\00"
define void @seekfiles(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3
br label %35
11: ; preds = %3
store i32 0, i32* %7
br label %12
12: ; preds = %32, %11
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = load i32**, i32*** %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32*, i32** %17, i64 %19
%21 = load i32*, i32** %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 4
%25 = trunc i64 %24 to i32
%26 = load i32, i32* @SEEK_CUR
%27 = call i64 @fseek(i32* %21, i32 %25, i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %16
%30 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %12
35: ; preds = %10, %12
ret void
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@.str = [16 x i8] c"Failed to seek\0A\00"
define void @seekfiles(i32** nocapture %0, i32 %1, i32 %2) {
%4 = icmp ne i32 %2, 0
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %22
7: ; preds = %3
%8 = shl i32 %2, 2
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %7, %19
%11 = phi i64 [ 0, %7 ], [ %20, %19 ]
%12 = getelementptr inbounds i32*, i32** %0, i64 %11
%13 = load i32*, i32** %12
%14 = load i32, i32* @SEEK_CUR
%15 = tail call i64 @fseek(i32* %13, i32 %8, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %10, %17
%20 = add nuw nsw i64 %11, 1
%21 = icmp eq i64 %20, %9
br i1 %21, label %22, label %10
22: ; preds = %19, %3
ret void
}