#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    puts("usage: nucleotide_cleaner FILE(input) FILE(output)");
    return 1;
  }
  FILE *in = fopen(argv[1], "r");
  FILE *ot = fopen(argv[2], "w");
  char read;
  while ((read = getc(in)) != EOF) {
    if (read != '\n') {
      fputc(read, ot);
    }
  }
  fclose(in);
  fclose(ot);
  return 0;
}


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)
cmpl   $0x3,-0x8(%rbp)
je     1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1213 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe86(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
mov    0x2e1a(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11fa <main+0xaa>
movsbl -0x21(%rbp),%eax
cmp    $0xa,%eax
je     11f5 <main+0xa5>
mov    -0x21(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    11b8 <main+0x68>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    11be <main+0x6e>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xecb(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
lea    0xeba(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <getc@plt>
mov    0x2e56(%rip),%r15
jmp    11a8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1070 <getc@plt>
cmp    (%r15),%al
je     11d1 <main+0x81>
cmp    $0xa,%al
je     11a0 <main+0x50>
movsbl %al,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
jmp    11a0 <main+0x50>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    11e3 <main+0x93>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"usage: nucleotide_cleaner FILE(input) FILE(output)\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %43
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %21, i32** %7
br label %22
22: ; preds = %37, %13
%23 = load i32*, i32** %6
%24 = call signext i8 @getc(i32* %23)
store i8 %24, i8* %8
%25 = sext i8 %24 to i32
%26 = load i8, i8* @EOF
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %25, %27
br i1 %28, label %29, label %38
29: ; preds = %22
%30 = load i8, i8* %8
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 10
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i8, i8* %8
%35 = load i32*, i32** %7
%36 = call i32 @fputc(i8 signext %34, i32* %35)
br label %37
37: ; preds = %33, %29
br label %22
38: ; preds = %22
%39 = load i32*, i32** %6
%40 = call i32 @fclose(i32* %39)
%41 = load i32*, i32** %7
%42 = call i32 @fclose(i32* %41)
store i32 0, i32* %3
br label %43
43: ; preds = %38, %11
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [51 x i8] c"usage: nucleotide_cleaner FILE(input) FILE(output)\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@EOF = global i8 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %28
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call signext i8 @getc(i32* %9)
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %25, label %16
16: ; preds = %6, %21
%17 = phi i8 [ %22, %21 ], [ %13, %6 ]
%18 = icmp eq i8 %17, 10
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @fputc(i8 signext %17, i32* %12)
br label %21
21: ; preds = %19, %16
%22 = tail call signext i8 @getc(i32* %9)
%23 = load i8, i8* @EOF
%24 = icmp eq i8 %22, %23
br i1 %24, label %25, label %16
25: ; preds = %21, %6
%26 = tail call i32 @fclose(i32* %9)
%27 = tail call i32 @fclose(i32* %12)
br label %28
28: ; preds = %25, %4
%29 = phi i32 [ 1, %4 ], [ 0, %25 ]
ret i32 %29
}