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

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int read_seq(char *, char *, char **, char **, char **);
int main(int argc, char *argv[]) {
  char *fasta = NULL;
  char *qual = NULL;
  char *extras = NULL;
  int size = 5000;
  int res = 0;
  if (argc != 3) {
    printf("Usage %s fbin_file seq_name\n\n", argv[0]);
    return -1;
  }
  res = read_seq(argv[1], argv[2], &fasta, &qual, &extras);
  if (res == 0) {
    if (extras != NULL)
      printf("%s\n", extras);
  }
  if (fasta != NULL) {
    free(fasta);
    fasta = NULL;
  }
  if (qual != NULL) {
    free(qual);
    qual = NULL;
  }
  if (extras != NULL) {
    free(extras);
    extras = NULL;
  }
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1388,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1195 <main+0x65>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    123d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1050 <read_seq@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    11e3 <main+0xb3>
cmpq   $0x0,-0x28(%rbp)
je     11de <main+0xae>
mov    -0x28(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
jmp    11e3 <main+0xb3>
cmpq   $0x0,-0x18(%rbp)
je     11ff <main+0xcf>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     121b <main+0xeb>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1237 <main+0x107>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
cmp    $0x3,%edi
jne    11ce <main+0x9e>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <read_seq@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    118d <main+0x5d>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
je     118d <main+0x5d>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    0x18(%rsp),%rdi
test   %rdi,%rdi
je     11a5 <main+0x75>
call   1030 <free@plt>
movq   $0x0,0x18(%rsp)
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     11bd <main+0x8d>
call   1030 <free@plt>
movq   $0x0,0x10(%rsp)
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     11e2 <main+0xb2>
call   1030 <free@plt>
jmp    11e2 <main+0xb2>
mov    (%rsi),%rsi
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Usage %s fbin_file seq_name\0A\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i32 5000, i32* %9
store i32 0, i32* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 -1, i32* %3
br label %55
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @read_seq(i8* %21, i8* %24, i8** %6, i8** %7, i8** %8)
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %18
%29 = load i8*, i8** %8
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i8*, i8** %8
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %31, %28
br label %35
35: ; preds = %34, %18
%36 = load i8*, i8** %6
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i8*, i8** %6
%40 = call i32 @free(i8* %39)
store i8* null, i8** %6
br label %41
41: ; preds = %38, %35
%42 = load i8*, i8** %7
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i8*, i8** %7
%46 = call i32 @free(i8* %45)
store i8* null, i8** %7
br label %47
47: ; preds = %44, %41
%48 = load i8*, i8** %8
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i8*, i8** %8
%52 = call i32 @free(i8* %51)
store i8* null, i8** %8
br label %53
53: ; preds = %50, %47
%54 = load i32, i32* %10
store i32 %54, i32* %3
br label %55
55: ; preds = %53, %13
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage %s fbin_file seq_name\0A\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%8 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%9 = icmp eq i32 %0, 3
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %40
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @read_seq(i8* %15, i8* %17, i8** %3, i8** %4, i8** %5)
%19 = icmp eq i32 %18, 0
%20 = load i8*, i8** %5
%21 = icmp ne i8* %20, null
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %25
25: ; preds = %23, %13
%26 = load i8*, i8** %3
%27 = icmp eq i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @free(i8* %26)
store i8* null, i8** %3
br label %30
30: ; preds = %28, %25
%31 = load i8*, i8** %4
%32 = icmp eq i8* %31, null
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32 @free(i8* %31)
store i8* null, i8** %4
br label %35
35: ; preds = %33, %30
%36 = load i8*, i8** %5
%37 = icmp eq i8* %36, null
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = call i32 @free(i8* %36)
br label %40
40: ; preds = %35, %38, %10
%41 = phi i32 [ -1, %10 ], [ %18, %38 ], [ %18, %35 ]
ret i32 %41
}