#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) {
    printf(">%s\n%s\n", argv[2], fasta);
    printf("%s\n", qual);
    if (extras != NULL)
      printf("extras:%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     1197 <main+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126d <main+0x13d>
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    1213 <main+0xe3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
je     120e <main+0xde>
mov    -0x28(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1213 <main+0xe3>
cmpq   $0x0,-0x18(%rbp)
je     122f <main+0xff>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     124b <main+0x11b>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1267 <main+0x137>
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   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
movq   $0x0,0x10(%rsp)
cmp    $0x3,%edi
jne    11fc <main+0xcc>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
lea    0x10(%rsp),%r8
call   1050 <read_seq@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11bd <main+0x8d>
mov    0x10(%rbx),%rsi
mov    0x8(%rsp),%rdx
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rsi
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     11bd <main+0x8d>
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     11d5 <main+0xa5>
call   1030 <free@plt>
movq   $0x0,0x8(%rsp)
mov    (%rsp),%rdi
test   %rdi,%rdi
je     11eb <main+0xbb>
call   1030 <free@plt>
movq   $0x0,(%rsp)
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     1212 <main+0xe2>
call   1030 <free@plt>
jmp    1212 <main+0xe2>
mov    (%rbx),%rsi
lea    0xdfa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Usage %s fbin_file seq_name\0A\0A\00"
@.str.1 = [8 x i8] c">%s\0A%s\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [11 x i8] c"extras:%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 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 -1, i32* %3
br label %62
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 %42
28: ; preds = %18
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = load i8*, i8** %6
%33 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %32)
%34 = load i8*, i8** %7
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %8
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %41
38: ; preds = %28
%39 = load i8*, i8** %8
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %38, %28
br label %42
42: ; preds = %41, %18
%43 = load i8*, i8** %6
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load i8*, i8** %6
%47 = call i32 @free(i8* %46)
store i8* null, i8** %6
br label %48
48: ; preds = %45, %42
%49 = load i8*, i8** %7
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i8*, i8** %7
%53 = call i32 @free(i8* %52)
store i8* null, i8** %7
br label %54
54: ; preds = %51, %48
%55 = load i8*, i8** %8
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i8*, i8** %8
%59 = call i32 @free(i8* %58)
store i8* null, i8** %8
br label %60
60: ; preds = %57, %54
%61 = load i32, i32* %10
store i32 %61, i32* %3
br label %62
62: ; preds = %60, %13
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage %s fbin_file seq_name\0A\0A\00"
@.str.1 = [8 x i8] c">%s\0A%s\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [11 x i8] c"extras:%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 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %45
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
br i1 %19, label %20, label %30
20: ; preds = %13
%21 = load i8*, i8** %16
%22 = load i8*, i8** %3
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22)
%24 = load i8*, i8** %4
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i8*, i8** %5
%27 = icmp eq i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %20
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %26)
br label %30
30: ; preds = %20, %28, %13
%31 = load i8*, i8** %3
%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** %3
br label %35
35: ; preds = %33, %30
%36 = load i8*, i8** %4
%37 = icmp eq i8* %36, null
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = call i32 @free(i8* %36)
store i8* null, i8** %4
br label %40
40: ; preds = %38, %35
%41 = load i8*, i8** %5
%42 = icmp eq i8* %41, null
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 @free(i8* %41)
br label %45
45: ; preds = %40, %43, %10
%46 = phi i32 [ -1, %10 ], [ %18, %43 ], [ %18, %40 ]
ret i32 %46
}