#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("%s [fastq file]\n", argv[0]);
    exit(1);
  }
  FILE *fp;
  char line[10000];
  if ((fp = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "Can't open file %s\n", argv[1]);
    exit(1);
  }
  int counter = 0;
  while ((fgets(line, 10000, fp)) != NULL) {
    if (counter == 0) {
      line[0] = '>';
      printf("%s", line);
    }
    if (counter == 1) {
      printf("%s", line);
    }
    counter++;
    if (counter == 4) {
      counter = 0;
    }
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2740,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a0 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe62(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11e9 <main+0x89>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe39(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0x0,-0x2734(%rbp)
lea    -0x2730(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1284 <main+0x124>
cmpl   $0x0,-0x2734(%rbp)
jne    1239 <main+0xd9>
movb   $0x3e,-0x2730(%rbp)
lea    -0x2730(%rbp),%rsi
lea    0xdf3(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x2734(%rbp)
jne    1259 <main+0xf9>
lea    -0x2730(%rbp),%rsi
lea    0xdd3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x2734(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2734(%rbp)
cmpl   $0x4,-0x2734(%rbp)
jne    127f <main+0x11f>
movl   $0x0,-0x2734(%rbp)
jmp    11f3 <main+0x93>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x2740,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2710,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    1213 <main+0xb3>
mov    0x8(%r14),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     122c <main+0xcc>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x2710,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11f9 <main+0x99>
xor    %r12d,%r12d
lea    0xe71(%rip),%r14
mov    %rsp,%r15
xor    %ebp,%ebp
jmp    11ee <main+0x8e>
nopl   (%rax)
movb   $0x3e,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x4,%ebp
cmove  %r12d,%ebp
mov    %r15,%rdi
mov    $0x2710,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11f9 <main+0x99>
cmp    $0x1,%ebp
je     11c4 <main+0x64>
test   %ebp,%ebp
je     11c0 <main+0x60>
jmp    11cf <main+0x6f>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x2710,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rsi
lea    0xde3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xdd3(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%s [fastq file]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Can't open file %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [10000 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %6
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %30
23: ; preds = %17
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %17
store i32 0, i32* %8
br label %31
31: ; preds = %55, %30
%32 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i32* @fgets(i8* %32, i32 10000, i32* %33)
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %56
36: ; preds = %31
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
store i8 62, i8* %40
%41 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %39, %36
%44 = load i32, i32* %8
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = getelementptr inbounds [10000 x i8], [10000 x i8]* %7, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %46, %43
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
%52 = load i32, i32* %8
%53 = icmp eq i32 %52, 4
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 0, i32* %8
br label %55
55: ; preds = %54, %49
br label %31
56: ; preds = %31
%57 = load i32*, i32** %6
%58 = call i32 @fclose(i32* %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s [fastq file]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Can't open file %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10000 x i8]
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, 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.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = call i32* @fgets(i8* %10, i32 10000, i32* %13)
%17 = icmp eq i32* %16, null
br i1 %17, label %34, label %23
18: ; preds = %9
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %11
%21 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %15, %28
%24 = phi i32 [ %31, %28 ], [ 0, %15 ]
switch i32 %24, label %28 [
i32 0, label %25
i32 1, label %26
]
25: ; preds = %23
store i8 62, i8* %10
br label %26
26: ; preds = %23, %25
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %28
28: ; preds = %26, %23
%29 = add nsw i32 %24, 1
%30 = icmp eq i32 %29, 4
%31 = select i1 %30, i32 0, i32 %29
%32 = call i32* @fgets(i8* %10, i32 10000, i32* %13)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %23
34: ; preds = %28, %15
%35 = call i32 @fclose(i32* %13)
ret i32 0
}