#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 int uint8_t;
typedef int uint32_t;

/* Variables and functions */
scalar_t__ encode_allele(int *, int *, char const *, size_t);
uint32_t encode_refalt_rev(const char *ref, size_t sizeref, const char *alt,
                           size_t sizealt) {
  uint32_t h = 0;
  h |= ((uint32_t)(sizeref) << 27);
  h |= ((uint32_t)(sizealt) << 23);
  uint8_t bitpos = 23;
  if ((encode_allele(&h, &bitpos, ref, sizeref) < 0) ||
      (encode_allele(&h, &bitpos, alt, sizealt) < 0)) {
    return 0;
  }
  return h;
}


x86 assembly (clang, -O0):
<encode_refalt_rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x1b,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
shl    $0x17,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x17,-0x30(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <encode_allele@plt>
cmp    $0x0,%rax
jl     118e <encode_refalt_rev+0x7e>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <encode_allele@plt>
cmp    $0x0,%rax
jge    119a <encode_refalt_rev+0x8a>
movl   $0x0,-0x4(%rbp)
jmp    11a0 <encode_refalt_rev+0x90>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_refalt_rev>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    %ecx,%eax
shl    $0x1b,%eax
mov    %ebx,%esi
shl    $0x17,%esi
or     %eax,%esi
mov    %esi,(%rsp)
movl   $0x17,0x4(%rsp)
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1030 <encode_allele@plt>
test   %rax,%rax
js     116b <encode_refalt_rev+0x5b>
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <encode_allele@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     116d <encode_refalt_rev+0x5d>
mov    (%rsp),%eax
jmp    116d <encode_refalt_rev+0x5d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @encode_refalt_rev(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %5 to i8*
%8 = trunc i64 %1 to i32
%9 = shl i32 %8, 27
%10 = trunc i64 %3 to i32
%11 = shl i32 %10, 23
%12 = or i32 %11, %9
store i32 %12, i32* %5
%13 = bitcast i32* %6 to i8*
store i32 23, i32* %6
%14 = call i64 @encode_allele(i32* %5, i32* %6, i8* %0, i64 %1)
%15 = icmp slt i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %4
%17 = call i64 @encode_allele(i32* %5, i32* %6, i8* %2, i64 %3)
%18 = icmp slt i64 %17, 0
%19 = load i32, i32* %5
%20 = select i1 %18, i32 0, i32 %19
br label %21
21: ; preds = %16, %4
%22 = phi i32 [ 0, %4 ], [ %20, %16 ]
ret i32 %22
}