#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__ isalpha(char);
scalar_t__ isupper(char);
void cipher(char *word, int x) {
  if (*word == 0)
    return;
  if (isalpha(*word)) {
    char first = 'a';
    if (isupper(*word))
      first = 'A';
    *word = first + (*word + x - first) % 26;
  }
  cipher(++word, x);
}


x86 assembly (clang, -O0):
<cipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1154 <cipher+0x24>
jmp    11c8 <cipher+0x98>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     11b4 <cipher+0x84>
movb   $0x61,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
je     1188 <cipher+0x58>
movb   $0x41,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
movsbl -0xd(%rbp),%ecx
sub    %ecx,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%esi
call   1050 <cipher@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cipher>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1196 <cipher+0x76>
mov    %esi,%ebp
mov    %rdi,%rbx
jmp    113c <cipher+0x1c>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1196 <cipher+0x76>
movsbl %al,%edi
call   1030 <isalpha@plt>
test   %rax,%rax
je     1130 <cipher+0x10>
movsbl (%rbx),%edi
call   1040 <isupper@plt>
xor    %ecx,%ecx
xor    %edx,%edx
test   %rax,%rax
sete   %cl
setne  %dl
shl    $0x5,%edx
shl    $0x5,%ecx
movsbl (%rbx),%eax
add    %ebp,%eax
add    %edx,%eax
add    $0xffffff9f,%eax
cltq
imul   $0x4ec4ec4f,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,4),%esi
lea    (%rsi,%rsi,4),%esi
add    %edx,%esi
sub    %esi,%eax
add    %ecx,%eax
add    $0x41,%al
mov    %al,(%rbx)
jmp    1130 <cipher+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @cipher(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %27, label %5
5: ; preds = %2, %23
%6 = phi i8 [ %25, %23 ], [ %3, %2 ]
%7 = phi i8* [ %24, %23 ], [ %0, %2 ]
%8 = tail call i64 @isalpha(i8 signext %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %5
%11 = load i8, i8* %7
%12 = tail call i64 @isupper(i8 signext %11)
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i32 -97, i32 -65
%15 = select i1 %13, i32 97, i32 65
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = add nsw i32 %17, %1
%19 = add i32 %18, %14
%20 = srem i32 %19, 26
%21 = add nsw i32 %20, %15
%22 = trunc i32 %21 to i8
store i8 %22, i8* %7
br label %23
23: ; preds = %10, %5
%24 = getelementptr inbounds i8, i8* %7, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %5
27: ; preds = %23, %2
ret void
}