#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 */
scalar_t__ xor_english_char_score(unsigned char);
float xor_english_str_score(unsigned char *data, size_t len) {
  float score = 0.0f;
  size_t i;
  for (i = 0; i < len; ++i) {
    score += xor_english_char_score(data[i]);
  }
  return score / i;
}


x86 assembly (clang, -O0):
<xor_english_str_score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116f <xor_english_str_score+0x5f>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <xor_english_char_score@plt>
cvtsi2ss %rax,%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1130 <xor_english_str_score+0x20>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
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,-0x28(%rbp)
test   %rax,%rax
movss  %xmm0,-0x24(%rbp)
js     11b6 <xor_english_str_score+0xa6>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
divss  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xor_english_str_score>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %rsi,%rsi
je     116a <xor_english_str_score+0x5a>
mov    %rsi,%r14
mov    %rdi,%r15
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  %xmm0,0xc(%rsp)
movzbl (%r15,%rbx,1),%edi
call   1030 <xor_english_char_score@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
addss  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <xor_english_str_score+0x20>
test   %r14,%r14
js     1174 <xor_english_str_score+0x64>
xorps  %xmm1,%xmm1
cvtsi2ss %r14,%xmm1
jmp    118d <xor_english_str_score+0x7d>
movss  0xe8e(%rip),%xmm0
jmp    1191 <xor_english_str_score+0x81>
mov    %r14,%rax
shr    %rax
and    $0x1,%r14d
or     %rax,%r14
xorps  %xmm1,%xmm1
cvtsi2ss %r14,%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @xor_english_str_score(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca float
%6 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store float 0.000000e+00, float* %5
store i64 0, i64* %6
br label %7
7: ; preds = %20, %2
%8 = load i64, i64* %6
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i64, i64* %6
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = call i64 @xor_english_char_score(i8 zeroext %15)
%17 = sitofp i64 %16 to float
%18 = load float, float* %5
%19 = fadd float %18, %17
store float %19, float* %5
br label %20
20: ; preds = %11
%21 = load i64, i64* %6
%22 = add i64 %21, 1
store i64 %22, i64* %6
br label %7
23: ; preds = %7
%24 = load float, float* %5
%25 = load i64, i64* %6
%26 = uitofp i64 %25 to float
%27 = fdiv float %24, %26
ret float %27
}

LLVM IR (-O2):
define float @xor_english_str_score(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %12, %4 ], [ 0, %2 ]
%6 = phi float [ %11, %4 ], [ 0.000000e+00, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = tail call i64 @xor_english_char_score(i8 zeroext %8)
%10 = sitofp i64 %9 to float
%11 = fadd float %6, %10
%12 = add nuw i64 %5, 1
%13 = icmp eq i64 %12, %1
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = uitofp i64 %1 to float
%16 = fdiv float %11, %15
br label %17
17: ; preds = %14, %2
%18 = phi float [ %16, %14 ], [ 0x7FF8000000000000, %2 ]
ret float %18
}