#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 /*<<< orphan*/ perror(char *);
int prob;
int x;
char mutatePij(char ancbase, double Pij[4][4]) {
  char newbase = '?';
  double ran1(), x, prob;
  while ((x = ran1()) == 1.)
    ;
  switch (ancbase) {
  case 'A':
    if (x < (prob = Pij[0][0]))
      newbase = 'A';
    else if (x < (prob += Pij[0][2]))
      newbase = 'G';
    else if (x < (prob += Pij[0][1]))
      newbase = 'C';
    else
      newbase = 'T';
    break;
  case 'C':
    if (x < (prob = Pij[1][1]))
      newbase = 'C';
    else if (x < (prob += Pij[1][3]))
      newbase = 'T';
    else if (x < (prob += Pij[1][0]))
      newbase = 'A';
    else
      newbase = 'G';
    break;
  case 'G':
    if (x < (prob = Pij[2][2]))
      newbase = 'G';
    else if (x < (prob += Pij[2][0]))
      newbase = 'A';
    else if (x < (prob += Pij[2][1]))
      newbase = 'C';
    else
      newbase = 'T';
    break;
  case 'T':
    if (x < (prob = Pij[3][3]))
      newbase = 'T';
    else if (x < (prob += Pij[3][1]))
      newbase = 'C';
    else if (x < (prob += Pij[3][0]))
      newbase = 'A';
    else
      newbase = 'G';
    break;
  default:
    perror("mutatePij switch (ancbase): no case satisfied\n");
  }
  return newbase;
}


x86 assembly (clang, -O0):
<mutatePij>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x3f,-0x11(%rbp)
mov    $0x0,%al
call   1030 <ran1@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    115f <mutatePij+0x3f>
jp     115f <mutatePij+0x3f>
jmp    1136 <mutatePij+0x16>
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x13,%eax
ja     13c4 <mutatePij+0x2a4>
mov    -0x30(%rbp),%rax
lea    0xe88(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    11ae <mutatePij+0x8e>
movb   $0x41,-0x11(%rbp)
jmp    1212 <mutatePij+0xf2>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    11d9 <mutatePij+0xb9>
movb   $0x47,-0x11(%rbp)
jmp    120d <mutatePij+0xed>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    1204 <mutatePij+0xe4>
movb   $0x43,-0x11(%rbp)
jmp    1208 <mutatePij+0xe8>
movb   $0x54,-0x11(%rbp)
jmp    120d <mutatePij+0xed>
jmp    1212 <mutatePij+0xf2>
jmp    13d0 <mutatePij+0x2b0>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    123d <mutatePij+0x11d>
movb   $0x43,-0x11(%rbp)
jmp    12a1 <mutatePij+0x181>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    1268 <mutatePij+0x148>
movb   $0x54,-0x11(%rbp)
jmp    129c <mutatePij+0x17c>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    1293 <mutatePij+0x173>
movb   $0x41,-0x11(%rbp)
jmp    1297 <mutatePij+0x177>
movb   $0x47,-0x11(%rbp)
jmp    129c <mutatePij+0x17c>
jmp    12a1 <mutatePij+0x181>
jmp    13d0 <mutatePij+0x2b0>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    12cc <mutatePij+0x1ac>
movb   $0x47,-0x11(%rbp)
jmp    1330 <mutatePij+0x210>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    12f7 <mutatePij+0x1d7>
movb   $0x41,-0x11(%rbp)
jmp    132b <mutatePij+0x20b>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    1322 <mutatePij+0x202>
movb   $0x43,-0x11(%rbp)
jmp    1326 <mutatePij+0x206>
movb   $0x54,-0x11(%rbp)
jmp    132b <mutatePij+0x20b>
jmp    1330 <mutatePij+0x210>
jmp    13d0 <mutatePij+0x2b0>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x78(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    135b <mutatePij+0x23b>
movb   $0x54,-0x11(%rbp)
jmp    13bf <mutatePij+0x29f>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    1386 <mutatePij+0x266>
movb   $0x43,-0x11(%rbp)
jmp    13ba <mutatePij+0x29a>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
ucomisd %xmm1,%xmm0
jbe    13b1 <mutatePij+0x291>
movb   $0x41,-0x11(%rbp)
jmp    13b5 <mutatePij+0x295>
movb   $0x47,-0x11(%rbp)
jmp    13ba <mutatePij+0x29a>
jmp    13bf <mutatePij+0x29f>
jmp    13d0 <mutatePij+0x2b0>
lea    0xc8d(%rip),%rdi
call   1040 <perror@plt>
movsbl -0x11(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutatePij>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <ran1@plt>
ucomisd 0xec1(%rip),%xmm0
jne    1143 <mutatePij+0x23>
jnp    1130 <mutatePij+0x10>
movsbl %bpl,%eax
add    $0xffffffbf,%eax
cmp    $0x13,%eax
ja     1212 <mutatePij+0xf2>
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  (%rbx),%xmm1
mov    $0x41,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x10(%rbx),%xmm1
mov    $0x47,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x8(%rbx),%xmm1
jmp    11cb <mutatePij+0xab>
movsd  0x28(%rbx),%xmm1
mov    $0x43,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x38(%rbx),%xmm1
mov    $0x54,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x20(%rbx),%xmm1
jmp    11fa <mutatePij+0xda>
movsd  0x50(%rbx),%xmm1
mov    $0x47,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x40(%rbx),%xmm1
mov    $0x41,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x48(%rbx),%xmm1
ucomisd %xmm0,%xmm1
mov    $0x43,%ecx
mov    $0x54,%eax
jmp    1208 <mutatePij+0xe8>
movsd  0x78(%rbx),%xmm1
mov    $0x54,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x68(%rbx),%xmm1
mov    $0x43,%al
ucomisd %xmm0,%xmm1
ja     120b <mutatePij+0xeb>
addsd  0x60(%rbx),%xmm1
ucomisd %xmm0,%xmm1
mov    $0x41,%ecx
mov    $0x47,%eax
cmova  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe3f(%rip),%rdi
call   1040 <perror@plt>
mov    $0x3f,%al
jmp    120b <mutatePij+0xeb>

LLVM IR (-O0):
@.str = [47 x i8] c"mutatePij switch (ancbase): no case satisfied\0A\00"
@prob = global i32 0
@x = global i32 0
define signext i8 @mutatePij(i8 signext %0, [4 x double]* %1) {
%3 = alloca i8
%4 = alloca [4 x double]*
%5 = alloca i8
%6 = alloca double
%7 = alloca double
store i8 %0, i8* %3
store [4 x double]* %1, [4 x double]** %4
store i8 63, i8* %5
br label %8
8: ; preds = %11, %2
%9 = call double (...) @ran1()
store double %9, double* %6
%10 = fcmp oeq double %9, 1.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
br label %8
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
switch i32 %14, label %143 [
i32 65, label %15
i32 67, label %47
i32 71, label %79
i32 84, label %111
]
15: ; preds = %12
%16 = load double, double* %6
%17 = load [4 x double]*, [4 x double]** %4
%18 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0
%19 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 0
%20 = load double, double* %19
store double %20, double* %7
%21 = fcmp olt double %16, %20
br i1 %21, label %22, label %23
22: ; preds = %15
store i8 65, i8* %5
br label %46
23: ; preds = %15
%24 = load double, double* %6
%25 = load [4 x double]*, [4 x double]** %4
%26 = getelementptr inbounds [4 x double], [4 x double]* %25, i64 0
%27 = getelementptr inbounds [4 x double], [4 x double]* %26, i64 0, i64 2
%28 = load double, double* %27
%29 = load double, double* %7
%30 = fadd double %29, %28
store double %30, double* %7
%31 = fcmp olt double %24, %30
br i1 %31, label %32, label %33
32: ; preds = %23
store i8 71, i8* %5
br label %45
33: ; preds = %23
%34 = load double, double* %6
%35 = load [4 x double]*, [4 x double]** %4
%36 = getelementptr inbounds [4 x double], [4 x double]* %35, i64 0
%37 = getelementptr inbounds [4 x double], [4 x double]* %36, i64 0, i64 1
%38 = load double, double* %37
%39 = load double, double* %7
%40 = fadd double %39, %38
store double %40, double* %7
%41 = fcmp olt double %34, %40
br i1 %41, label %42, label %43
42: ; preds = %33
store i8 67, i8* %5
br label %44
43: ; preds = %33
store i8 84, i8* %5
br label %44
44: ; preds = %43, %42
br label %45
45: ; preds = %44, %32
br label %46
46: ; preds = %45, %22
br label %145
47: ; preds = %12
%48 = load double, double* %6
%49 = load [4 x double]*, [4 x double]** %4
%50 = getelementptr inbounds [4 x double], [4 x double]* %49, i64 1
%51 = getelementptr inbounds [4 x double], [4 x double]* %50, i64 0, i64 1
%52 = load double, double* %51
store double %52, double* %7
%53 = fcmp olt double %48, %52
br i1 %53, label %54, label %55
54: ; preds = %47
store i8 67, i8* %5
br label %78
55: ; preds = %47
%56 = load double, double* %6
%57 = load [4 x double]*, [4 x double]** %4
%58 = getelementptr inbounds [4 x double], [4 x double]* %57, i64 1
%59 = getelementptr inbounds [4 x double], [4 x double]* %58, i64 0, i64 3
%60 = load double, double* %59
%61 = load double, double* %7
%62 = fadd double %61, %60
store double %62, double* %7
%63 = fcmp olt double %56, %62
br i1 %63, label %64, label %65
64: ; preds = %55
store i8 84, i8* %5
br label %77
65: ; preds = %55
%66 = load double, double* %6
%67 = load [4 x double]*, [4 x double]** %4
%68 = getelementptr inbounds [4 x double], [4 x double]* %67, i64 1
%69 = getelementptr inbounds [4 x double], [4 x double]* %68, i64 0, i64 0
%70 = load double, double* %69
%71 = load double, double* %7
%72 = fadd double %71, %70
store double %72, double* %7
%73 = fcmp olt double %66, %72
br i1 %73, label %74, label %75
74: ; preds = %65
store i8 65, i8* %5
br label %76
75: ; preds = %65
store i8 71, i8* %5
br label %76
76: ; preds = %75, %74
br label %77
77: ; preds = %76, %64
br label %78
78: ; preds = %77, %54
br label %145
79: ; preds = %12
%80 = load double, double* %6
%81 = load [4 x double]*, [4 x double]** %4
%82 = getelementptr inbounds [4 x double], [4 x double]* %81, i64 2
%83 = getelementptr inbounds [4 x double], [4 x double]* %82, i64 0, i64 2
%84 = load double, double* %83
store double %84, double* %7
%85 = fcmp olt double %80, %84
br i1 %85, label %86, label %87
86: ; preds = %79
store i8 71, i8* %5
br label %110
87: ; preds = %79
%88 = load double, double* %6
%89 = load [4 x double]*, [4 x double]** %4
%90 = getelementptr inbounds [4 x double], [4 x double]* %89, i64 2
%91 = getelementptr inbounds [4 x double], [4 x double]* %90, i64 0, i64 0
%92 = load double, double* %91
%93 = load double, double* %7
%94 = fadd double %93, %92
store double %94, double* %7
%95 = fcmp olt double %88, %94
br i1 %95, label %96, label %97
96: ; preds = %87
store i8 65, i8* %5
br label %109
97: ; preds = %87
%98 = load double, double* %6
%99 = load [4 x double]*, [4 x double]** %4
%100 = getelementptr inbounds [4 x double], [4 x double]* %99, i64 2
%101 = getelementptr inbounds [4 x double], [4 x double]* %100, i64 0, i64 1
%102 = load double, double* %101
%103 = load double, double* %7
%104 = fadd double %103, %102
store double %104, double* %7
%105 = fcmp olt double %98, %104
br i1 %105, label %106, label %107
106: ; preds = %97
store i8 67, i8* %5
br label %108
107: ; preds = %97
store i8 84, i8* %5
br label %108
108: ; preds = %107, %106
br label %109
109: ; preds = %108, %96
br label %110
110: ; preds = %109, %86
br label %145
111: ; preds = %12
%112 = load double, double* %6
%113 = load [4 x double]*, [4 x double]** %4
%114 = getelementptr inbounds [4 x double], [4 x double]* %113, i64 3
%115 = getelementptr inbounds [4 x double], [4 x double]* %114, i64 0, i64 3
%116 = load double, double* %115
store double %116, double* %7
%117 = fcmp olt double %112, %116
br i1 %117, label %118, label %119
118: ; preds = %111
store i8 84, i8* %5
br label %142
119: ; preds = %111
%120 = load double, double* %6
%121 = load [4 x double]*, [4 x double]** %4
%122 = getelementptr inbounds [4 x double], [4 x double]* %121, i64 3
%123 = getelementptr inbounds [4 x double], [4 x double]* %122, i64 0, i64 1
%124 = load double, double* %123
%125 = load double, double* %7
%126 = fadd double %125, %124
store double %126, double* %7
%127 = fcmp olt double %120, %126
br i1 %127, label %128, label %129
128: ; preds = %119
store i8 67, i8* %5
br label %141
129: ; preds = %119
%130 = load double, double* %6
%131 = load [4 x double]*, [4 x double]** %4
%132 = getelementptr inbounds [4 x double], [4 x double]* %131, i64 3
%133 = getelementptr inbounds [4 x double], [4 x double]* %132, i64 0, i64 0
%134 = load double, double* %133
%135 = load double, double* %7
%136 = fadd double %135, %134
store double %136, double* %7
%137 = fcmp olt double %130, %136
br i1 %137, label %138, label %139
138: ; preds = %129
store i8 65, i8* %5
br label %140
139: ; preds = %129
store i8 71, i8* %5
br label %140
140: ; preds = %139, %138
br label %141
141: ; preds = %140, %128
br label %142
142: ; preds = %141, %118
br label %145
143: ; preds = %12
%144 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %145
145: ; preds = %143, %142, %110, %78, %46
%146 = load i8, i8* %5
ret i8 %146
}

LLVM IR (-O2):
@.str = [47 x i8] c"mutatePij switch (ancbase): no case satisfied\0A\00"
@prob = global i32 0
@x = global i32 0
define signext i8 @mutatePij(i8 signext %0, [4 x double]* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call double (...) @ran1()
%5 = fcmp oeq double %4, 1.000000e+00
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = sext i8 %0 to i32
switch i32 %7, label %68 [
i32 65, label %8
i32 67, label %23
i32 71, label %38
i32 84, label %53
]
8: ; preds = %6
%9 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%10 = load double, double* %9
%11 = fcmp olt double %4, %10
br i1 %11, label %70, label %12
12: ; preds = %8
%13 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 2
%14 = load double, double* %13
%15 = fadd double %10, %14
%16 = fcmp olt double %4, %15
br i1 %16, label %70, label %17
17: ; preds = %12
%18 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
%19 = load double, double* %18
%20 = fadd double %15, %19
%21 = fcmp olt double %4, %20
%22 = select i1 %21, i8 67, i8 84
br label %70
23: ; preds = %6
%24 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
%25 = load double, double* %24
%26 = fcmp olt double %4, %25
br i1 %26, label %70, label %27
27: ; preds = %23
%28 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
%29 = load double, double* %28
%30 = fadd double %25, %29
%31 = fcmp olt double %4, %30
br i1 %31, label %70, label %32
32: ; preds = %27
%33 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 0
%34 = load double, double* %33
%35 = fadd double %30, %34
%36 = fcmp olt double %4, %35
%37 = select i1 %36, i8 65, i8 71
br label %70
38: ; preds = %6
%39 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
%40 = load double, double* %39
%41 = fcmp olt double %4, %40
br i1 %41, label %70, label %42
42: ; preds = %38
%43 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
%44 = load double, double* %43
%45 = fadd double %40, %44
%46 = fcmp olt double %4, %45
br i1 %46, label %70, label %47
47: ; preds = %42
%48 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
%49 = load double, double* %48
%50 = fadd double %45, %49
%51 = fcmp olt double %4, %50
%52 = select i1 %51, i8 67, i8 84
br label %70
53: ; preds = %6
%54 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
%55 = load double, double* %54
%56 = fcmp olt double %4, %55
br i1 %56, label %70, label %57
57: ; preds = %53
%58 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 1
%59 = load double, double* %58
%60 = fadd double %55, %59
%61 = fcmp olt double %4, %60
br i1 %61, label %70, label %62
62: ; preds = %57
%63 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 0
%64 = load double, double* %63
%65 = fadd double %60, %64
%66 = fcmp olt double %4, %65
%67 = select i1 %66, i8 65, i8 71
br label %70
68: ; preds = %6
%69 = tail call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %70
70: ; preds = %62, %57, %53, %47, %42, %38, %32, %27, %23, %17, %12, %8, %68
%71 = phi i8 [ 63, %68 ], [ 65, %8 ], [ 71, %12 ], [ %22, %17 ], [ 67, %23 ], [ 84, %27 ], [ %37, %32 ], [ 71, %38 ], [ 65, %42 ], [ %52, %47 ], [ 84, %53 ], [ 67, %57 ], [ %67, %62 ]
ret i8 %71
}