#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 */
typedef unsigned long uint_fast8_t;
typedef unsigned long uint8_t;

/* Variables and functions */
void cherry8x16_remap_fn_keys(uint8_t *keys, uint8_t number_of_keys) {
  if (keys[0] & (1UL << (0xE0 - 0xE0))) {
    keys[0] &= ~(1UL << (0xE0 - 0xE0));
    keys[0] |= (1UL << (0xE4 - 0xE0));
  }
  for (uint_fast8_t i = 2; i < number_of_keys; i++) {
    switch (keys[i]) {
    case 0x10:
      keys[i] = 0x62;
      break;
    case 0x37:
      keys[i] = 0x63;
      break;
    case 0x38:
      keys[i] = 0x54;
      break;
    case 0x0D:
      keys[i] = 0x59;
      break;
    case 0x0E:
      keys[i] = 0x5A;
      break;
    case 0x0F:
      keys[i] = 0x5B;
      break;
    case 0x33:
      keys[i] = 0x57;
      break;
    case 0x28:
      keys[i] = 0x58;
      break;
    case 0x18:
      keys[i] = 0x5C;
      break;
    case 0x0C:
      keys[i] = 0x5D;
      break;
    case 0x12:
      keys[i] = 0x5E;
      break;
    case 0x13:
      keys[i] = 0x56;
      break;
    case 0x24:
      keys[i] = 0x5F;
      break;
    case 0x25:
      keys[i] = 0x60;
      break;
    case 0x26:
      keys[i] = 0x61;
      break;
    case 0x27:
      keys[i] = 0x55;
      break;
    case 0x3A:
      keys[i] = 0x44;
      break;
    case 0x3B:
      keys[i] = 0x45;
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<cherry8x16_remap_fn_keys>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     113d <cherry8x16_remap_fn_keys+0x3d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x10,%rcx
mov    %rcx,(%rax)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    131a <cherry8x16_remap_fn_keys+0x21a>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0xfffffffffffffff4,%rax
mov    %rax,-0x20(%rbp)
sub    $0x2f,%rax
ja     12ff <cherry8x16_remap_fn_keys+0x1ff>
mov    -0x20(%rbp),%rax
lea    0xe84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x62,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x63,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x54,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x59,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5a,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5b,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x57,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x58,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5c,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5d,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5e,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x56,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x5f,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x60,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x61,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x55,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x44,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x45,(%rax,%rcx,8)
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
jmp    1304 <cherry8x16_remap_fn_keys+0x204>
jmp    1309 <cherry8x16_remap_fn_keys+0x209>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1145 <cherry8x16_remap_fn_keys+0x45>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cherry8x16_remap_fn_keys>:
mov    (%rdi),%rax
test   $0x1,%al
je     1112 <cherry8x16_remap_fn_keys+0x12>
and    $0xffffffffffffffee,%rax
or     $0x10,%rax
mov    %rax,(%rdi)
cmp    $0x3,%rsi
jb     11e1 <cherry8x16_remap_fn_keys+0xe1>
mov    $0x2,%eax
lea    0xed8(%rip),%r8
nopl   0x0(%rax,%rax,1)
mov    (%rdi,%rax,8),%rcx
add    $0xfffffffffffffff4,%rcx
cmp    $0x2f,%rcx
ja     11d4 <cherry8x16_remap_fn_keys+0xd4>
mov    $0x62,%edx
movslq (%r8,%rcx,4),%rcx
add    %r8,%rcx
jmp    *%rcx
mov    $0x5d,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x59,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x5a,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x5b,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x5e,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x56,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x5c,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x5f,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x60,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x61,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x55,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x58,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x57,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x63,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x54,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x44,%edx
jmp    11d0 <cherry8x16_remap_fn_keys+0xd0>
mov    $0x45,%edx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rdx,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %rax,%rsi
jne    1130 <cherry8x16_remap_fn_keys+0x30>
ret

LLVM IR (-O0):
define void @cherry8x16_remap_fn_keys(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 0
%8 = load i64, i64* %7
%9 = and i64 %8, 1
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = load i64*, i64** %3
%13 = getelementptr inbounds i64, i64* %12, i64 0
%14 = load i64, i64* %13
%15 = and i64 %14, -2
store i64 %15, i64* %13
%16 = load i64*, i64** %3
%17 = getelementptr inbounds i64, i64* %16, i64 0
%18 = load i64, i64* %17
%19 = or i64 %18, 16
store i64 %19, i64* %17
br label %20
20: ; preds = %11, %2
store i64 2, i64* %5
br label %21
21: ; preds = %104, %20
%22 = load i64, i64* %5
%23 = load i64, i64* %4
%24 = icmp ult i64 %22, %23
br i1 %24, label %25, label %107
25: ; preds = %21
%26 = load i64*, i64** %3
%27 = load i64, i64* %5
%28 = getelementptr inbounds i64, i64* %26, i64 %27
%29 = load i64, i64* %28
switch i64 %29, label %102 [
i64 16, label %30
i64 55, label %34
i64 56, label %38
i64 13, label %42
i64 14, label %46
i64 15, label %50
i64 51, label %54
i64 40, label %58
i64 24, label %62
i64 12, label %66
i64 18, label %70
i64 19, label %74
i64 36, label %78
i64 37, label %82
i64 38, label %86
i64 39, label %90
i64 58, label %94
i64 59, label %98
]
30: ; preds = %25
%31 = load i64*, i64** %3
%32 = load i64, i64* %5
%33 = getelementptr inbounds i64, i64* %31, i64 %32
store i64 98, i64* %33
br label %103
34: ; preds = %25
%35 = load i64*, i64** %3
%36 = load i64, i64* %5
%37 = getelementptr inbounds i64, i64* %35, i64 %36
store i64 99, i64* %37
br label %103
38: ; preds = %25
%39 = load i64*, i64** %3
%40 = load i64, i64* %5
%41 = getelementptr inbounds i64, i64* %39, i64 %40
store i64 84, i64* %41
br label %103
42: ; preds = %25
%43 = load i64*, i64** %3
%44 = load i64, i64* %5
%45 = getelementptr inbounds i64, i64* %43, i64 %44
store i64 89, i64* %45
br label %103
46: ; preds = %25
%47 = load i64*, i64** %3
%48 = load i64, i64* %5
%49 = getelementptr inbounds i64, i64* %47, i64 %48
store i64 90, i64* %49
br label %103
50: ; preds = %25
%51 = load i64*, i64** %3
%52 = load i64, i64* %5
%53 = getelementptr inbounds i64, i64* %51, i64 %52
store i64 91, i64* %53
br label %103
54: ; preds = %25
%55 = load i64*, i64** %3
%56 = load i64, i64* %5
%57 = getelementptr inbounds i64, i64* %55, i64 %56
store i64 87, i64* %57
br label %103
58: ; preds = %25
%59 = load i64*, i64** %3
%60 = load i64, i64* %5
%61 = getelementptr inbounds i64, i64* %59, i64 %60
store i64 88, i64* %61
br label %103
62: ; preds = %25
%63 = load i64*, i64** %3
%64 = load i64, i64* %5
%65 = getelementptr inbounds i64, i64* %63, i64 %64
store i64 92, i64* %65
br label %103
66: ; preds = %25
%67 = load i64*, i64** %3
%68 = load i64, i64* %5
%69 = getelementptr inbounds i64, i64* %67, i64 %68
store i64 93, i64* %69
br label %103
70: ; preds = %25
%71 = load i64*, i64** %3
%72 = load i64, i64* %5
%73 = getelementptr inbounds i64, i64* %71, i64 %72
store i64 94, i64* %73
br label %103
74: ; preds = %25
%75 = load i64*, i64** %3
%76 = load i64, i64* %5
%77 = getelementptr inbounds i64, i64* %75, i64 %76
store i64 86, i64* %77
br label %103
78: ; preds = %25
%79 = load i64*, i64** %3
%80 = load i64, i64* %5
%81 = getelementptr inbounds i64, i64* %79, i64 %80
store i64 95, i64* %81
br label %103
82: ; preds = %25
%83 = load i64*, i64** %3
%84 = load i64, i64* %5
%85 = getelementptr inbounds i64, i64* %83, i64 %84
store i64 96, i64* %85
br label %103
86: ; preds = %25
%87 = load i64*, i64** %3
%88 = load i64, i64* %5
%89 = getelementptr inbounds i64, i64* %87, i64 %88
store i64 97, i64* %89
br label %103
90: ; preds = %25
%91 = load i64*, i64** %3
%92 = load i64, i64* %5
%93 = getelementptr inbounds i64, i64* %91, i64 %92
store i64 85, i64* %93
br label %103
94: ; preds = %25
%95 = load i64*, i64** %3
%96 = load i64, i64* %5
%97 = getelementptr inbounds i64, i64* %95, i64 %96
store i64 68, i64* %97
br label %103
98: ; preds = %25
%99 = load i64*, i64** %3
%100 = load i64, i64* %5
%101 = getelementptr inbounds i64, i64* %99, i64 %100
store i64 69, i64* %101
br label %103
102: ; preds = %25
br label %103
103: ; preds = %102, %98, %94, %90, %86, %82, %78, %74, %70, %66, %62, %58, %54, %50, %46, %42, %38, %34, %30
br label %104
104: ; preds = %103
%105 = load i64, i64* %5
%106 = add i64 %105, 1
store i64 %106, i64* %5
br label %21
107: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @cherry8x16_remap_fn_keys(i64* nocapture %0, i64 %1) {
%3 = load i64, i64* %0
%4 = and i64 %3, 1
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = and i64 %3, -18
%8 = or i64 %7, 16
store i64 %8, i64* %0
br label %9
9: ; preds = %6, %2
%10 = icmp ugt i64 %1, 2
br i1 %10, label %12, label %11
11: ; preds = %35, %9
ret void
12: ; preds = %9, %35
%13 = phi i64 [ %36, %35 ], [ 2, %9 ]
%14 = getelementptr inbounds i64, i64* %0, i64 %13
%15 = load i64, i64* %14
switch i64 %15, label %35 [
i64 16, label %33
i64 55, label %16
i64 56, label %17
i64 13, label %18
i64 14, label %19
i64 15, label %20
i64 51, label %21
i64 40, label %22
i64 24, label %23
i64 12, label %24
i64 18, label %25
i64 19, label %26
i64 36, label %27
i64 37, label %28
i64 38, label %29
i64 39, label %30
i64 58, label %31
i64 59, label %32
]
16: ; preds = %12
br label %33
17: ; preds = %12
br label %33
18: ; preds = %12
br label %33
19: ; preds = %12
br label %33
20: ; preds = %12
br label %33
21: ; preds = %12
br label %33
22: ; preds = %12
br label %33
23: ; preds = %12
br label %33
24: ; preds = %12
br label %33
25: ; preds = %12
br label %33
26: ; preds = %12
br label %33
27: ; preds = %12
br label %33
28: ; preds = %12
br label %33
29: ; preds = %12
br label %33
30: ; preds = %12
br label %33
31: ; preds = %12
br label %33
32: ; preds = %12
br label %33
33: ; preds = %12, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16
%34 = phi i64 [ 99, %16 ], [ 84, %17 ], [ 89, %18 ], [ 90, %19 ], [ 91, %20 ], [ 87, %21 ], [ 88, %22 ], [ 92, %23 ], [ 93, %24 ], [ 94, %25 ], [ 86, %26 ], [ 95, %27 ], [ 96, %28 ], [ 97, %29 ], [ 85, %30 ], [ 68, %31 ], [ 69, %32 ], [ 98, %12 ]
store i64 %34, i64* %14
br label %35
35: ; preds = %33, %12
%36 = add nuw i64 %13, 1
%37 = icmp eq i64 %36, %1
br i1 %37, label %11, label %12
}