#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 GapChar(int const);
int const NumberPossibleBases(int const, int const);
int IsValidBase(const int base, const int seqtype, const int gencode) {
  int gapchar;
  gapchar = GapChar(seqtype);
  if (0 <= base &&
      (base < NumberPossibleBases(seqtype, gencode) || base == gapchar))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<IsValidBase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <GapChar@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jg     117d <IsValidBase+0x5d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <NumberPossibleBases@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jl     1171 <IsValidBase+0x51>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    117d <IsValidBase+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    1184 <IsValidBase+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsValidBase>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%edi
call   1040 <GapChar@plt>
test   %ebx,%ebx
js     1156 <IsValidBase+0x36>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %r15d,%esi
call   1030 <NumberPossibleBases@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ebx,%ecx
jg     1158 <IsValidBase+0x38>
cmp    %ebx,%r14d
je     1158 <IsValidBase+0x38>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IsValidBase(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = call i32 @GapChar(i32 %9)
store i32 %10, i32* %8
%11 = load i32, i32* %5
%12 = icmp sle i32 0, %11
br i1 %12, label %13, label %24
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @NumberPossibleBases(i32 %15, i32 %16)
%18 = icmp slt i32 %14, %17
br i1 %18, label %23, label %19
19: ; preds = %13
%20 = load i32, i32* %5
%21 = load i32, i32* %8
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19, %13
store i32 1, i32* %4
br label %25
24: ; preds = %19, %3
store i32 0, i32* %4
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @IsValidBase(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @GapChar(i32 %1)
%5 = icmp sgt i32 %0, -1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = tail call i32 @NumberPossibleBases(i32 %1, i32 %2)
%8 = icmp sgt i32 %7, %0
%9 = icmp eq i32 %4, %0
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %12, label %11
11: ; preds = %6, %3
br label %12
12: ; preds = %6, %11
%13 = phi i32 [ 0, %11 ], [ 1, %6 ]
ret i32 %13
}