#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 */

/* Variables and functions */
float gc(const char *primer, size_t startPos) {
  primer += startPos;
  size_t length = 0, gc = 0;
  char c;
  while ((c = *primer++) != '\0') {
    length++;
    if (c == 'c' || c == 'C' || c == 'g' || c == 'G') {
      gc++;
    }
  }
  return gc / (float)length;
}


x86 assembly (clang, -O0):
<gc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1199 <gc+0x99>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x63,%eax
je     1188 <gc+0x88>
movsbl -0x21(%rbp),%eax
cmp    $0x43,%eax
je     1188 <gc+0x88>
movsbl -0x21(%rbp),%eax
cmp    $0x67,%eax
je     1188 <gc+0x88>
movsbl -0x21(%rbp),%eax
cmp    $0x47,%eax
jne    1194 <gc+0x94>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1128 <gc+0x28>
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x2c(%rbp)
test   %rax,%rax
movss  %xmm0,-0x28(%rbp)
js     11d6 <gc+0xd6>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x34(%rbp)
test   %rax,%rax
movss  %xmm0,-0x30(%rbp)
js     121d <gc+0x11d>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x38(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc>:
mov    (%rdi,%rsi,1),%dl
test   %dl,%dl
je     1157 <gc+0x57>
add    %rsi,%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    $0x303,%esi
xor    %ecx,%ecx
jmp    112c <gc+0x2c>
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
je     1146 <gc+0x46>
add    $0xbd,%dl
rol    $0x6,%dl
cmp    $0x9,%dl
ja     1120 <gc+0x20>
movzbl %dl,%edx
bt     %rdx,%rsi
jae    1120 <gc+0x20>
add    $0x1,%rax
jmp    1120 <gc+0x20>
test   %rcx,%rcx
js     117b <gc+0x7b>
cvtsi2ss %rcx,%xmm1
test   %rax,%rax
js     1161 <gc+0x61>
jmp    1195 <gc+0x95>
xorps  %xmm1,%xmm1
xor    %eax,%eax
test   %rax,%rax
jns    1195 <gc+0x95>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
divss  %xmm1,%xmm0
ret
mov    %rcx,%rdx
shr    %rdx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm1
addss  %xmm1,%xmm1
test   %rax,%rax
js     1161 <gc+0x61>
cvtsi2ss %rax,%xmm0
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @gc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 %8
store i8* %10, i8** %3
store i64 0, i64* %5
store i64 0, i64* %6
br label %11
11: ; preds = %38, %2
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %12
store i8 %14, i8* %7
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %39
17: ; preds = %11
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %5
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 99
br i1 %22, label %35, label %23
23: ; preds = %17
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 67
br i1 %26, label %35, label %27
27: ; preds = %23
%28 = load i8, i8* %7
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 103
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i8, i8* %7
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 71
br i1 %34, label %35, label %38
35: ; preds = %31, %27, %23, %17
%36 = load i64, i64* %6
%37 = add i64 %36, 1
store i64 %37, i64* %6
br label %38
38: ; preds = %35, %31
br label %11
39: ; preds = %11
%40 = load i64, i64* %6
%41 = uitofp i64 %40 to float
%42 = load i64, i64* %5
%43 = uitofp i64 %42 to float
%44 = fdiv float %41, %43
ret float %44
}

LLVM IR (-O2):
define float @gc(i8* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %23, label %6
6: ; preds = %2, %17
%7 = phi i8 [ %19, %17 ], [ %4, %2 ]
%8 = phi i8* [ %11, %17 ], [ %3, %2 ]
%9 = phi i64 [ %18, %17 ], [ 0, %2 ]
%10 = phi i64 [ %12, %17 ], [ 0, %2 ]
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add i64 %10, 1
%13 = add i8 %7, -67
%14 = tail call i8 @llvm.fshl.i8(i8 %13, i8 %13, i8 6)
switch i8 %14, label %17 [
i8 9, label %15
i8 8, label %15
i8 1, label %15
i8 0, label %15
]
15: ; preds = %6, %6, %6, %6
%16 = add i64 %9, 1
br label %17
17: ; preds = %6, %15
%18 = phi i64 [ %16, %15 ], [ %9, %6 ]
%19 = load i8, i8* %11
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %6
21: ; preds = %17
%22 = uitofp i64 %12 to float
br label %23
23: ; preds = %21, %2
%24 = phi float [ 0.000000e+00, %2 ], [ %22, %21 ]
%25 = phi i64 [ 0, %2 ], [ %18, %21 ]
%26 = uitofp i64 %25 to float
%27 = fdiv float %26, %24
ret float %27
}