#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*/ isalpha(char const);
scalar_t__ islower(char const);
scalar_t__ mod(int, int);
char caesarShift(const char toShift, const int shiftVal) {
  if (!isalpha(toShift))
    return toShift;
  int charIndex, aValue;
  if (islower(toShift))
    aValue = 97;
  else
    aValue = 65;
  charIndex = toShift - aValue;
  return (char)(mod(charIndex + shiftVal, 26) + aValue);
}


x86 assembly (clang, -O0):
<caesarShift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x2(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%eax
jne    115e <caesarShift+0x2e>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    11a8 <caesarShift+0x78>
movsbl -0x2(%rbp),%edi
call   1040 <islower@plt>
cmp    $0x0,%rax
je     117d <caesarShift+0x4d>
movl   $0x61,-0x10(%rbp)
jmp    1184 <caesarShift+0x54>
movl   $0x41,-0x10(%rbp)
movsbl -0x2(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    -0x8(%rbp),%edi
mov    $0x1a,%esi
call   1030 <mod@plt>
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caesarShift>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
call   1050 <isalpha@plt>
test   %eax,%eax
je     1178 <caesarShift+0x48>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1040 <islower@plt>
xor    %ebx,%ebx
xor    %ecx,%ecx
test   %rax,%rax
setne  %bl
sete   %cl
shl    $0x5,%ecx
add    %ebp,%r14d
lea    (%rcx,%r14,1),%edi
add    $0xffffff9f,%edi
mov    $0x1a,%esi
call   1030 <mod@plt>
shl    $0x5,%ebx
add    %eax,%ebx
add    $0x41,%bl
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @caesarShift(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
%8 = load i8, i8* %4
%9 = call i32 @isalpha(i8 signext %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = load i8, i8* %4
store i8 %12, i8* %3
br label %32
13: ; preds = %2
%14 = load i8, i8* %4
%15 = call i64 @islower(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 97, i32* %7
br label %19
18: ; preds = %13
store i32 65, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = load i32, i32* %7
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = load i32, i32* %5
%26 = add nsw i32 %24, %25
%27 = call i64 @mod(i32 %26, i32 26)
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = add nsw i64 %27, %29
%31 = trunc i64 %30 to i8
store i8 %31, i8* %3
br label %32
32: ; preds = %19, %11
%33 = load i8, i8* %3
ret i8 %33
}

LLVM IR (-O2):
define signext i8 @caesarShift(i8 signext %0, i32 %1) {
%3 = tail call i32 @isalpha(i8 signext %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = tail call i64 @islower(i8 signext %0)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 -65, i32 -97
%9 = sext i8 %0 to i32
%10 = add i32 %9, %1
%11 = add i32 %10, %8
%12 = tail call i64 @mod(i32 %11, i32 26)
%13 = select i1 %7, i64 65, i64 97
%14 = add nsw i64 %13, %12
%15 = trunc i64 %14 to i8
br label %16
16: ; preds = %2, %5
%17 = phi i8 [ %15, %5 ], [ %0, %2 ]
ret i8 %17
}