#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 */
scalar_t__ isdigit(unsigned char);
scalar_t__ islower(unsigned char);
scalar_t__ isupper(unsigned char);
unsigned char apply_permutations(unsigned char alpha[26],
                                 unsigned char numer[10], unsigned char c) {
  if (isupper(c)) {
    c -= 'A';
    c = alpha[c];
    c += 'A';
  } else if (islower(c)) {
    c -= 'a';
    c = alpha[c];
    c += 'a';
  } else if (isdigit(c)) {
    c -= '0';
    c = numer[c];
    c += '0';
  }
  return c;
}


x86 assembly (clang, -O0):
<apply_permutations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%edi
call   1050 <isupper@plt>
cmp    $0x0,%rax
je     117f <apply_permutations+0x4f>
movzbl -0x11(%rbp),%eax
sub    $0x41,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movzbl -0x11(%rbp),%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
add    $0x41,%eax
mov    %al,-0x11(%rbp)
jmp    11f8 <apply_permutations+0xc8>
movzbl -0x11(%rbp),%edi
call   1040 <islower@plt>
cmp    $0x0,%rax
je     11b9 <apply_permutations+0x89>
movzbl -0x11(%rbp),%eax
sub    $0x61,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movzbl -0x11(%rbp),%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
add    $0x61,%eax
mov    %al,-0x11(%rbp)
jmp    11f3 <apply_permutations+0xc3>
movzbl -0x11(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11ee <apply_permutations+0xbe>
movzbl -0x11(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movzbl -0x11(%rbp),%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x11(%rbp)
jmp    11f3 <apply_permutations+0xc3>
jmp    11f8 <apply_permutations+0xc8>
movzbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply_permutations>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %edx,%edi
call   1050 <isupper@plt>
test   %rax,%rax
je     1151 <apply_permutations+0x21>
mov    $0x41,%al
mov    $0xbf,%cl
jmp    1179 <apply_permutations+0x49>
movzbl %bl,%ebp
mov    %ebp,%edi
call   1040 <islower@plt>
test   %rax,%rax
je     1166 <apply_permutations+0x36>
mov    $0x61,%al
mov    $0x9f,%cl
jmp    1179 <apply_permutations+0x49>
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1184 <apply_permutations+0x54>
mov    $0x30,%al
mov    $0xd0,%cl
mov    %r15,%r14
add    %bl,%cl
movzbl %cl,%ecx
add    (%r14,%rcx,1),%al
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @apply_permutations(i8* %0, i8* %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = call i64 @isupper(i8 zeroext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %3
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %12, 65
%14 = trunc i32 %13 to i8
store i8 %14, i8* %6
%15 = load i8*, i8** %4
%16 = load i8, i8* %6
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %6
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = add nsw i32 %21, 65
%23 = trunc i32 %22 to i8
store i8 %23, i8* %6
br label %62
24: ; preds = %3
%25 = load i8, i8* %6
%26 = call i64 @islower(i8 zeroext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load i8, i8* %6
%30 = zext i8 %29 to i32
%31 = sub nsw i32 %30, 97
%32 = trunc i32 %31 to i8
store i8 %32, i8* %6
%33 = load i8*, i8** %4
%34 = load i8, i8* %6
%35 = zext i8 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
store i8 %37, i8* %6
%38 = load i8, i8* %6
%39 = zext i8 %38 to i32
%40 = add nsw i32 %39, 97
%41 = trunc i32 %40 to i8
store i8 %41, i8* %6
br label %61
42: ; preds = %24
%43 = load i8, i8* %6
%44 = call i64 @isdigit(i8 zeroext %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %60
46: ; preds = %42
%47 = load i8, i8* %6
%48 = zext i8 %47 to i32
%49 = sub nsw i32 %48, 48
%50 = trunc i32 %49 to i8
store i8 %50, i8* %6
%51 = load i8*, i8** %5
%52 = load i8, i8* %6
%53 = zext i8 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
store i8 %55, i8* %6
%56 = load i8, i8* %6
%57 = zext i8 %56 to i32
%58 = add nsw i32 %57, 48
%59 = trunc i32 %58 to i8
store i8 %59, i8* %6
br label %60
60: ; preds = %46, %42
br label %61
61: ; preds = %60, %28
br label %62
62: ; preds = %61, %10
%63 = load i8, i8* %6
ret i8 %63
}

LLVM IR (-O2):
define zeroext i8 @apply_permutations(i8* nocapture %0, i8* nocapture %1, i8 zeroext %2) {
%4 = tail call i64 @isupper(i8 zeroext %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i64 @islower(i8 zeroext %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i64 @isdigit(i8 zeroext %2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %9, %6, %3
%13 = phi i8 [ -65, %3 ], [ -97, %6 ], [ -48, %9 ]
%14 = phi i8* [ %0, %3 ], [ %0, %6 ], [ %1, %9 ]
%15 = phi i8 [ 65, %3 ], [ 97, %6 ], [ 48, %9 ]
%16 = add i8 %13, %2
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = load i8, i8* %18
%20 = add i8 %19, %15
br label %21
21: ; preds = %12, %9
%22 = phi i8 [ %2, %9 ], [ %20, %12 ]
ret i8 %22
}