#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 IsValidBase(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int NumberNucChanges(int codon1, int codon2) {
  int c = 0;
  assert(IsValidBase(codon1, 2, 0));
  assert(IsValidBase(codon1, 2, 0));
  c += !((codon1 & 3) == (codon2 & 3));
  codon1 >>= 2;
  codon2 >>= 2;
  c += !((codon1 & 3) == (codon2 & 3));
  codon1 >>= 2;
  codon2 >>= 2;
  c += !((codon1 & 3) == (codon2 & 3));
  assert(c >= 0 && c <= 3);
  return c;
}


x86 assembly (clang, -O0):
<NumberNucChanges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
and    $0x3,%eax
mov    -0x8(%rbp),%ecx
and    $0x3,%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
mov    -0x8(%rbp),%ecx
and    $0x3,%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
mov    -0x8(%rbp),%ecx
and    $0x3,%ecx
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     11f8 <NumberNucChanges+0xd8>
cmpl   $0x3,-0xc(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumberNucChanges>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    %ebp,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <IsValidBase@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %ebp,%ebx
xor    %ebp,%ebp
test   $0x3,%bl
setne  %bpl
mov    %ebx,%eax
and    $0xc,%eax
cmp    $0x1,%eax
sbb    $0xffffffff,%ebp
and    $0x30,%ebx
cmp    $0x1,%ebx
sbb    $0xffffffff,%ebp
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @NumberNucChanges(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 %0, i32 2, i32 0)
%6 = tail call i32 @assert(i32 %5)
%7 = xor i32 %1, %0
%8 = and i32 %7, 3
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
%11 = and i32 %7, 12
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %10, %13
%15 = and i32 %7, 48
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %14, %17
%19 = tail call i32 @assert(i32 1)
ret i32 %18
}