#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 */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ encode_refalt_hash(char const *, size_t, char const *, size_t);
scalar_t__ encode_refalt_rev(char const *, size_t, char const *, size_t);
uint32_t encode_refalt(const char *ref, size_t sizeref, const char *alt,
                       size_t sizealt) {
  if ((sizeref + sizealt) <= 11) {
    uint32_t h = encode_refalt_rev(ref, sizeref, alt, sizealt);
    if (h != 0) {
      return h;
    }
  }
  return encode_refalt_hash(ref, sizeref, alt, sizealt);
}


x86 assembly (clang, -O0):
<encode_refalt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    -0x28(%rbp),%rax
cmp    $0xb,%rax
ja     1180 <encode_refalt+0x60>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <encode_refalt_rev@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     117b <encode_refalt+0x5b>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <encode_refalt+0x79>
jmp    1180 <encode_refalt+0x60>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <encode_refalt_hash@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_refalt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
lea    (%rcx,%rsi,1),%rax
cmp    $0xb,%rax
ja     1160 <encode_refalt+0x40>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <encode_refalt_rev@plt>
test   %rax,%rax
je     1160 <encode_refalt+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <encode_refalt_hash@plt>

LLVM IR (-O0):
define i64 @encode_refalt(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%11 = load i64, i64* %7
%12 = load i64, i64* %9
%13 = add i64 %11, %12
%14 = icmp ule i64 %13, 11
br i1 %14, label %15, label %26
15: ; preds = %4
%16 = load i8*, i8** %6
%17 = load i64, i64* %7
%18 = load i8*, i8** %8
%19 = load i64, i64* %9
%20 = call i64 @encode_refalt_rev(i8* %16, i64 %17, i8* %18, i64 %19)
store i64 %20, i64* %10
%21 = load i64, i64* %10
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = load i64, i64* %10
store i64 %24, i64* %5
br label %32
25: ; preds = %15
br label %26
26: ; preds = %25, %4
%27 = load i8*, i8** %6
%28 = load i64, i64* %7
%29 = load i8*, i8** %8
%30 = load i64, i64* %9
%31 = call i64 @encode_refalt_hash(i8* %27, i64 %28, i8* %29, i64 %30)
store i64 %31, i64* %5
br label %32
32: ; preds = %26, %23
%33 = load i64, i64* %5
ret i64 %33
}

LLVM IR (-O2):
define i64 @encode_refalt(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = add i64 %3, %1
%6 = icmp ult i64 %5, 12
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i64 @encode_refalt_rev(i8* %0, i64 %1, i8* %2, i64 %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7, %4
%11 = tail call i64 @encode_refalt_hash(i8* %0, i64 %1, i8* %2, i64 %3)
br label %12
12: ; preds = %7, %10
%13 = phi i64 [ %8, %7 ], [ %11, %10 ]
ret i64 %13
}