#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 */
int vd_align_ukk3(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, int /*<<< orphan*/ *, void *, int,
                  void *, int, int, int (*)(void *, void *, size_t),
                  int /*<<< orphan*/ *, size_t);
int avm_ukk_score3(void *a, int a_len, void *b, int b_len,
                   int (*score_func)(void *, void *, size_t), size_t sz) {
  int threshold = (1 << 2);
  int it, max_it = ((32 - 2 - 1));
  int sc = -2;
  for (it = 0; (it < max_it) && (sc < 0); it++) {
    sc = vd_align_ukk3(NULL, NULL, NULL, NULL, a, a_len, b, b_len, threshold,
                       score_func, NULL, sz);
    threshold *= 2;
  }
  return sc;
}


x86 assembly (clang, -O0):
<avm_ukk_score3>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movl   $0x4,-0x44(%rbp)
movl   $0x1d,-0x4c(%rbp)
movl   $0xfffffffe,-0x50(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4c(%rbp),%ecx
mov    %al,-0x51(%rbp)
jge    116b <avm_ukk_score3+0x5b>
cmpl   $0x0,-0x50(%rbp)
setl   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    117b <avm_ukk_score3+0x6b>
jmp    11e0 <avm_ukk_score3+0xd0>
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x28(%rbp),%r14
mov    -0x2c(%rbp),%ebx
mov    -0x44(%rbp),%r11d
mov    -0x38(%rbp),%r10
mov    -0x40(%rbp),%rax
xor    %ecx,%ecx
mov    %rcx,%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10,0x18(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1030 <vd_align_ukk3@plt>
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1150 <avm_ukk_score3+0x40>
mov    -0x50(%rbp),%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<avm_ukk_score3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %r14d,%r14d
mov    $0x4,%r15d
nopl   0x0(%rax)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %ebp,%r9d
push   0x10(%rsp)
push   $0x0
push   0x18(%rsp)
push   %r15
push   %r12
push   %r13
call   1030 <vd_align_ukk3@plt>
add    $0x30,%rsp
cmp    $0x1b,%r14d
ja     1178 <avm_ukk_score3+0x68>
add    %r15d,%r15d
add    $0x1,%r14d
test   %eax,%eax
js     1140 <avm_ukk_score3+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @avm_ukk_score3(i8* %0, i32 %1, i8* %2, i32 %3, i32 (i8*, i8*, i64)* %4, i64 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32 (i8*, i8*, i64)*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 (i8*, i8*, i64)* %4, i32 (i8*, i8*, i64)** %11
store i64 %5, i64* %12
store i32 4, i32* %13
store i32 29, i32* %15
store i32 -2, i32* %16
store i32 0, i32* %14
br label %17
17: ; preds = %37, %6
%18 = load i32, i32* %14
%19 = load i32, i32* %15
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %16
%23 = icmp slt i32 %22, 0
br label %24
24: ; preds = %21, %17
%25 = phi i1 [ false, %17 ], [ %23, %21 ]
br i1 %25, label %26, label %40
26: ; preds = %24
%27 = load i8*, i8** %7
%28 = load i32, i32* %8
%29 = load i8*, i8** %9
%30 = load i32, i32* %10
%31 = load i32, i32* %13
%32 = load i32 (i8*, i8*, i64)*, i32 (i8*, i8*, i64)** %11
%33 = load i64, i64* %12
%34 = call i32 @vd_align_ukk3(i32* null, i32* null, i32* null, i32* null, i8* %27, i32 %28, i8* %29, i32 %30, i32 %31, i32 (i8*, i8*, i64)* %32, i32* null, i64 %33)
store i32 %34, i32* %16
%35 = load i32, i32* %13
%36 = mul nsw i32 %35, 2
store i32 %36, i32* %13
br label %37
37: ; preds = %26
%38 = load i32, i32* %14
%39 = add nsw i32 %38, 1
store i32 %39, i32* %14
br label %17
40: ; preds = %24
%41 = load i32, i32* %16
ret i32 %41
}

LLVM IR (-O2):
define i32 @avm_ukk_score3(i8* %0, i32 %1, i8* %2, i32 %3, i32 (i8*, i8*, i64)* %4, i64 %5) {
br label %7
7: ; preds = %6, %7
%8 = phi i32 [ 4, %6 ], [ %11, %7 ]
%9 = phi i32 [ 0, %6 ], [ %12, %7 ]
%10 = tail call i32 @vd_align_ukk3(i32* null, i32* null, i32* null, i32* null, i8* %0, i32 %1, i8* %2, i32 %3, i32 %8, i32 (i8*, i8*, i64)* %4, i32* null, i64 %5)
%11 = shl nsw i32 %8, 1
%12 = add nuw nsw i32 %9, 1
%13 = icmp ult i32 %9, 28
%14 = icmp slt i32 %10, 0
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7
ret i32 %10
}