#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 transl_input(unsigned char const *, int);
int test_fallback(int keypr, const unsigned char *input) {
  int flags = keypr & 0x100;
  int k = keypr & 63;
  if ((!(keypr & 0x100) || k == ' ') && (k == 5 || k == 6))
    return 0;
  keypr = transl_input(input, flags);
  return !keypr || k == (keypr & 63);
}


x86 assembly (clang, -O0):
<test_fallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     114e <test_fallback+0x3e>
cmpl   $0x20,-0x18(%rbp)
jne    116e <test_fallback+0x5e>
cmpl   $0x5,-0x18(%rbp)
je     1162 <test_fallback+0x52>
cmpl   $0x6,-0x18(%rbp)
jne    116e <test_fallback+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <test_fallback+0x98>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <transl_input@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x19(%rbp)
je     119d <test_fallback+0x8d>
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0x3f,%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fallback>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%ecx
and    $0x100,%ecx
and    $0x3f,%ebx
mov    %ecx,%eax
shr    $0x8,%eax
cmp    $0x20,%ebx
setne  %dl
test   %dl,%al
jne    1139 <test_fallback+0x29>
lea    -0x5(%rbx),%edx
xor    %eax,%eax
cmp    $0x2,%edx
jae    1139 <test_fallback+0x29>
pop    %rbx
ret
mov    %rsi,%rdi
mov    %ecx,%esi
call   1030 <transl_input@plt>
test   %eax,%eax
sete   %cl
and    $0x3f,%eax
cmp    %eax,%ebx
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_fallback(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%8 = load i32, i32* %4
%9 = and i32 %8, 256
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = and i32 %10, 63
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = and i32 %12, 256
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 32
br i1 %17, label %18, label %25
18: ; preds = %15, %2
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 5
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 6
br i1 %23, label %24, label %25
24: ; preds = %21, %18
store i32 0, i32* %3
br label %39
25: ; preds = %21, %15
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = call i32 @transl_input(i8* %26, i32 %27)
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = load i32, i32* %7
%33 = load i32, i32* %4
%34 = and i32 %33, 63
%35 = icmp eq i32 %32, %34
br label %36
36: ; preds = %31, %25
%37 = phi i1 [ true, %25 ], [ %35, %31 ]
%38 = zext i1 %37 to i32
store i32 %38, i32* %3
br label %39
39: ; preds = %36, %24
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
define i32 @test_fallback(i32 %0, i8* %1) {
%3 = and i32 %0, 256
%4 = and i32 %0, 63
%5 = icmp eq i32 %3, 0
%6 = icmp eq i32 %4, 32
%7 = or i1 %5, %6
%8 = add nsw i32 %4, -5
%9 = icmp ult i32 %8, 2
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = tail call i32 @transl_input(i8* %1, i32 %3)
%13 = icmp eq i32 %12, 0
%14 = and i32 %12, 63
%15 = icmp eq i32 %4, %14
%16 = or i1 %13, %15
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %2, %11
%19 = phi i32 [ %17, %11 ], [ 0, %2 ]
ret i32 %19
}