#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 */
size_t INT_MAX;
size_t min_match_length(char const *, char const *);
size_t strlen(char const *);
float score(const char *query, const char *string) {
  size_t string_length, query_length, match_length;
  if (!string) {
    return 0;
  }
  if ((match_length = min_match_length(query, string)) == INT_MAX) {
    return 0;
  }
  string_length = strlen(string);
  query_length = strlen(query);
  return (float)query_length / match_length / string_length;
}


x86 assembly (clang, -O0):
<score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <score+0x28>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1277 <score+0x157>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <min_match_length@plt>
mov    %rax,-0x30(%rbp)
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
jne    1176 <score+0x56>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1277 <score+0x157>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%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,-0x38(%rbp)
test   %rax,%rax
movss  %xmm0,-0x34(%rbp)
js     11cd <score+0xad>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x30(%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,-0x40(%rbp)
test   %rax,%rax
movss  %xmm0,-0x3c(%rbp)
js     1214 <score+0xf4>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x44(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x50(%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,-0x4c(%rbp)
test   %rax,%rax
movss  %xmm0,-0x48(%rbp)
js     1264 <score+0x144>
movss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x50(%rbp),%xmm0
movss  -0x48(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<score>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xorps  %xmm0,%xmm0
test   %rsi,%rsi
je     11e4 <score+0xc4>
mov    %rsi,%rbx
mov    %rdi,%r12
call   1030 <min_match_length@plt>
xorps  %xmm0,%xmm0
mov    %rax,%r15
mov    0x2e9c(%rip),%rax
cmp    (%rax),%r15
je     11e4 <score+0xc4>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
js     1192 <score+0x72>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
test   %r15,%r15
jns    11af <score+0x8f>
mov    %r15,%rax
shr    %rax
and    $0x1,%r15d
or     %rax,%r15
cvtsi2ss %r15,%xmm1
addss  %xmm1,%xmm1
jmp    11b4 <score+0x94>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
test   %r15,%r15
js     117a <score+0x5a>
cvtsi2ss %r15,%xmm1
divss  %xmm1,%xmm0
test   %r14,%r14
js     11c7 <score+0xa7>
xorps  %xmm1,%xmm1
cvtsi2ss %r14,%xmm1
jmp    11e0 <score+0xc0>
mov    %r14,%rax
shr    %rax
and    $0x1,%r14d
or     %rax,%r14
xorps  %xmm1,%xmm1
cvtsi2ss %r14,%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@INT_MAX = global i64 0
define float @score(i8* %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
store float 0.000000e+00, float* %3
br label %32
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i64 @min_match_length(i8* %13, i8* %14)
store i64 %15, i64* %8
%16 = load i64, i64* @INT_MAX
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store float 0.000000e+00, float* %3
br label %32
19: ; preds = %12
%20 = load i8*, i8** %5
%21 = call i64 @strlen(i8* %20)
store i64 %21, i64* %6
%22 = load i8*, i8** %4
%23 = call i64 @strlen(i8* %22)
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = uitofp i64 %24 to float
%26 = load i64, i64* %8
%27 = uitofp i64 %26 to float
%28 = fdiv float %25, %27
%29 = load i64, i64* %6
%30 = uitofp i64 %29 to float
%31 = fdiv float %28, %30
store float %31, float* %3
br label %32
32: ; preds = %19, %18, %11
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define float @score(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = tail call i64 @min_match_length(i8* %0, i8* %1)
%6 = load i64, i64* @INT_MAX
%7 = icmp eq i64 %5, %6
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = tail call i64 @strlen(i8* %1)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%11 = uitofp i64 %10 to float
%12 = uitofp i64 %5 to float
%13 = fdiv float %11, %12
%14 = uitofp i64 %9 to float
%15 = fdiv float %13, %14
br label %16
16: ; preds = %4, %2, %8
%17 = phi float [ %15, %8 ], [ 0.000000e+00, %2 ], [ 0.000000e+00, %4 ]
ret float %17
}