// File: /workspace/github_c_makefile_star2_O3/sc932[P]ALE/src/synthReadGen.c
// Function: getBaseWithError
char getBaseWithError(const char res, const double errorRate){
  if(errorRate > rand() / ( RAND_MAX + 1.0 )){
    //printf("True.\n");
      if(res == 'A' || res == 'T' || res == 'G' || res == 'C'){
          return res;
      }else{
          // ambiguous
          if(0.25 < rand() / ( RAND_MAX + 1.0 )){
              return 'A';
          }else{
              if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
                  return 'T';
              }else{
                  if(0.5 < rand() / ( RAND_MAX + 1.0 )){
                      return 'G';
                  }else{
                      return 'C';
                  }
              }
          }
      }
  }else{ // error!
    //printf("False.\n");
    if(res == 'A'){
      if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
    return 'T';
      }else{
    if(0.5 < rand() / ( RAND_MAX + 1.0 )){
      return 'G';
    }else{
      return 'C';
    }
      }
    }
    if(res == 'T'){
      if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
    return 'A';
      }else{
    if(0.5 < rand() / ( RAND_MAX + 1.0 )){
      return 'G';
    }else{
      return 'C';
    }
      }
    }
    if(res == 'G'){
      if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
    return 'T';
      }else{
    if(0.5 < rand() / ( RAND_MAX + 1.0 )){
      return 'A';
    }else{
      return 'C';
    }
      }
    }
    if(res == 'C'){
      if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
    return 'T';
      }else{
    if(0.5 < rand() / ( RAND_MAX + 1.0 )){
      return 'G';
    }else{
      return 'A';
    }
      }
    }
  }
  // ambiguous return a random base
  if(0.25 < rand() / ( RAND_MAX + 1.0 )){
      return 'A';
  }else{
      if(0.33333333 < rand() / ( RAND_MAX + 1.0 )){
          return 'T';
      }else{
          if(0.5 < rand() / ( RAND_MAX + 1.0 )){
              return 'G';
          }else{
              return 'C';
          }
      }
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movl %edi, %ebx
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2d1a(%rip), %xmm0     # 0x4008
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1329
movsbl %bl, %eax
addl $-0x41, %eax
cmpl $0x13, %eax
ja 0x1313
movl $0x80045, %ecx          # imm = 0x80045
btl %eax, %ecx
jb 0x141e
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2ce1(%rip), %xmm0     # 0x4008
jmp 0x139b
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2ccb(%rip), %xmm0     # 0x4008
movsbl %bl, %eax
cmpl $0x46, %eax
jg 0x138d
cmpl $0x41, %eax
je 0x13bb
cmpl $0x43, %eax
jne 0x139b
movb $0x54, %bl
ucomisd 0x2cb7(%rip), %xmm0     # 0x4010
ja 0x141e
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c95(%rip), %xmm0     # 0x4008
ucomisd 0x2c9d(%rip), %xmm0     # 0x4018
movl $0x47, %eax
movl $0x41, %ebx
cmoval %eax, %ebx
jmp 0x141e
cmpl $0x47, %eax
je 0x13ee
cmpl $0x54, %eax
jne 0x139b
movb $0x41, %bl
jmp 0x13bd
movb $0x41, %bl
ucomisd 0x2c7b(%rip), %xmm0     # 0x4020
ja 0x141e
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c4d(%rip), %xmm0     # 0x4008
movb $0x54, %bl
ucomisd 0x2c4b(%rip), %xmm0     # 0x4010
ja 0x141e
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c2d(%rip), %xmm0     # 0x4008
ucomisd 0x2c35(%rip), %xmm0     # 0x4018
seta %bl
shlb $0x2, %bl
orb $0x43, %bl
jmp 0x141e
movb $0x54, %bl
ucomisd 0x2c18(%rip), %xmm0     # 0x4010
ja 0x141e
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2bfa(%rip), %xmm0     # 0x4008
ucomisd 0x2c02(%rip), %xmm0     # 0x4018
setbe %bl
addb %bl, %bl
orb $0x41, %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq