#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 ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
char *getRNA(char *, int /*<<< orphan*/);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  char *filepath = argv[1];
  size_t len = 0;
  ssize_t read;
  char *line = NULL;
  fp = fopen(filepath, "r");
  if (fp == NULL) {
    exit(1);
  }
  while ((read = getline(&line, &len, fp)) != -1) {
    char *rna = getRNA(line, strlen(line));
    printf("%s", rna);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11bb <main+0x5b>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    11c0 <main+0x60>
mov    -0x18(%rbp),%rdx
lea    -0x38(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <getline@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     1212 <main+0xb2>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1050 <getRNA@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
jmp    11c0 <main+0x60>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rdi
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xe77(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1204 <main+0xa4>
mov    %rax,%r13
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rax,%rdx
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     11f4 <main+0x94>
lea    0xe50(%rip),%r14
mov    %rsp,%r15
lea    0x8(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <getRNA@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
jne    11c0 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [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 i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %7
store i64 0, i64* %8
store i8* null, i8** %10
%15 = load i8*, i8** %7
%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 i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
br label %22
22: ; preds = %26, %21
%23 = load i32*, i32** %6
%24 = call i32 @getline(i8** %10, i64* %8, i32* %23)
store i32 %24, i32* %9
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i8*, i8** %10
%28 = load i8*, i8** %10
%29 = call i32 @strlen(i8* %28)
%30 = call i8* @getRNA(i8* %27, i32 %29)
store i8* %30, i8** %11
%31 = load i8*, i8** %11
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %22
33: ; preds = %22
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%8 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%9 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = call i32 @getline(i8** %4, i64* %3, i32* %9)
%13 = icmp eq i32 %12, -1
br i1 %13, label %23, label %16
14: ; preds = %2
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %11, %16
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = call i8* @getRNA(i8* %17, i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call i32 @getline(i8** %4, i64* %3, i32* %9)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %16
23: ; preds = %16, %11
ret i32 0
}