#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 const GapChar(int);
int /*<<< orphan*/ IsValidBase(int const, int, int const);
int /*<<< orphan*/ IsValidGencode(int const);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int QcoordToCodon(const int qcoord, const int gencode) {
  int mod;
  assert(IsValidGencode(gencode));
  assert(IsValidBase(qcoord, 3, gencode));
  if (GapChar(3) == qcoord)
    return qcoord;
  mod = 0;
  switch (gencode) {
  case 0:
    if (qcoord > 47)
      mod++;
    if (qcoord > 48)
      mod++;
    if (qcoord > 53)
      mod++;
    return (qcoord + mod);
  case 1:
    if (qcoord > 7)
      mod++;
    if (qcoord > 8)
      mod++;
    if (qcoord > 45)
      mod++;
    if (qcoord > 46)
      mod++;
    return (qcoord + mod);
  }
  abort();
  return -1;
}


x86 assembly (clang, -O0):
<QcoordToCodon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <IsValidGencode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    $0x3,%esi
call   1060 <IsValidBase@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x3,%edi
call   1070 <GapChar@plt>
cmp    -0x8(%rbp),%eax
jne    11a2 <QcoordToCodon+0x52>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1275 <QcoordToCodon+0x125>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     11cd <QcoordToCodon+0x7d>
jmp    11bc <QcoordToCodon+0x6c>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1214 <QcoordToCodon+0xc4>
jmp    126e <QcoordToCodon+0x11e>
cmpl   $0x2f,-0x8(%rbp)
jle    11e0 <QcoordToCodon+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x30,-0x8(%rbp)
jle    11f3 <QcoordToCodon+0xa3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x35,-0x8(%rbp)
jle    1206 <QcoordToCodon+0xb6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1275 <QcoordToCodon+0x125>
cmpl   $0x7,-0x8(%rbp)
jle    1227 <QcoordToCodon+0xd7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x8,-0x8(%rbp)
jle    123a <QcoordToCodon+0xea>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2d,-0x8(%rbp)
jle    124d <QcoordToCodon+0xfd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2e,-0x8(%rbp)
jle    1260 <QcoordToCodon+0x110>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1275 <QcoordToCodon+0x125>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QcoordToCodon>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%edi
call   1050 <IsValidGencode@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    %ebp,%edx
call   1060 <IsValidBase@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x3,%edi
call   1070 <GapChar@plt>
cmp    %ebx,%eax
je     11d4 <QcoordToCodon+0x84>
cmp    $0x1,%ebp
je     11ae <QcoordToCodon+0x5e>
test   %ebp,%ebp
jne    11dd <QcoordToCodon+0x8d>
xor    %eax,%eax
cmp    $0x30,%ebx
setge  %al
lea    0x1(%rax),%ecx
cmp    $0x31,%ebx
cmovl  %eax,%ecx
xor    %eax,%eax
cmp    $0x36,%ebx
setge  %al
add    %ebx,%eax
jmp    11d0 <QcoordToCodon+0x80>
xor    %eax,%eax
cmp    $0x8,%ebx
setge  %al
lea    0x1(%rax),%ecx
cmp    $0x9,%ebx
cmovl  %eax,%ecx
xor    %eax,%eax
xor    %edx,%edx
cmp    $0x2e,%ebx
setge  %al
setg   %dl
add    %ebx,%eax
add    %edx,%eax
add    %ecx,%eax
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @QcoordToCodon(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @IsValidGencode(i32 %7)
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @IsValidBase(i32 %10, i32 3, i32 %11)
%13 = call i32 @assert(i32 %12)
%14 = call i32 @GapChar(i32 3)
%15 = load i32, i32* %4
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = load i32, i32* %4
store i32 %18, i32* %3
br label %73
19: ; preds = %2
store i32 0, i32* %6
%20 = load i32, i32* %5
switch i32 %20, label %71 [
i32 0, label %21
i32 1, label %43
]
21: ; preds = %19
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 47
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 48
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %33
33: ; preds = %30, %27
%34 = load i32, i32* %4
%35 = icmp sgt i32 %34, 53
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %39
39: ; preds = %36, %33
%40 = load i32, i32* %4
%41 = load i32, i32* %6
%42 = add nsw i32 %40, %41
store i32 %42, i32* %3
br label %73
43: ; preds = %19
%44 = load i32, i32* %4
%45 = icmp sgt i32 %44, 7
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %49
49: ; preds = %46, %43
%50 = load i32, i32* %4
%51 = icmp sgt i32 %50, 8
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %55
55: ; preds = %52, %49
%56 = load i32, i32* %4
%57 = icmp sgt i32 %56, 45
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %61
61: ; preds = %58, %55
%62 = load i32, i32* %4
%63 = icmp sgt i32 %62, 46
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %67
67: ; preds = %64, %61
%68 = load i32, i32* %4
%69 = load i32, i32* %6
%70 = add nsw i32 %68, %69
store i32 %70, i32* %3
br label %73
71: ; preds = %19
%72 = call i32 (...) @abort()
unreachable
73: ; preds = %67, %39, %17
%74 = load i32, i32* %3
ret i32 %74
}

LLVM IR (-O2):
define i32 @QcoordToCodon(i32 %0, i32 %1) {
%3 = tail call i32 @IsValidGencode(i32 %1)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @IsValidBase(i32 %0, i32 3, i32 %1)
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @GapChar(i32 3)
%8 = icmp eq i32 %7, %0
br i1 %8, label %35, label %9
9: ; preds = %2
switch i32 %1, label %33 [
i32 0, label %10
i32 1, label %20
]
10: ; preds = %9
%11 = icmp sgt i32 %0, 47
%12 = zext i1 %11 to i32
%13 = icmp sgt i32 %0, 48
%14 = select i1 %11, i32 2, i32 1
%15 = select i1 %13, i32 %14, i32 %12
%16 = icmp sgt i32 %0, 53
%17 = zext i1 %16 to i32
%18 = add i32 %17, %0
%19 = add i32 %18, %15
br label %35
20: ; preds = %9
%21 = icmp sgt i32 %0, 7
%22 = zext i1 %21 to i32
%23 = icmp sgt i32 %0, 8
%24 = select i1 %21, i32 2, i32 1
%25 = select i1 %23, i32 %24, i32 %22
%26 = icmp sgt i32 %0, 45
%27 = zext i1 %26 to i32
%28 = icmp sgt i32 %0, 46
%29 = zext i1 %28 to i32
%30 = add i32 %27, %0
%31 = add i32 %30, %29
%32 = add i32 %31, %25
br label %35
33: ; preds = %9
%34 = tail call i32 (...) @abort()
unreachable
35: ; preds = %2, %20, %10
%36 = phi i32 [ %32, %20 ], [ %19, %10 ], [ %0, %2 ]
ret i32 %36
}