#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*/ IsValidBase(int const, int, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int HasTransition(const int codon1, const int codon2) {
  int a, b;
  assert(IsValidBase(codon1, 2, 0));
  assert(IsValidBase(codon2, 2, 0));
  a = codon1 & 3;
  b = codon2 & 3;
  if ((a + b) % 2 == 0 && a != b)
    return 1;
  a = (codon1 >> 2) & 3;
  b = (codon2 >> 2) & 3;
  if ((a + b) % 2 == 0 && a != b)
    return 1;
  a = (codon1 >> 4) & 3;
  b = (codon2 >> 4) & 3;
  if ((a + b) % 2 == 0 && a != b)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<HasTransition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119b <HasTransition+0x7b>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     119b <HasTransition+0x7b>
movl   $0x1,-0x4(%rbp)
jmp    1230 <HasTransition+0x110>
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e2 <HasTransition+0xc2>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11e2 <HasTransition+0xc2>
movl   $0x1,-0x4(%rbp)
jmp    1230 <HasTransition+0x110>
mov    -0x8(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1229 <HasTransition+0x109>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1229 <HasTransition+0x109>
movl   $0x1,-0x4(%rbp)
jmp    1230 <HasTransition+0x110>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HasTransition>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    (%rbx,%r14,1),%eax
test   $0x1,%al
jne    1168 <HasTransition+0x48>
mov    %ebx,%ecx
xor    %r14d,%ecx
mov    $0x1,%eax
test   $0x3,%cl
jne    11a5 <HasTransition+0x85>
mov    %r14d,%eax
shr    $0x2,%eax
mov    %ebx,%ecx
shr    $0x2,%ecx
lea    (%rcx,%rax,1),%edx
test   $0x1,%dl
jne    1187 <HasTransition+0x67>
xor    %eax,%ecx
mov    $0x1,%eax
test   $0x3,%cl
jne    11a5 <HasTransition+0x85>
shr    $0x4,%r14d
shr    $0x4,%ebx
lea    (%rbx,%r14,1),%eax
test   $0x1,%al
jne    11a3 <HasTransition+0x83>
xor    %r14d,%ebx
mov    $0x1,%eax
test   $0x3,%bl
jne    11a5 <HasTransition+0x85>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @HasTransition(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = call i32 @IsValidBase(i32 %8, i32 2, i32 0)
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %5
%12 = call i32 @IsValidBase(i32 %11, i32 2, i32 0)
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %4
%15 = and i32 %14, 3
store i32 %15, i32* %6
%16 = load i32, i32* %5
%17 = and i32 %16, 3
store i32 %17, i32* %7
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = add nsw i32 %18, %19
%21 = srem i32 %20, 2
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = icmp ne i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 1, i32* %3
br label %63
28: ; preds = %23, %2
%29 = load i32, i32* %4
%30 = ashr i32 %29, 2
%31 = and i32 %30, 3
store i32 %31, i32* %6
%32 = load i32, i32* %5
%33 = ashr i32 %32, 2
%34 = and i32 %33, 3
store i32 %34, i32* %7
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = add nsw i32 %35, %36
%38 = srem i32 %37, 2
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %28
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = icmp ne i32 %41, %42
br i1 %43, label %44, label %45
44: ; preds = %40
store i32 1, i32* %3
br label %63
45: ; preds = %40, %28
%46 = load i32, i32* %4
%47 = ashr i32 %46, 4
%48 = and i32 %47, 3
store i32 %48, i32* %6
%49 = load i32, i32* %5
%50 = ashr i32 %49, 4
%51 = and i32 %50, 3
store i32 %51, i32* %7
%52 = load i32, i32* %6
%53 = load i32, i32* %7
%54 = add nsw i32 %52, %53
%55 = srem i32 %54, 2
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %45
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = icmp ne i32 %58, %59
br i1 %60, label %61, label %62
61: ; preds = %57
store i32 1, i32* %3
br label %63
62: ; preds = %57, %45
store i32 0, i32* %3
br label %63
63: ; preds = %62, %61, %44, %27
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
define i32 @HasTransition(i32 %0, i32 %1) {
%3 = tail call i32 @IsValidBase(i32 %0, i32 2, i32 0)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @IsValidBase(i32 %1, i32 2, i32 0)
%6 = tail call i32 @assert(i32 %5)
%7 = add i32 %1, %0
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = xor i32 %1, %0
%12 = and i32 %11, 3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %10, %2
%15 = lshr i32 %0, 2
%16 = lshr i32 %1, 2
%17 = add nuw nsw i32 %16, %15
%18 = and i32 %17, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = xor i32 %16, %15
%22 = and i32 %21, 3
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %20, %14
%25 = lshr i32 %0, 4
%26 = lshr i32 %1, 4
%27 = add nuw nsw i32 %26, %25
%28 = and i32 %27, 1
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = xor i32 %26, %25
%32 = and i32 %31, 3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30, %24
br label %35
35: ; preds = %30, %20, %10, %34
%36 = phi i32 [ 0, %34 ], [ 1, %10 ], [ 1, %20 ], [ 1, %30 ]
ret i32 %36
}