#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 vShift(char pt, char key) {
  unsigned char ptShift = (unsigned char)toupper(pt) - 'A';
  unsigned char keyShift = (unsigned char)toupper(key) - 'A';
  assert(isalpha(pt));
  assert(isalpha(key));
  return 'A' + (char)((ptShift + keyShift) % ((unsigned char)26));
}


x86 assembly (clang, -O0):
<vShift>:
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
movzbl -0x4(%rbp),%ecx
add    %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):
<vShift>:
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,%ecx
movzbl %bpl,%eax
add    %ecx,%eax
imul   $0x4ec5,%eax,%ecx
shr    $0x13,%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 @vShift(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 = load i8, i8* %6
%28 = zext i8 %27 to i32
%29 = add nsw i32 %26, %28
%30 = srem i32 %29, 26
%31 = trunc i32 %30 to i8
%32 = sext i8 %31 to i32
%33 = add nsw i32 65, %32
%34 = trunc i32 %33 to i8
ret i8 %34
}

LLVM IR (-O2):
define signext i8 @vShift(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 = and i16 %8, 255
%15 = add nuw nsw i16 %14, %13
%16 = urem i16 %15, 26
%17 = trunc i16 %16 to i8
%18 = add nuw nsw i8 %17, 65
ret i8 %18
}