#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ puts(char *);
int main(void) {
  FILE *myfile;
  char froot[14 + 1];
  int record, offset;
  if (!(myfile = fopen("froot.txt", "r"))) {
    puts("Error reading file");
    return 1;
  }
  for (record = 0; record < 25; record += 2) {
    offset = record * 14;
    fseek(myfile, offset, SEEK_SET);
    fread(froot, 14, 1, myfile);
    printf("%d : %s\n", (ftell(myfile)) / 14, froot);
  }
  fclose(myfile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11b8 <main+0x48>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    123d <main+0xcd>
movl   $0x0,-0x24(%rbp)
cmpl   $0x19,-0x24(%rbp)
jge    122d <main+0xbd>
imul   $0xe,-0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2e02(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
lea    -0x1f(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xe,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x10(%rbp),%rdi
call   1070 <ftell@plt>
mov    $0xe,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x1f(%rbp),%rdx
lea    0xe05(%rip),%rdi
call   1060 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    11bf <main+0x4f>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe7b(%rip),%rdi
lea    0xe7e(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1227 <main+0xb7>
mov    %rax,%r12
mov    $0xfffffffe,%ebx
xor    %ebp,%ebp
mov    0x2e35(%rip),%r13
lea    0x9(%rsp),%r14
lea    0xe68(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edx
mov    %r12,%rdi
mov    %ebp,%esi
call   1080 <fseek@plt>
mov    %r14,%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
mov    %r12,%rdi
call   1070 <ftell@plt>
movslq %eax,%rsi
imul   $0xffffffff92492493,%rsi,%rax
shr    $0x20,%rax
add    %eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x3,%esi
add    %eax,%esi
mov    %r15,%rdi
mov    %r14,%rdx
call   1060 <printf@plt>
add    $0x2,%ebx
add    $0x1c,%ebp
cmp    $0x17,%ebx
jb     11c0 <main+0x50>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    1238 <main+0xc8>
lea    0xdde(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"froot.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Error reading file\00"
@SEEK_SET = global i32 0
@.str.3 = [9 x i8] c"%d : %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [15 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = icmp ne i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %35
10: ; preds = %0
store i32 0, i32* %4
br label %11
11: ; preds = %29, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 25
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 14
store i32 %16, i32* %5
%17 = load i32*, i32** %2
%18 = load i32, i32* %5
%19 = load i32, i32* @SEEK_SET
%20 = call i32 @fseek(i32* %17, i32 %18, i32 %19)
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%22 = load i32*, i32** %2
%23 = call i32 @fread(i8* %21, i32 14, i32 1, i32* %22)
%24 = load i32*, i32** %2
%25 = call i32 @ftell(i32* %24)
%26 = sdiv i32 %25, 14
%27 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %26, i8* %27)
br label %29
29: ; preds = %14
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 2
store i32 %31, i32* %4
br label %11
32: ; preds = %11
%33 = load i32*, i32** %2
%34 = call i32 @fclose(i32* %33)
store i32 0, i32* %1
br label %35
35: ; preds = %32, %8
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [10 x i8] c"froot.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Error reading file\00"
@SEEK_SET = global i32 0
@.str.3 = [9 x i8] c"%d : %s\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %20
7: ; preds = %0, %7
%8 = phi i32 [ %16, %7 ], [ 0, %0 ]
%9 = mul nuw nsw i32 %8, 14
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %3, i32 %9, i32 %10)
%12 = call i32 @fread(i8* %2, i32 14, i32 1, i32* %3)
%13 = call i32 @ftell(i32* %3)
%14 = sdiv i32 %13, 14
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %14, i8* %2)
%16 = add nuw nsw i32 %8, 2
%17 = icmp ult i32 %8, 23
br i1 %17, label %7, label %18
18: ; preds = %7
%19 = call i32 @fclose(i32* %3)
br label %20
20: ; preds = %18, %5
%21 = phi i32 [ 0, %18 ], [ 1, %5 ]
ret i32 %21
}