#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*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char buf[1000];
  int gc = 0;
  int total = 0;
  char tablegc[256] = {
      0,
  };
  char tabletotal[256] = {
      0,
  };
  FILE *f = fopen("chry_multiplied.fa", "r");
  tabletotal['A'] = 1;
  tabletotal['T'] = 1;
  tabletotal['C'] = 1;
  tabletotal['G'] = 1;
  tablegc['C'] = 1;
  tablegc['G'] = 1;
  while (fgets(buf, 1000, f))
    if (*buf != '>') {
      char c, *ptr = buf;
      while ((c = *ptr++)) {
        total += tabletotal[(int)c];
        gc += tablegc[(int)c];
      }
    }
  fclose(f);
  printf("%.10f\n", (100. * gc) / total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x620,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3f4(%rbp)
movl   $0x0,-0x3f8(%rbp)
lea    -0x500(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    -0x600(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    0xe65(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x608(%rbp)
movb   $0x1,-0x5bf(%rbp)
movb   $0x1,-0x5ac(%rbp)
movb   $0x1,-0x5bd(%rbp)
movb   $0x1,-0x5b9(%rbp)
movb   $0x1,-0x4bd(%rbp)
movb   $0x1,-0x4b9(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x608(%rbp),%rdx
mov    $0x3e8,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     128e <main+0x13e>
movsbl -0x3f0(%rbp),%eax
cmp    $0x3e,%eax
je     1289 <main+0x139>
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x618(%rbp)
mov    -0x618(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x618(%rbp)
mov    (%rax),%al
mov    %al,-0x609(%rbp)
cmp    $0x0,%al
je     1284 <main+0x134>
movsbl -0x609(%rbp),%eax
cltq
movsbl -0x600(%rbp,%rax,1),%eax
ff
add    -0x3f8(%rbp),%eax
mov    %eax,-0x3f8(%rbp)
movsbl -0x609(%rbp),%eax
cltq
movsbl -0x500(%rbp,%rax,1),%eax
ff
add    -0x3f4(%rbp),%eax
mov    %eax,-0x3f4(%rbp)
jmp    1220 <main+0xd0>
jmp    1289 <main+0x139>
jmp    11e0 <main+0x90>
mov    -0x608(%rbp),%rdi
call   1030 <fclose@plt>
cvtsi2sdl -0x3f4(%rbp),%xmm1
ff
movsd  0xd56(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x3f8(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xd58(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x620,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x5f0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xdc8(%rip),%rdi
lea    0xdd4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
movb   $0x1,0x41(%rsp)
movb   $0x1,0x54(%rsp)
movb   $0x1,0x43(%rsp)
movb   $0x1,0x47(%rsp)
movb   $0x1,0x143(%rsp)
01
movb   $0x1,0x147(%rsp)
01
lea    0x200(%rsp),%rdi
mov    $0x3e8,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1301 <main+0x1c1>
xor    %ebx,%ebx
lea    0x201(%rsp),%r12
lea    0x200(%rsp),%r14
xor    %ebp,%ebp
jmp    12c5 <main+0x185>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    $0x3e8,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1305 <main+0x1c5>
mov    0x200(%rsp),%al
test   %al,%al
je     12b0 <main+0x170>
cmp    $0x3e,%al
je     12b0 <main+0x170>
mov    %r12,%rcx
nopw   0x0(%rax,%rax,1)
movsbq %al,%rax
movsbl (%rsp,%rax,1),%edx
add    %edx,%ebp
movsbl 0x100(%rsp,%rax,1),%eax
add    %eax,%ebx
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    12e0 <main+0x1a0>
jmp    12b0 <main+0x170>
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %r15,%rdi
call   1030 <fclose@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xce4(%rip),%xmm0
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xcee(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x5f0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"chry_multiplied.fa\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%.10f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%10 = bitcast [256 x i8]* %5 to i8*
%11 = bitcast [256 x i8]* %6 to i8*
%12 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %7
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 65
store i8 1, i8* %13
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 84
store i8 1, i8* %14
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 67
store i8 1, i8* %15
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 71
store i8 1, i8* %16
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 67
store i8 1, i8* %17
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 71
store i8 1, i8* %18
br label %19
19: ; preds = %54, %0
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%21 = load i32*, i32** %7
%22 = call i64 @fgets(i8* %20, i32 1000, i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %55
24: ; preds = %19
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 62
br i1 %28, label %29, label %54
29: ; preds = %24
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
store i8* %30, i8** %9
br label %31
31: ; preds = %36, %29
%32 = load i8*, i8** %9
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %9
%34 = load i8, i8* %32
store i8 %34, i8* %8
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %53
36: ; preds = %31
%37 = load i8, i8* %8
%38 = sext i8 %37 to i32
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = load i32, i32* %4
%44 = add nsw i32 %43, %42
store i32 %44, i32* %4
%45 = load i8, i8* %8
%46 = sext i8 %45 to i32
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i32, i32* %3
%52 = add nsw i32 %51, %50
store i32 %52, i32* %3
br label %31
53: ; preds = %31
br label %54
54: ; preds = %53, %24
br label %19
55: ; preds = %19
%56 = load i32*, i32** %7
%57 = call i32 @fclose(i32* %56)
%58 = load i32, i32* %3
%59 = sitofp i32 %58 to double
%60 = fmul double 1.000000e+02, %59
%61 = load i32, i32* %4
%62 = sitofp i32 %61 to double
%63 = fdiv double %60, %62
%64 = fptosi double %63 to i32
%65 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"chry_multiplied.fa\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%.10f\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 65
store i8 1, i8* %8
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 84
store i8 1, i8* %9
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 67
store i8 1, i8* %10
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 71
store i8 1, i8* %11
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 67
store i8 1, i8* %12
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 71
store i8 1, i8* %13
%14 = call i64 @fgets(i8* %4, i32 1000, i32* %7)
%15 = icmp eq i64 %14, 0
br i1 %15, label %42, label %16
16: ; preds = %0, %37
%17 = phi i32 [ %39, %37 ], [ 0, %0 ]
%18 = phi i32 [ %38, %37 ], [ 0, %0 ]
%19 = load i8, i8* %4
switch i8 %19, label %20 [
i8 62, label %37
i8 0, label %37
]
20: ; preds = %16, %20
%21 = phi i8* [ %25, %20 ], [ %4, %16 ]
%22 = phi i32 [ %34, %20 ], [ %17, %16 ]
%23 = phi i32 [ %30, %20 ], [ %18, %16 ]
%24 = phi i8 [ %35, %20 ], [ %19, %16 ]
%25 = getelementptr inbounds i8, i8* %21, i64 1
%26 = sext i8 %24 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = add nsw i32 %23, %29
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %26
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = add nsw i32 %22, %33
%35 = load i8, i8* %25
%36 = icmp eq i8 %35, 0
br i1 %36, label %37, label %20
37: ; preds = %20, %16, %16
%38 = phi i32 [ %18, %16 ], [ %18, %16 ], [ %30, %20 ]
%39 = phi i32 [ %17, %16 ], [ %17, %16 ], [ %34, %20 ]
%40 = call i64 @fgets(i8* %4, i32 1000, i32* %7)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %16
42: ; preds = %37, %0
%43 = phi i32 [ 0, %0 ], [ %38, %37 ]
%44 = phi i32 [ 0, %0 ], [ %39, %37 ]
%45 = call i32 @fclose(i32* %7)
%46 = sitofp i32 %44 to double
%47 = fmul double %46, 1.000000e+02
%48 = sitofp i32 %43 to double
%49 = fdiv double %47, %48
%50 = fptosi double %49 to i32
%51 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %50)
ret i32 0
}