#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 common_prefix_length(int, char *, char *, int, int);
float jaro(char *, char *, int, int);
int /*<<< orphan*/ strcmp(char *, char *);
double winkler(char *s, char *t, int ss, int st) {
  float dist, pref_length;
  if (!strcmp(s, t))
    return 1.0;
  dist = jaro(s, t, ss, st);
  pref_length = common_prefix_length(4, s, t, ss, st);
  dist = dist + pref_length * 0.1 * (1 - dist);
  return dist;
}


x86 assembly (clang, -O0):
<winkler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    116e <winkler+0x3e>
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f2 <winkler+0xc2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1050 <jaro@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    $0x4,%edi
call   1040 <common_prefix_length@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4a(%rip),%xmm2
mulsd  %xmm2,%xmm0
movss  0xe46(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<winkler>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b4 <winkler+0x84>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1050 <jaro@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x4,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1040 <common_prefix_length@plt>
movss  0x4(%rsp),%xmm3
cvtss2sd %xmm3,%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  0xe79(%rip),%xmm0
movss  0xe79(%rip),%xmm2
subss  %xmm3,%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
jmp    11bc <winkler+0x8c>
movsd  0xe44(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @winkler(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = call i32 @strcmp(i8* %12, i8* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store double 1.000000e+00, double* %5
br label %40
17: ; preds = %4
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = call float @jaro(i8* %18, i8* %19, i32 %20, i32 %21)
store float %22, float* %10
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = call float @common_prefix_length(i32 4, i8* %23, i8* %24, i32 %25, i32 %26)
store float %27, float* %11
%28 = load float, float* %10
%29 = fpext float %28 to double
%30 = load float, float* %11
%31 = fpext float %30 to double
%32 = fmul double %31, 1.000000e-01
%33 = load float, float* %10
%34 = fsub float 1.000000e+00, %33
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double %32, double %35, double %29)
%37 = fptrunc double %36 to float
store float %37, float* %10
%38 = load float, float* %10
%39 = fpext float %38 to double
store double %39, double* %5
br label %40
40: ; preds = %17, %16
%41 = load double, double* %5
ret double %41
}

LLVM IR (-O2):
define double @winkler(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %4
%8 = tail call float @jaro(i8* %0, i8* %1, i32 %2, i32 %3)
%9 = tail call float @common_prefix_length(i32 4, i8* %0, i8* %1, i32 %2, i32 %3)
%10 = fpext float %8 to double
%11 = fpext float %9 to double
%12 = fmul double %11, 1.000000e-01
%13 = fsub float 1.000000e+00, %8
%14 = fpext float %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
%16 = fptrunc double %15 to float
%17 = fpext float %16 to double
br label %18
18: ; preds = %4, %7
%19 = phi double [ %17, %7 ], [ 1.000000e+00, %4 ]
ret double %19
}