char XkbToControl(ch)
char ch;
{
  register char c = ch;
  if ((c >= '@' && c < '\177') || c == ' ')
    c &= 0x1F;
  else if (c == '2')
    c = '\000';
  else if (c >= '3' && c <= '7')
    c -= ('3' - '\033');
  else if (c == '8')
    c = '\177';
  else if (c == '/')
    c = '_' & 0x1F;
  return c;
}


x86 assembly (clang, -O0):
<XkbToControl>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x40,%eax
jl     112a <XkbToControl+0x2a>
movsbl -0x2(%rbp),%eax
cmp    $0x7f,%eax
jl     1137 <XkbToControl+0x37>
movsbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jne    1146 <XkbToControl+0x46>
movsbl -0x2(%rbp),%eax
and    $0x1f,%eax
mov    %al,-0x2(%rbp)
jmp    11c0 <XkbToControl+0xc0>
movsbl -0x2(%rbp),%eax
cmp    $0x32,%eax
jne    115c <XkbToControl+0x5c>
movb   $0x0,-0x2(%rbp)
jmp    11bb <XkbToControl+0xbb>
movsbl -0x2(%rbp),%eax
cmp    $0x33,%eax
jl     1185 <XkbToControl+0x85>
movsbl -0x2(%rbp),%eax
cmp    $0x37,%eax
jg     1185 <XkbToControl+0x85>
movsbl -0x2(%rbp),%eax
sub    $0x18,%eax
mov    %al,-0x2(%rbp)
jmp    11b6 <XkbToControl+0xb6>
movsbl -0x2(%rbp),%eax
cmp    $0x38,%eax
jne    119b <XkbToControl+0x9b>
movb   $0x7f,-0x2(%rbp)
jmp    11b1 <XkbToControl+0xb1>
movsbl -0x2(%rbp),%eax
cmp    $0x2f,%eax
jne    11ac <XkbToControl+0xac>
movb   $0x1f,-0x2(%rbp)
jmp    11b1 <XkbToControl+0xb1>
jmp    11b6 <XkbToControl+0xb6>
jmp    11bb <XkbToControl+0xbb>
jmp    11c0 <XkbToControl+0xc0>
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<XkbToControl>:
mov    %edi,%ecx
shl    $0x18,%ecx
cmp    $0x3f000001,%ecx
setge  %al
cmp    $0x7f000000,%ecx
setne  %dl
cmp    $0x20000000,%ecx
je     112e <XkbToControl+0x2e>
and    %dl,%al
jne    112e <XkbToControl+0x2e>
cmp    $0x32000000,%ecx
jne    1135 <XkbToControl+0x35>
xor    %eax,%eax
ret
and    $0x1f,%dil
mov    %edi,%eax
ret
lea    -0x32000001(%rcx),%eax
cmp    $0x5fffffe,%eax
ja     1146 <XkbToControl+0x46>
lea    -0x18(%rdi),%eax
ret
mov    $0x7f,%al
cmp    $0x38000000,%ecx
je     1162 <XkbToControl+0x62>
cmp    $0x2f000000,%ecx
movzbl %dil,%ecx
mov    $0x1f,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @XkbToControl(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = shl i32 %0, 24
%4 = icmp sgt i32 %3, 1056964608
%5 = icmp ne i32 %3, 2130706432
%6 = and i1 %4, %5
%7 = icmp eq i32 %3, 536870912
%8 = or i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = and i8 %2, 31
br label %23
11: ; preds = %1
%12 = icmp eq i32 %3, 838860800
br i1 %12, label %23, label %13
13: ; preds = %11
%14 = add i32 %3, -838860801
%15 = icmp ult i32 %14, 100663295
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = add i8 %2, -24
br label %23
18: ; preds = %13
%19 = icmp eq i32 %3, 939524096
br i1 %19, label %23, label %20
20: ; preds = %18
%21 = icmp eq i32 %3, 788529152
%22 = select i1 %21, i8 31, i8 %2
br label %23
23: ; preds = %18, %11, %20, %16, %9
%24 = phi i8 [ %10, %9 ], [ %17, %16 ], [ %22, %20 ], [ 0, %11 ], [ 127, %18 ]
ret i8 %24
}