#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  FILE *fp = fopen("rosalind_rna.txt", "r");
  if (fp == NULL) {
    printf("File open failed!");
    return 1;
  }
  char str[1000 + 1];
  fgets(str, 1000 + 1, fp);
  for (int i = 0; i < 1000; i++) {
    if (str[i] == 'T') {
      str[i] = 'U';
    }
  }
  printf("%s", str);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118e <main+0x4e>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1222 <main+0xe2>
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x3e9,%esi
call   1050 <fgets@plt>
movl   $0x0,-0x404(%rbp)
cmpl   $0x3e8,-0x404(%rbp)
jge    11fd <main+0xbd>
movslq -0x404(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x54,%eax
jne    11e4 <main+0xa4>
movslq -0x404(%rbp),%rax
movb   $0x55,-0x400(%rbp,%rax,1)
55
jmp    11e9 <main+0xa9>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11ad <main+0x6d>
lea    -0x400(%rbp),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x3f8,%rsp
lea    0xed0(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     13aa <main+0x26a>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x3e9,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
xor    %eax,%eax
movdqa 0xe7e(%rip),%xmm0
movdqa 0xe86(%rip),%xmm1
jmp    11a0 <main+0x60>
nopl   0x0(%rax)
add    $0x10,%rax
cmp    $0x3e0,%rax
je     1319 <main+0x1d9>
movq   (%rsp,%rax,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%ecx
test   $0x1,%cl
je     11ba <main+0x7a>
movb   $0x55,(%rsp,%rax,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%ecx
shr    $0x10,%ecx
test   $0x1,%cl
je     11d4 <main+0x94>
movb   $0x55,0x1(%rsp,%rax,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%ecx
test   $0x1,%cl
je     11ec <main+0xac>
movb   $0x55,0x2(%rsp,%rax,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%ecx
test   $0x1,%cl
je     1204 <main+0xc4>
movb   $0x55,0x3(%rsp,%rax,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%ecx
test   $0x1,%cl
je     121c <main+0xdc>
movb   $0x55,0x4(%rsp,%rax,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%ecx
test   $0x1,%cl
je     1234 <main+0xf4>
movb   $0x55,0x5(%rsp,%rax,1)
pextrw $0x3,%xmm2,%ecx
test   $0x1,%cl
je     1243 <main+0x103>
movb   $0x55,0x6(%rsp,%rax,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%ecx
test   $0x1,%cl
je     1257 <main+0x117>
movb   $0x55,0x7(%rsp,%rax,1)
movq   0x8(%rsp,%rax,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%ecx
test   $0x1,%cl
je     1273 <main+0x133>
movb   $0x55,0x8(%rsp,%rax,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%ecx
shr    $0x10,%ecx
test   $0x1,%cl
je     128d <main+0x14d>
movb   $0x55,0x9(%rsp,%rax,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%ecx
test   $0x1,%cl
je     12a5 <main+0x165>
movb   $0x55,0xa(%rsp,%rax,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%ecx
test   $0x1,%cl
je     12bd <main+0x17d>
movb   $0x55,0xb(%rsp,%rax,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%ecx
test   $0x1,%cl
je     12d5 <main+0x195>
movb   $0x55,0xc(%rsp,%rax,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%ecx
test   $0x1,%cl
je     12ed <main+0x1ad>
movb   $0x55,0xd(%rsp,%rax,1)
pextrw $0x3,%xmm2,%ecx
test   $0x1,%cl
je     12fc <main+0x1bc>
movb   $0x55,0xe(%rsp,%rax,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%ecx
test   $0x1,%cl
je     1190 <main+0x50>
movb   $0x55,0xf(%rsp,%rax,1)
jmp    1190 <main+0x50>
cmpb   $0x54,0x3e0(%rsp)
54
je     13c9 <main+0x289>
cmpb   $0x54,0x3e1(%rsp)
54
je     13df <main+0x29f>
cmpb   $0x54,0x3e2(%rsp)
54
je     13f5 <main+0x2b5>
cmpb   $0x54,0x3e3(%rsp)
54
je     140b <main+0x2cb>
cmpb   $0x54,0x3e4(%rsp)
54
je     1421 <main+0x2e1>
cmpb   $0x54,0x3e5(%rsp)
54
je     1437 <main+0x2f7>
cmpb   $0x54,0x3e6(%rsp)
54
je     144d <main+0x30d>
cmpb   $0x54,0x3e7(%rsp)
54
jne    138d <main+0x24d>
movb   $0x55,0x3e7(%rsp)
55
lea    0xcb1(%rip),%rdi
xor    %ebp,%ebp
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    13bd <main+0x27d>
lea    0xc82(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %rbp
ret
movb   $0x55,0x3e0(%rsp)
55
cmpb   $0x54,0x3e1(%rsp)
54
jne    1335 <main+0x1f5>
movb   $0x55,0x3e1(%rsp)
55
cmpb   $0x54,0x3e2(%rsp)
54
jne    1343 <main+0x203>
movb   $0x55,0x3e2(%rsp)
55
cmpb   $0x54,0x3e3(%rsp)
54
jne    1351 <main+0x211>
movb   $0x55,0x3e3(%rsp)
55
cmpb   $0x54,0x3e4(%rsp)
54
jne    135f <main+0x21f>
movb   $0x55,0x3e4(%rsp)
55
cmpb   $0x54,0x3e5(%rsp)
54
jne    136d <main+0x22d>
movb   $0x55,0x3e5(%rsp)
55
cmpb   $0x54,0x3e6(%rsp)
54
jne    137b <main+0x23b>
movb   $0x55,0x3e6(%rsp)
55
cmpb   $0x54,0x3e7(%rsp)
54
je     1385 <main+0x245>
jmp    138d <main+0x24d>

LLVM IR (-O0):
@.str = [17 x i8] c"rosalind_rna.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"File open failed!\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [1001 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %37
10: ; preds = %0
%11 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%12 = load i32*, i32** %2
%13 = call i32 @fgets(i8* %11, i32 1001, i32* %12)
store i32 0, i32* %4
br label %14
14: ; preds = %29, %10
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 1000
br i1 %16, label %17, label %32
17: ; preds = %14
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 84
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 %26
store i8 85, i8* %27
br label %28
28: ; preds = %24, %17
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %14
32: ; preds = %14
%33 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
store i32 0, i32* %1
br label %37
37: ; preds = %32, %8
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [17 x i8] c"rosalind_rna.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"File open failed!\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %143
6: ; preds = %0
%7 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%8 = call i32 @fgets(i8* %7, i32 1001, i32* %2)
br label %9
9: ; preds = %97, %6
%10 = phi i64 [ 0, %6 ], [ %98, %97 ]
%11 = or i64 %10, 8
%12 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %10
%13 = bitcast i8* %12 to <8 x i8>*
%14 = load <8 x i8>, <8 x i8>* %13
%15 = getelementptr inbounds i8, i8* %12, i64 8
%16 = bitcast i8* %15 to <8 x i8>*
%17 = load <8 x i8>, <8 x i8>* %16
%18 = icmp eq <8 x i8> %14, <i8 84, i8 84, i8 84, i8 84, i8 84, i8 84, i8 84, i8 84>
%19 = icmp eq <8 x i8> %17, <i8 84, i8 84, i8 84, i8 84, i8 84, i8 84, i8 84, i8 84>
%20 = extractelement <8 x i1> %18, i64 0
br i1 %20, label %21, label %23
21: ; preds = %9
%22 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %10
store i8 85, i8* %22
br label %23
23: ; preds = %21, %9
%24 = extractelement <8 x i1> %18, i64 1
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = or i64 %10, 1
%27 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %26
store i8 85, i8* %27
br label %28
28: ; preds = %25, %23
%29 = extractelement <8 x i1> %18, i64 2
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = or i64 %10, 2
%32 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %31
store i8 85, i8* %32
br label %33
33: ; preds = %30, %28
%34 = extractelement <8 x i1> %18, i64 3
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = or i64 %10, 3
%37 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %36
store i8 85, i8* %37
br label %38
38: ; preds = %35, %33
%39 = extractelement <8 x i1> %18, i64 4
br i1 %39, label %40, label %43
40: ; preds = %38
%41 = or i64 %10, 4
%42 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %41
store i8 85, i8* %42
br label %43
43: ; preds = %40, %38
%44 = extractelement <8 x i1> %18, i64 5
br i1 %44, label %45, label %48
45: ; preds = %43
%46 = or i64 %10, 5
%47 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %46
store i8 85, i8* %47
br label %48
48: ; preds = %45, %43
%49 = extractelement <8 x i1> %18, i64 6
br i1 %49, label %50, label %53
50: ; preds = %48
%51 = or i64 %10, 6
%52 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %51
store i8 85, i8* %52
br label %53
53: ; preds = %50, %48
%54 = extractelement <8 x i1> %18, i64 7
br i1 %54, label %55, label %58
55: ; preds = %53
%56 = or i64 %10, 7
%57 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %56
store i8 85, i8* %57
br label %58
58: ; preds = %55, %53
%59 = extractelement <8 x i1> %19, i64 0
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %11
store i8 85, i8* %61
br label %62
62: ; preds = %60, %58
%63 = extractelement <8 x i1> %19, i64 1
br i1 %63, label %64, label %67
64: ; preds = %62
%65 = or i64 %10, 9
%66 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %65
store i8 85, i8* %66
br label %67
67: ; preds = %64, %62
%68 = extractelement <8 x i1> %19, i64 2
br i1 %68, label %69, label %72
69: ; preds = %67
%70 = or i64 %10, 10
%71 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %70
store i8 85, i8* %71
br label %72
72: ; preds = %69, %67
%73 = extractelement <8 x i1> %19, i64 3
br i1 %73, label %74, label %77
74: ; preds = %72
%75 = or i64 %10, 11
%76 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %75
store i8 85, i8* %76
br label %77
77: ; preds = %74, %72
%78 = extractelement <8 x i1> %19, i64 4
br i1 %78, label %79, label %82
79: ; preds = %77
%80 = or i64 %10, 12
%81 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %80
store i8 85, i8* %81
br label %82
82: ; preds = %79, %77
%83 = extractelement <8 x i1> %19, i64 5
br i1 %83, label %84, label %87
84: ; preds = %82
%85 = or i64 %10, 13
%86 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %85
store i8 85, i8* %86
br label %87
87: ; preds = %84, %82
%88 = extractelement <8 x i1> %19, i64 6
br i1 %88, label %89, label %92
89: ; preds = %87
%90 = or i64 %10, 14
%91 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %90
store i8 85, i8* %91
br label %92
92: ; preds = %89, %87
%93 = extractelement <8 x i1> %19, i64 7
br i1 %93, label %94, label %97
94: ; preds = %92
%95 = or i64 %10, 15
%96 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %95
store i8 85, i8* %96
br label %97
97: ; preds = %94, %92
%98 = add nuw i64 %10, 16
%99 = icmp eq i64 %98, 992
br i1 %99, label %100, label %9
100: ; preds = %97
%101 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 992
%102 = load i8, i8* %101
%103 = icmp eq i8 %102, 84
br i1 %103, label %104, label %105
104: ; preds = %100
store i8 85, i8* %101
br label %105
105: ; preds = %100, %104
%106 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 993
%107 = load i8, i8* %106
%108 = icmp eq i8 %107, 84
br i1 %108, label %109, label %110
109: ; preds = %105
store i8 85, i8* %106
br label %110
110: ; preds = %109, %105
%111 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 994
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 84
br i1 %113, label %114, label %115
114: ; preds = %110
store i8 85, i8* %111
br label %115
115: ; preds = %114, %110
%116 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 995
%117 = load i8, i8* %116
%118 = icmp eq i8 %117, 84
br i1 %118, label %119, label %120
119: ; preds = %115
store i8 85, i8* %116
br label %120
120: ; preds = %119, %115
%121 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 996
%122 = load i8, i8* %121
%123 = icmp eq i8 %122, 84
br i1 %123, label %124, label %125
124: ; preds = %120
store i8 85, i8* %121
br label %125
125: ; preds = %124, %120
%126 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 997
%127 = load i8, i8* %126
%128 = icmp eq i8 %127, 84
br i1 %128, label %129, label %130
129: ; preds = %125
store i8 85, i8* %126
br label %130
130: ; preds = %129, %125
%131 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 998
%132 = load i8, i8* %131
%133 = icmp eq i8 %132, 84
br i1 %133, label %134, label %135
134: ; preds = %130
store i8 85, i8* %131
br label %135
135: ; preds = %134, %130
%136 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 999
%137 = load i8, i8* %136
%138 = icmp eq i8 %137, 84
br i1 %138, label %139, label %140
139: ; preds = %135
store i8 85, i8* %136
br label %140
140: ; preds = %139, %135
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%142 = call i32 @fclose(i32* %2)
br label %143
143: ; preds = %140, %4
%144 = phi i32 [ 1, %4 ], [ 0, %140 ]
ret i32 %144
}