#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_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, unsigned long, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
unsigned long ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(unsigned long);
void read_sequence_from_file_noheaders(char **sequence, int *sequence_length,
                                       char *file_path) {
  char *sequence_buffer;
  FILE *file;
  unsigned long file_size;
  file = fopen(file_path, "rb");
  fseek(file, 0, SEEK_END);
  file_size = ftell(file);
  fseek(file, 0, SEEK_SET);
  sequence_buffer = (char *)malloc(file_size);
  fread(sequence_buffer, file_size, 1, file);
  fclose(file);
  int i;
  for (i = 0; i < file_size; i++) {
    if (sequence_buffer[i] == '\r' || sequence_buffer[i] == '\n') {
      sequence_buffer[i] = '\0';
    }
  }
  *sequence = sequence_buffer;
  *sequence_length = i;
}


x86 assembly (clang, -O0):
<read_sequence_from_file_noheaders>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x28(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2e24(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x30(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1247 <read_sequence_from_file_noheaders+0xe7>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1228 <read_sequence_from_file_noheaders+0xc8>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1234 <read_sequence_from_file_noheaders+0xd4>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1239 <read_sequence_from_file_noheaders+0xd9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f0 <read_sequence_from_file_noheaders+0x90>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sequence_from_file_noheaders>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe88(%rip),%rsi
mov    %rdx,%rdi
call   1080 <fopen@plt>
mov    %rax,%r13
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
xor    %ebp,%ebp
mov    %r13,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %r13,%rdi
call   1050 <ftell@plt>
mov    %rax,%r12
mov    0x2e2e(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %r12,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
test   %r12,%r12
je     122e <read_sequence_from_file_noheaders+0xce>
lea    -0x1(%r12),%rax
mov    %r12d,%esi
and    $0x3,%esi
cmp    $0x3,%rax
jae    1243 <read_sequence_from_file_noheaders+0xe3>
xor    %ecx,%ecx
test   %rsi,%rsi
je     122b <read_sequence_from_file_noheaders+0xcb>
mov    %rbx,%rdx
add    %rcx,%rdx
xor    %ecx,%ecx
jmp    121d <read_sequence_from_file_noheaders+0xbd>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movb   $0x0,(%rdx,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rsi
je     122b <read_sequence_from_file_noheaders+0xcb>
movzbl (%rdx,%rcx,1),%eax
cmp    $0xd,%al
je     1210 <read_sequence_from_file_noheaders+0xb0>
cmp    $0xa,%al
je     1210 <read_sequence_from_file_noheaders+0xb0>
jmp    1214 <read_sequence_from_file_noheaders+0xb4>
mov    %r12d,%ebp
mov    %rbx,(%r15)
mov    %ebp,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %ecx,%ecx
jmp    125e <read_sequence_from_file_noheaders+0xfe>
xchg   %ax,%ax
movb   $0x0,0x3(%rbx,%rcx,1)
add    $0x4,%rcx
cmp    %rcx,%rdx
je     11f4 <read_sequence_from_file_noheaders+0x94>
movzbl (%rbx,%rcx,1),%eax
cmp    $0xd,%al
je     126a <read_sequence_from_file_noheaders+0x10a>
cmp    $0xa,%al
jne    126e <read_sequence_from_file_noheaders+0x10e>
movb   $0x0,(%rbx,%rcx,1)
movzbl 0x1(%rbx,%rcx,1),%eax
cmp    $0xd,%al
je     127b <read_sequence_from_file_noheaders+0x11b>
cmp    $0xa,%al
jne    1280 <read_sequence_from_file_noheaders+0x120>
movb   $0x0,0x1(%rbx,%rcx,1)
movzbl 0x2(%rbx,%rcx,1),%eax
cmp    $0xd,%al
je     128d <read_sequence_from_file_noheaders+0x12d>
cmp    $0xa,%al
jne    1292 <read_sequence_from_file_noheaders+0x132>
movb   $0x0,0x2(%rbx,%rcx,1)
movzbl 0x3(%rbx,%rcx,1),%eax
cmp    $0xd,%al
je     1250 <read_sequence_from_file_noheaders+0xf0>
cmp    $0xa,%al
je     1250 <read_sequence_from_file_noheaders+0xf0>
jmp    1255 <read_sequence_from_file_noheaders+0xf5>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define void @read_sequence_from_file_noheaders(i8** %0, i32* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i64
%10 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %6
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %8
%13 = load i32*, i32** %8
%14 = load i32, i32* @SEEK_END
%15 = call i32 @fseek(i32* %13, i32 0, i32 %14)
%16 = load i32*, i32** %8
%17 = call i64 @ftell(i32* %16)
store i64 %17, i64* %9
%18 = load i32*, i32** %8
%19 = load i32, i32* @SEEK_SET
%20 = call i32 @fseek(i32* %18, i32 0, i32 %19)
%21 = load i64, i64* %9
%22 = call i64 @malloc(i64 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = load i64, i64* %9
%26 = load i32*, i32** %8
%27 = call i32 @fread(i8* %24, i64 %25, i32 1, i32* %26)
%28 = load i32*, i32** %8
%29 = call i32 @fclose(i32* %28)
store i32 0, i32* %10
br label %30
30: ; preds = %57, %3
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = load i64, i64* %9
%34 = icmp ult i64 %32, %33
br i1 %34, label %35, label %60
35: ; preds = %30
%36 = load i8*, i8** %7
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 13
br i1 %42, label %51, label %43
43: ; preds = %35
%44 = load i8*, i8** %7
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %56
51: ; preds = %43, %35
%52 = load i8*, i8** %7
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
store i8 0, i8* %55
br label %56
56: ; preds = %51, %43
br label %57
57: ; preds = %56
%58 = load i32, i32* %10
%59 = add nsw i32 %58, 1
store i32 %59, i32* %10
br label %30
60: ; preds = %30
%61 = load i8*, i8** %7
%62 = load i8**, i8*** %4
store i8* %61, i8** %62
%63 = load i32, i32* %10
%64 = load i32*, i32** %5
store i32 %63, i32* %64
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define void @read_sequence_from_file_noheaders(i8** nocapture writeonly %0, i32* nocapture writeonly %1, i8* nocapture %2) {
%4 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @SEEK_END
%6 = tail call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = tail call i64 @ftell(i32* %4)
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %4, i32 0, i32 %8)
%10 = tail call i64 @malloc(i64 %7)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @fread(i8* %11, i64 %7, i32 1, i32* %4)
%13 = tail call i32 @fclose(i32* %4)
%14 = icmp eq i64 %7, 0
br i1 %14, label %61, label %15
15: ; preds = %3
%16 = add i64 %7, -1
%17 = and i64 %7, 3
%18 = icmp ult i64 %16, 3
br i1 %18, label %46, label %19
19: ; preds = %15
%20 = and i64 %7, -4
br label %21
21: ; preds = %42, %19
%22 = phi i64 [ 0, %19 ], [ %43, %42 ]
%23 = phi i64 [ 0, %19 ], [ %44, %42 ]
%24 = getelementptr inbounds i8, i8* %11, i64 %22
%25 = load i8, i8* %24
switch i8 %25, label %27 [
i8 13, label %26
i8 10, label %26
]
26: ; preds = %21, %21
store i8 0, i8* %24
br label %27
27: ; preds = %21, %26
%28 = or i64 %22, 1
%29 = getelementptr inbounds i8, i8* %11, i64 %28
%30 = load i8, i8* %29
switch i8 %30, label %32 [
i8 13, label %31
i8 10, label %31
]
31: ; preds = %27, %27
store i8 0, i8* %29
br label %32
32: ; preds = %31, %27
%33 = or i64 %22, 2
%34 = getelementptr inbounds i8, i8* %11, i64 %33
%35 = load i8, i8* %34
switch i8 %35, label %37 [
i8 13, label %36
i8 10, label %36
]
36: ; preds = %32, %32
store i8 0, i8* %34
br label %37
37: ; preds = %36, %32
%38 = or i64 %22, 3
%39 = getelementptr inbounds i8, i8* %11, i64 %38
%40 = load i8, i8* %39
switch i8 %40, label %42 [
i8 13, label %41
i8 10, label %41
]
41: ; preds = %37, %37
store i8 0, i8* %39
br label %42
42: ; preds = %41, %37
%43 = add nuw nsw i64 %22, 4
%44 = add i64 %23, 4
%45 = icmp eq i64 %44, %20
br i1 %45, label %46, label %21
46: ; preds = %42, %15
%47 = phi i64 [ 0, %15 ], [ %43, %42 ]
%48 = icmp eq i64 %17, 0
br i1 %48, label %59, label %49
49: ; preds = %46, %55
%50 = phi i64 [ %56, %55 ], [ %47, %46 ]
%51 = phi i64 [ %57, %55 ], [ 0, %46 ]
%52 = getelementptr inbounds i8, i8* %11, i64 %50
%53 = load i8, i8* %52
switch i8 %53, label %55 [
i8 13, label %54
i8 10, label %54
]
54: ; preds = %49, %49
store i8 0, i8* %52
br label %55
55: ; preds = %54, %49
%56 = add nuw nsw i64 %50, 1
%57 = add i64 %51, 1
%58 = icmp eq i64 %57, %17
br i1 %58, label %59, label %49
59: ; preds = %55, %46
%60 = trunc i64 %7 to i32
br label %61
61: ; preds = %59, %3
%62 = phi i32 [ 0, %3 ], [ %60, %59 ]
store i8* %11, i8** %0
store i32 %62, i32* %1
ret void
}