#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 base2idx(char);
char get_higher_AF_base(const double *population_ACGT_allele_frequency,
                        char base1, char base2) {
  if (population_ACGT_allele_frequency[base2idx(base1)] >=
      population_ACGT_allele_frequency[base2idx(base2)]) {
    return base1;
  } else {
    return base2;
  }
}


x86 assembly (clang, -O0):
<get_higher_AF_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <base2idx@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsbl -0x12(%rbp),%edi
call   1030 <base2idx@plt>
movsd  -0x28(%rbp),%xmm0
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
ucomisd (%rax,%rcx,8),%xmm0
jb     117c <get_higher_AF_base+0x6c>
mov    -0x11(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1182 <get_higher_AF_base+0x72>
mov    -0x12(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_higher_AF_base>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <base2idx@plt>
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
call   1030 <base2idx@plt>
movsd  0x8(%rsp),%xmm0
ucomisd (%rbx,%rax,8),%xmm0
cmovb  %r14d,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @get_higher_AF_base(double* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca double*
%6 = alloca i8
%7 = alloca i8
store double* %0, double** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
%8 = load double*, double** %5
%9 = load i8, i8* %6
%10 = call i64 @base2idx(i8 signext %9)
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = load double, double* %11
%13 = load double*, double** %5
%14 = load i8, i8* %7
%15 = call i64 @base2idx(i8 signext %14)
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = fcmp oge double %12, %17
br i1 %18, label %19, label %21
19: ; preds = %3
%20 = load i8, i8* %6
store i8 %20, i8* %4
br label %23
21: ; preds = %3
%22 = load i8, i8* %7
store i8 %22, i8* %4
br label %23
23: ; preds = %21, %19
%24 = load i8, i8* %4
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @get_higher_AF_base(double* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = tail call i64 @base2idx(i8 signext %1)
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = load double, double* %5
%7 = tail call i64 @base2idx(i8 signext %2)
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = fcmp ult double %6, %9
%11 = select i1 %10, i8 %2, i8 %1
ret i8 %11
}