#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 */
char *strchr(char *, char);
char rot13c(char c) {
  char u[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  char l[] = "abcdefghijklmnopqrstuvwxyz";
  char *p;
  if ((p = strchr(u, c)) != NULL)
    return u[((p - u) + 13) % 26];
  else if ((p = strchr(l, c)) != NULL)
    return l[((p - l) + 13) % 26];
  else
    return c;
}


x86 assembly (clang, -O0):
<rot13c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed2(%rip),%ax
mov    %ax,-0x8(%rbp)
mov    0xeca(%rip),%al
mov    %al,-0x6(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xebd(%rip),%ax
mov    %ax,-0x28(%rbp)
mov    0xeb5(%rip),%al
mov    %al,-0x26(%rbp)
lea    -0x20(%rbp),%rdi
movsbl -0x2(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     11c8 <rot13c+0xb8>
mov    -0x48(%rbp),%rax
lea    -0x20(%rbp),%rcx
sub    %rcx,%rax
add    $0xd,%rax
mov    $0x1a,%ecx
cqto
idiv   %rcx
mov    -0x20(%rbp,%rdx,1),%al
mov    %al,-0x1(%rbp)
jmp    120e <rot13c+0xfe>
lea    -0x40(%rbp),%rdi
movsbl -0x2(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     1208 <rot13c+0xf8>
mov    -0x48(%rbp),%rax
lea    -0x40(%rbp),%rcx
sub    %rcx,%rax
add    $0xd,%rax
mov    $0x1a,%ecx
cqto
idiv   %rcx
mov    -0x40(%rbp,%rdx,1),%al
mov    %al,-0x1(%rbp)
jmp    120e <rot13c+0xfe>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot13c>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
mov    %edi,%ebp
movups 0xeec(%rip),%xmm0
movups %xmm0,0x2b(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xef4(%rip),%xmm0
movups %xmm0,0xb(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
test   %rax,%rax
jne    1175 <rot13c+0x65>
movsbl %bpl,%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strchr@plt>
mov    %rax,%rcx
test   %rax,%rax
je     11ac <rot13c+0x9c>
sub    %rbx,%rcx
add    $0xd,%rcx
movabs $0x4ec4ec4ec4ec4ec5,%rdx
ec c4 4e
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x3,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,4),%rax
lea    (%rax,%rax,4),%rax
add    %rdx,%rax
sub    %rax,%rcx
mov    (%rbx,%rcx,1),%bpl
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.rot13c.u = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@__const.rot13c.l = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
define signext i8 @rot13c(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca [27 x i8]
%5 = alloca [27 x i8]
%6 = alloca i8*
store i8 %0, i8* %3
%7 = bitcast [27 x i8]* %4 to i8*
%8 = bitcast [27 x i8]* %5 to i8*
%9 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 0
%10 = load i8, i8* %3
%11 = call i8* @strchr(i8* %9, i8 signext %10)
store i8* %11, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %23
13: ; preds = %1
%14 = load i8*, i8** %6
%15 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 0
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = add nsw i64 %18, 13
%20 = srem i64 %19, 26
%21 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 %20
%22 = load i8, i8* %21
store i8 %22, i8* %2
br label %40
23: ; preds = %1
%24 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%25 = load i8, i8* %3
%26 = call i8* @strchr(i8* %24, i8 signext %25)
store i8* %26, i8** %6
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %38
28: ; preds = %23
%29 = load i8*, i8** %6
%30 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%31 = ptrtoint i8* %29 to i64
%32 = ptrtoint i8* %30 to i64
%33 = sub i64 %31, %32
%34 = add nsw i64 %33, 13
%35 = srem i64 %34, 26
%36 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 %35
%37 = load i8, i8* %36
store i8 %37, i8* %2
br label %40
38: ; preds = %23
%39 = load i8, i8* %3
store i8 %39, i8* %2
br label %40
40: ; preds = %38, %28, %13
%41 = load i8, i8* %2
ret i8 %41
}

LLVM IR (-O2):
@__const.rot13c.u = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@__const.rot13c.l = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
define signext i8 @rot13c(i8 signext %0) {
%2 = alloca [27 x i8]
%3 = alloca [27 x i8]
%4 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%6 = call i8* @strchr(i8* %4, i8 signext %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i8* @strchr(i8* %5, i8 signext %0)
%10 = icmp eq i8* %9, null
br i1 %10, label %21, label %11
11: ; preds = %8, %1
%12 = phi i8* [ %6, %1 ], [ %9, %8 ]
%13 = phi [27 x i8]* [ %2, %1 ], [ %3, %8 ]
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint [27 x i8]* %13 to i64
%16 = sub i64 13, %15
%17 = add i64 %16, %14
%18 = srem i64 %17, 26
%19 = getelementptr inbounds [27 x i8], [27 x i8]* %13, i64 0, i64 %18
%20 = load i8, i8* %19
br label %21
21: ; preds = %11, %8
%22 = phi i8 [ %0, %8 ], [ %20, %11 ]
ret i8 %22
}