#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ makeQual(char *, char *);
int /*<<< orphan*/ parseSam(char *, char *, char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *inFD, *outFD;
  int total;
  char inLine[2048];
  char name[128], seq[128], qual[128];
  inFD = fopen(argv[1], "r");
  outFD = fopen(argv[2], "w");
  total = 0;
  while (fgets(inLine, 2048, inFD) != NULL) {
    total++;
    if (inLine[0] != '@') {
      parseSam(inLine, name, seq);
      makeQual(seq, qual);
      fprintf(outFD, "@%s\n%s\n+\n%s\n", name, seq, qual);
    }
  }
  fprintf(stdout, "%d\n", total);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x800,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1233 <main+0xe3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movsbl -0x830(%rbp),%eax
cmp    $0x40,%eax
je     122e <main+0xde>
lea    -0x830(%rbp),%rdi
lea    -0x8b0(%rbp),%rsi
lea    -0x930(%rbp),%rdx
call   1030 <parseSam@plt>
lea    -0x930(%rbp),%rdi
lea    -0x9b0(%rbp),%rsi
call   1070 <makeQual@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
lea    -0x8b0(%rbp),%rdx
lea    -0x930(%rbp),%rcx
lea    -0x9b0(%rbp),%r8
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11a0 <main+0x50>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%edx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x9b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x998,%rsp
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
lea    0xe91(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,0x8(%rsp)
lea    0x190(%rsp),%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1229 <main+0xd9>
lea    0x190(%rsp),%r15
lea    0x110(%rsp),%r12
lea    0x90(%rsp),%r13
lea    0x10(%rsp),%r14
xor    %ebp,%ebp
jmp    11e8 <main+0x98>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
je     122b <main+0xdb>
cmpb   $0x40,0x190(%rsp)
40
je     11d0 <main+0x80>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1030 <parseSam@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1070 <makeQual@plt>
mov    0x8(%rsp),%rdi
lea    0xded(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11d0 <main+0x80>
xor    %ebp,%ebp
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xdd6(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x998,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"@%s\0A%s\0A+\0A%s\0A\00"
@stdout = global i32 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [2048 x i8]
%10 = alloca [128 x i8]
%11 = alloca [128 x i8]
%12 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %7
store i32 0, i32* %8
br label %21
21: ; preds = %47, %2
%22 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%23 = load i32*, i32** %6
%24 = call i32* @fgets(i8* %22, i32 2048, i32* %23)
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %48
26: ; preds = %21
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 64
br i1 %32, label %33, label %47
33: ; preds = %26
%34 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%37 = call i32 @parseSam(i8* %34, i8* %35, i8* %36)
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%40 = call i32 @makeQual(i8* %38, i8* %39)
%41 = load i32*, i32** %7
%42 = ptrtoint i32* %41 to i32
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %43, i8* %44, i8* %45)
br label %47
47: ; preds = %33, %26
br label %21
48: ; preds = %21
%49 = load i32, i32* @stdout
%50 = load i32, i32* %8
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"@%s\0A%s\0A+\0A%s\0A\00"
@stdout = global i32 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2048 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32* @fgets(i8* %7, i32 2048, i32* %13)
%18 = icmp eq i32* %17, null
br i1 %18, label %34, label %19
19: ; preds = %2
%20 = ptrtoint i32* %16 to i64
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %19, %31
%23 = phi i32 [ 0, %19 ], [ %24, %31 ]
%24 = add nuw nsw i32 %23, 1
%25 = load i8, i8* %7
%26 = icmp eq i8 %25, 64
br i1 %26, label %31, label %27
27: ; preds = %22
%28 = call i32 @parseSam(i8* %7, i8* %8, i8* %9)
%29 = call i32 @makeQual(i8* %9, i8* %10)
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
br label %31
31: ; preds = %27, %22
%32 = call i32* @fgets(i8* %7, i32 2048, i32* %13)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %22
34: ; preds = %31, %2
%35 = phi i32 [ 0, %2 ], [ %24, %31 ]
%36 = load i32, i32* @stdout
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
ret i32 0
}