#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 base2idx(char const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
double log10(int);
int /*<<< orphan*/ stderr;
double *individual_log10_prior(const char *chr_type, char individual_sex,
                               const char *individual_ref_alt_base,
                               const double *population_ACGT_allele_frequency,
                               double mosaic_rate, double *tmp_4_double_vec) {
  int individual_ref_base_idx = base2idx(individual_ref_alt_base[0]);
  int individual_alt_base_idx = base2idx(individual_ref_alt_base[1]);
  double ref_AF = population_ACGT_allele_frequency[individual_ref_base_idx];
  double alt_AF = population_ACGT_allele_frequency[individual_alt_base_idx];
  double log10_ref_AF;
  log10_ref_AF = log10(ref_AF / (ref_AF + alt_AF));
  double log10_alt_AF;
  log10_alt_AF = log10(alt_AF / (ref_AF + alt_AF));
  tmp_4_double_vec[3] = log10(mosaic_rate);
  double log10_not_mosiac = log10(1 - mosaic_rate);
  if (chr_type[0] == 'A' || (chr_type[0] == 'X' && individual_sex == 'F')) {
    tmp_4_double_vec[0] = 2 * log10_ref_AF + log10_not_mosiac;
    tmp_4_double_vec[1] =
        log10(2) + log10_ref_AF + log10_alt_AF + log10_not_mosiac;
    tmp_4_double_vec[2] = 2 * log10_alt_AF + log10_not_mosiac;
  } else if (chr_type[0] == 'X' && individual_sex == 'M') {
    tmp_4_double_vec[0] = log10_ref_AF + log10_not_mosiac;
    tmp_4_double_vec[1] = -1e100;
    tmp_4_double_vec[2] = log10_alt_AF + log10_not_mosiac;
  } else if (chr_type[0] == 'Y' && individual_sex == 'M') {
    tmp_4_double_vec[0] = log10_ref_AF + log10_not_mosiac;
    tmp_4_double_vec[1] = -1e100;
    tmp_4_double_vec[2] = log10_alt_AF + log10_not_mosiac;
  } else if (chr_type[0] == 'Y' && individual_sex == 'F') {
    tmp_4_double_vec[0] = 0;
    tmp_4_double_vec[1] = 0;
    tmp_4_double_vec[2] = 0;
    tmp_4_double_vec[3] = 0;
  } else {
    fprintf(stderr,
            "Warning: unknown chr_type '%s' in individual_log10_prior()\n",
            chr_type);
  }
  return tmp_4_double_vec;
}


x86 assembly (clang, -O0):
<individual_log10_prior>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <base2idx@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1040 <base2idx@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
movsd  %xmm0,-0x58(%rbp)
cvttsd2si -0x28(%rbp),%edi
call   1050 <log10@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  0xe0d(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
je     1233 <individual_log10_prior+0x103>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    128f <individual_log10_prior+0x15f>
movsbl -0x9(%rbp),%eax
cmp    $0x46,%eax
jne    128f <individual_log10_prior+0x15f>
movsd  -0x50(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    $0x2,%edi
call   1050 <log10@plt>
addsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    13b8 <individual_log10_prior+0x288>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    12e7 <individual_log10_prior+0x1b7>
movsbl -0x9(%rbp),%eax
cmp    $0x4d,%eax
jne    12e7 <individual_log10_prior+0x1b7>
movsd  -0x50(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xd3e(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    13b3 <individual_log10_prior+0x283>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x59,%eax
jne    133f <individual_log10_prior+0x20f>
movsbl -0x9(%rbp),%eax
cmp    $0x4d,%eax
jne    133f <individual_log10_prior+0x20f>
movsd  -0x50(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xce6(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    13ae <individual_log10_prior+0x27e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x59,%eax
jne    1390 <individual_log10_prior+0x260>
movsbl -0x9(%rbp),%eax
cmp    $0x46,%eax
jne    1390 <individual_log10_prior+0x260>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
jmp    13a9 <individual_log10_prior+0x279>
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xc6c(%rip),%rsi
call   1030 <fprintf@plt>
jmp    13ae <individual_log10_prior+0x27e>
jmp    13b3 <individual_log10_prior+0x283>
jmp    13b8 <individual_log10_prior+0x288>
mov    -0x30(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<individual_log10_prior>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r12
movsd  %xmm0,0x18(%rsp)
mov    %rcx,%rbp
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%r14
movsbl (%rdx),%edi
call   1040 <base2idx@plt>
mov    %eax,%r13d
movsbl 0x1(%rbx),%edi
call   1040 <base2idx@plt>
movslq %r13d,%rcx
movsd  0x0(%rbp,%rcx,8),%xmm0
cltq
movsd  0x0(%rbp,%rax,8),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%rsp)
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x18(%rsp),%edi
call   1050 <log10@plt>
movsd  %xmm0,0x18(%r12)
movsd  0xe2c(%rip),%xmm0
subsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <log10@plt>
mov    (%r14),%al
cmp    $0x41,%al
je     11f4 <individual_log10_prior+0xc4>
cmp    $0x46,%r15b
jne    125a <individual_log10_prior+0x12a>
cmp    $0x58,%al
jne    125a <individual_log10_prior+0x12a>
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12)
mov    $0x2,%edi
movsd  %xmm0,0x18(%rsp)
call   1050 <log10@plt>
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%r12)
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%r12)
mov    %r12,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x4d,%r15b
jne    1264 <individual_log10_prior+0x134>
cmp    $0x58,%al
je     126e <individual_log10_prior+0x13e>
cmp    $0x4d,%r15b
jne    1299 <individual_log10_prior+0x169>
cmp    $0x59,%al
jne    1299 <individual_log10_prior+0x169>
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12)
movabs $0xd4b249ad2594c37d,%rax
49 b2 d4
mov    %rax,0x8(%r12)
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
jmp    1241 <individual_log10_prior+0x111>
cmp    $0x46,%r15b
jne    12b6 <individual_log10_prior+0x186>
cmp    $0x59,%al
jne    12b6 <individual_log10_prior+0x186>
xorpd  %xmm0,%xmm0
movupd %xmm0,0x10(%r12)
movupd %xmm0,(%r12)
jmp    1248 <individual_log10_prior+0x118>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
jmp    1248 <individual_log10_prior+0x118>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"Warning: unknown chr_type '%s' in individual_log10_prior()\0A\00"
define double* @individual_log10_prior(i8* %0, i8 signext %1, i8* %2, double* %3, double %4, double* %5) {
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i8*
%10 = alloca double*
%11 = alloca double
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i8* %0, i8** %7
store i8 %1, i8* %8
store i8* %2, i8** %9
store double* %3, double** %10
store double %4, double* %11
store double* %5, double** %12
%20 = load i8*, i8** %9
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = call i32 @base2idx(i8 signext %22)
store i32 %23, i32* %13
%24 = load i8*, i8** %9
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = call i32 @base2idx(i8 signext %26)
store i32 %27, i32* %14
%28 = load double*, double** %10
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
store double %32, double* %15
%33 = load double*, double** %10
%34 = load i32, i32* %14
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
store double %37, double* %16
%38 = load double, double* %15
%39 = load double, double* %15
%40 = load double, double* %16
%41 = fadd double %39, %40
%42 = fdiv double %38, %41
%43 = fptosi double %42 to i32
%44 = call double @log10(i32 %43)
store double %44, double* %17
%45 = load double, double* %16
%46 = load double, double* %15
%47 = load double, double* %16
%48 = fadd double %46, %47
%49 = fdiv double %45, %48
%50 = fptosi double %49 to i32
%51 = call double @log10(i32 %50)
store double %51, double* %18
%52 = load double, double* %11
%53 = fptosi double %52 to i32
%54 = call double @log10(i32 %53)
%55 = load double*, double** %12
%56 = getelementptr inbounds double, double* %55, i64 3
store double %54, double* %56
%57 = load double, double* %11
%58 = fsub double 1.000000e+00, %57
%59 = fptosi double %58 to i32
%60 = call double @log10(i32 %59)
store double %60, double* %19
%61 = load i8*, i8** %7
%62 = getelementptr inbounds i8, i8* %61, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 65
br i1 %65, label %76, label %66
66: ; preds = %6
%67 = load i8*, i8** %7
%68 = getelementptr inbounds i8, i8* %67, i64 0
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 88
br i1 %71, label %72, label %96
72: ; preds = %66
%73 = load i8, i8* %8
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 70
br i1 %75, label %76, label %96
76: ; preds = %72, %6
%77 = load double, double* %17
%78 = load double, double* %19
%79 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %77, double %78)
%80 = load double*, double** %12
%81 = getelementptr inbounds double, double* %80, i64 0
store double %79, double* %81
%82 = call double @log10(i32 2)
%83 = load double, double* %17
%84 = fadd double %82, %83
%85 = load double, double* %18
%86 = fadd double %84, %85
%87 = load double, double* %19
%88 = fadd double %86, %87
%89 = load double*, double** %12
%90 = getelementptr inbounds double, double* %89, i64 1
store double %88, double* %90
%91 = load double, double* %18
%92 = load double, double* %19
%93 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %91, double %92)
%94 = load double*, double** %12
%95 = getelementptr inbounds double, double* %94, i64 2
store double %93, double* %95
br label %168
96: ; preds = %72, %66
%97 = load i8*, i8** %7
%98 = getelementptr inbounds i8, i8* %97, i64 0
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 88
br i1 %101, label %102, label %119
102: ; preds = %96
%103 = load i8, i8* %8
%104 = sext i8 %103 to i32
%105 = icmp eq i32 %104, 77
br i1 %105, label %106, label %119
106: ; preds = %102
%107 = load double, double* %17
%108 = load double, double* %19
%109 = fadd double %107, %108
%110 = load double*, double** %12
%111 = getelementptr inbounds double, double* %110, i64 0
store double %109, double* %111
%112 = load double*, double** %12
%113 = getelementptr inbounds double, double* %112, i64 1
store double -1.000000e+100, double* %113
%114 = load double, double* %18
%115 = load double, double* %19
%116 = fadd double %114, %115
%117 = load double*, double** %12
%118 = getelementptr inbounds double, double* %117, i64 2
store double %116, double* %118
br label %167
119: ; preds = %102, %96
%120 = load i8*, i8** %7
%121 = getelementptr inbounds i8, i8* %120, i64 0
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp eq i32 %123, 89
br i1 %124, label %125, label %142
125: ; preds = %119
%126 = load i8, i8* %8
%127 = sext i8 %126 to i32
%128 = icmp eq i32 %127, 77
br i1 %128, label %129, label %142
129: ; preds = %125
%130 = load double, double* %17
%131 = load double, double* %19
%132 = fadd double %130, %131
%133 = load double*, double** %12
%134 = getelementptr inbounds double, double* %133, i64 0
store double %132, double* %134
%135 = load double*, double** %12
%136 = getelementptr inbounds double, double* %135, i64 1
store double -1.000000e+100, double* %136
%137 = load double, double* %18
%138 = load double, double* %19
%139 = fadd double %137, %138
%140 = load double*, double** %12
%141 = getelementptr inbounds double, double* %140, i64 2
store double %139, double* %141
br label %166
142: ; preds = %125, %119
%143 = load i8*, i8** %7
%144 = getelementptr inbounds i8, i8* %143, i64 0
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
%147 = icmp eq i32 %146, 89
br i1 %147, label %148, label %161
148: ; preds = %142
%149 = load i8, i8* %8
%150 = sext i8 %149 to i32
%151 = icmp eq i32 %150, 70
br i1 %151, label %152, label %161
152: ; preds = %148
%153 = load double*, double** %12
%154 = getelementptr inbounds double, double* %153, i64 0
store double 0.000000e+00, double* %154
%155 = load double*, double** %12
%156 = getelementptr inbounds double, double* %155, i64 1
store double 0.000000e+00, double* %156
%157 = load double*, double** %12
%158 = getelementptr inbounds double, double* %157, i64 2
store double 0.000000e+00, double* %158
%159 = load double*, double** %12
%160 = getelementptr inbounds double, double* %159, i64 3
store double 0.000000e+00, double* %160
br label %165
161: ; preds = %148, %142
%162 = load i32, i32* @stderr
%163 = load i8*, i8** %7
%164 = call i32 @fprintf(i32 %162, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %163)
br label %165
165: ; preds = %161, %152
br label %166
166: ; preds = %165, %129
br label %167
167: ; preds = %166, %106
br label %168
168: ; preds = %167, %76
%169 = load double*, double** %12
ret double* %169
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"Warning: unknown chr_type '%s' in individual_log10_prior()\0A\00"
define double* @individual_log10_prior(i8* %0, i8 signext %1, i8* nocapture %2, double* nocapture %3, double %4, double* returned writeonly %5) {
%7 = load i8, i8* %2
%8 = tail call i32 @base2idx(i8 signext %7)
%9 = getelementptr inbounds i8, i8* %2, i64 1
%10 = load i8, i8* %9
%11 = tail call i32 @base2idx(i8 signext %10)
%12 = sext i32 %8 to i64
%13 = getelementptr inbounds double, double* %3, i64 %12
%14 = load double, double* %13
%15 = sext i32 %11 to i64
%16 = getelementptr inbounds double, double* %3, i64 %15
%17 = load double, double* %16
%18 = fadd double %14, %17
%19 = fdiv double %14, %18
%20 = fptosi double %19 to i32
%21 = tail call double @log10(i32 %20)
%22 = fdiv double %17, %18
%23 = fptosi double %22 to i32
%24 = tail call double @log10(i32 %23)
%25 = fptosi double %4 to i32
%26 = tail call double @log10(i32 %25)
%27 = getelementptr inbounds double, double* %5, i64 3
store double %26, double* %27
%28 = fsub double 1.000000e+00, %4
%29 = fptosi double %28 to i32
%30 = tail call double @log10(i32 %29)
%31 = load i8, i8* %0
%32 = icmp eq i8 %31, 65
br i1 %32, label %37, label %33
33: ; preds = %6
%34 = icmp eq i8 %31, 88
%35 = icmp eq i8 %1, 70
%36 = and i1 %35, %34
br i1 %36, label %37, label %46
37: ; preds = %33, %6
%38 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double %30)
store double %38, double* %5
%39 = tail call double @log10(i32 2)
%40 = fadd double %21, %39
%41 = fadd double %24, %40
%42 = fadd double %30, %41
%43 = getelementptr inbounds double, double* %5, i64 1
store double %42, double* %43
%44 = tail call double @llvm.fmuladd.f64(double %24, double 2.000000e+00, double %30)
%45 = getelementptr inbounds double, double* %5, i64 2
store double %44, double* %45
br label %69
46: ; preds = %33
%47 = icmp eq i8 %1, 77
%48 = and i1 %47, %34
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = fadd double %21, %30
store double %50, double* %5
%51 = getelementptr inbounds double, double* %5, i64 1
store double -1.000000e+100, double* %51
%52 = fadd double %24, %30
%53 = getelementptr inbounds double, double* %5, i64 2
store double %52, double* %53
br label %69
54: ; preds = %46
%55 = icmp eq i8 %31, 89
%56 = and i1 %47, %55
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = fadd double %21, %30
store double %58, double* %5
%59 = getelementptr inbounds double, double* %5, i64 1
store double -1.000000e+100, double* %59
%60 = fadd double %24, %30
%61 = getelementptr inbounds double, double* %5, i64 2
store double %60, double* %61
br label %69
62: ; preds = %54
%63 = and i1 %35, %55
br i1 %63, label %64, label %66
64: ; preds = %62
%65 = bitcast double* %5 to i8*
br label %69
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = tail call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %69
69: ; preds = %49, %64, %66, %57, %37
ret double* %5
}