// File: /workspace/github_c_makefile_star2_O1/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 0x2cff(%rip), %xmm0     # 0x4008
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1344
movsbl %bl, %eax
addl $-0x41, %eax
cmpl $0x13, %eax
ja 0x132e
movl $0x80045, %ecx          # imm = 0x80045
btl %eax, %ecx
jb 0x1439
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2cc6(%rip), %xmm0     # 0x4008
jmp 0x13b6
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2cb0(%rip), %xmm0     # 0x4008
movsbl %bl, %eax
cmpl $0x46, %eax
jg 0x13a8
cmpl $0x41, %eax
je 0x13d6
cmpl $0x43, %eax
jne 0x13b6
movb $0x54, %bl
ucomisd 0x2c9c(%rip), %xmm0     # 0x4010
ja 0x1439
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c7a(%rip), %xmm0     # 0x4008
ucomisd 0x2c82(%rip), %xmm0     # 0x4018
movl $0x47, %eax
movl $0x41, %ebx
cmoval %eax, %ebx
jmp 0x1439
cmpl $0x47, %eax
je 0x1409
cmpl $0x54, %eax
jne 0x13b6
movb $0x41, %bl
jmp 0x13d8
movb $0x41, %bl
ucomisd 0x2c60(%rip), %xmm0     # 0x4020
ja 0x1439
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c32(%rip), %xmm0     # 0x4008
movb $0x54, %bl
ucomisd 0x2c30(%rip), %xmm0     # 0x4010
ja 0x1439
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2c12(%rip), %xmm0     # 0x4008
ucomisd 0x2c1a(%rip), %xmm0     # 0x4018
seta %bl
shlb $0x2, %bl
orb $0x43, %bl
jmp 0x1439
movb $0x54, %bl
ucomisd 0x2bfd(%rip), %xmm0     # 0x4010
ja 0x1439
callq 0x1190
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x2bdf(%rip), %xmm0     # 0x4008
ucomisd 0x2be7(%rip), %xmm0     # 0x4018
setbe %bl
addb %bl, %bl
orb $0x41, %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq