#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 /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isalpha(char);
scalar_t__ toupper(char);
char vUnShift(char ct, char key) {
  unsigned char ctShift = (unsigned char)toupper(ct) - 'A';
  unsigned char keyShift = (unsigned char)toupper(key) - 'A';
  assert(isalpha(ct));
  assert(isalpha(key));
  return 'A' + (char)((((unsigned char)26) + ctShift - keyShift) %
                      ((unsigned char)26));
}


x86 assembly (clang, -O0):
<vUnShift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movzbl %al,%eax
sub    $0x41,%eax
mov    %al,-0x3(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <toupper@plt>
movzbl %al,%eax
sub    $0x41,%eax
mov    %al,-0x4(%rbp)
movsbl -0x1(%rbp),%edi
call   1050 <isalpha@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movsbl -0x2(%rbp),%edi
call   1050 <isalpha@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movzbl -0x3(%rbp),%eax
add    $0x1a,%eax
movzbl -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %dl,%al
movsbl %al,%eax
add    $0x41,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vUnShift>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
call   1030 <toupper@plt>
mov    %rax,%rbx
add    $0xbf,%ebx
mov    %r14d,%edi
call   1030 <toupper@plt>
mov    %rax,%rbp
add    $0xbf,%ebp
mov    %r15d,%edi
call   1050 <isalpha@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %r14d,%edi
call   1050 <isalpha@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movzbl %bl,%eax
movzbl %bpl,%ecx
sub    %ecx,%eax
add    $0x1a,%eax
movswl %ax,%ecx
imul   $0x4ec5,%ecx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x13,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @vUnShift(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%7 = load i8, i8* %3
%8 = call i64 @toupper(i8 signext %7)
%9 = trunc i64 %8 to i8
%10 = zext i8 %9 to i32
%11 = sub nsw i32 %10, 65
%12 = trunc i32 %11 to i8
store i8 %12, i8* %5
%13 = load i8, i8* %4
%14 = call i64 @toupper(i8 signext %13)
%15 = trunc i64 %14 to i8
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 65
%18 = trunc i32 %17 to i8
store i8 %18, i8* %6
%19 = load i8, i8* %3
%20 = call i32 @isalpha(i8 signext %19)
%21 = call i32 @assert(i32 %20)
%22 = load i8, i8* %4
%23 = call i32 @isalpha(i8 signext %22)
%24 = call i32 @assert(i32 %23)
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = add nsw i32 26, %26
%28 = load i8, i8* %6
%29 = zext i8 %28 to i32
%30 = sub nsw i32 %27, %29
%31 = srem i32 %30, 26
%32 = trunc i32 %31 to i8
%33 = sext i8 %32 to i32
%34 = add nsw i32 65, %33
%35 = trunc i32 %34 to i8
ret i8 %35
}

LLVM IR (-O2):
define signext i8 @vUnShift(i8 signext %0, i8 signext %1) {
%3 = tail call i64 @toupper(i8 signext %0)
%4 = trunc i64 %3 to i16
%5 = add i16 %4, 191
%6 = tail call i64 @toupper(i8 signext %1)
%7 = trunc i64 %6 to i16
%8 = add i16 %7, 191
%9 = tail call i32 @isalpha(i8 signext %0)
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @isalpha(i8 signext %1)
%12 = tail call i32 @assert(i32 %11)
%13 = and i16 %5, 255
%14 = add nuw nsw i16 %13, 26
%15 = and i16 %8, 255
%16 = sub nsw i16 %14, %15
%17 = srem i16 %16, 26
%18 = trunc i16 %17 to i8
%19 = add nsw i8 %18, 65
ret i8 %19
}