#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*/ printf(char *, char *);
void caesar_cipher_decode(char *in, char *out) {
  printf("Source string: %s\n", in);
  while (*in != '\0') {
    if (*in >= 'a' && *in <= 'z') {
      *out = 'z' - ('z' - (*in) + 2) % ('z' - 'a' + 1);
    } else if (*in >= 'A' && *in <= 'Z') {
      *out = 'z' - ('Z' - (*in) + 2) % ('z' - 'a' + 1);
    } else {
      *out = *in;
    }
    out++;
    in++;
  }
  *out++ = '\0';
}


x86 assembly (clang, -O0):
<caesar_cipher_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1208 <caesar_cipher_decode+0xf8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     118d <caesar_cipher_decode+0x7d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     118d <caesar_cipher_decode+0x7d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
add    $0x2,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    $0x7a,%eax
sub    %edx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    11eb <caesar_cipher_decode+0xdb>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     11da <caesar_cipher_decode+0xca>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     11da <caesar_cipher_decode+0xca>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x5a,%eax
sub    %ecx,%eax
add    $0x2,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    $0x7a,%eax
sub    %edx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    11e6 <caesar_cipher_decode+0xd6>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    11eb <caesar_cipher_decode+0xdb>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <caesar_cipher_decode+0x20>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caesar_cipher_decode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     117f <caesar_cipher_decode+0x6f>
add    $0x1,%rbx
jmp    116b <caesar_cipher_decode+0x5b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x7c,%cl
sub    %al,%cl
movzbl %cl,%ecx
imul   $0x4f,%ecx,%edx
shr    $0xb,%edx
lea    (%rdx,%rdx,4),%eax
lea    (%rax,%rax,4),%eax
add    %edx,%eax
sub    %cl,%al
add    $0x7a,%al
mov    %al,(%r14)
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     117f <caesar_cipher_decode+0x6f>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
jbe    1140 <caesar_cipher_decode+0x30>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1159 <caesar_cipher_decode+0x49>
mov    $0x5c,%cl
jmp    1142 <caesar_cipher_decode+0x32>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Source string: %s\0A\00"
define void @caesar_cipher_decode(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %57, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %62
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 97
br i1 %16, label %17, label %32
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 122
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = sub nsw i32 122, %25
%27 = add nsw i32 %26, 2
%28 = srem i32 %27, 26
%29 = sub nsw i32 122, %28
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %4
store i8 %30, i8* %31
br label %57
32: ; preds = %17, %12
%33 = load i8*, i8** %3
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sge i32 %35, 65
br i1 %36, label %37, label %52
37: ; preds = %32
%38 = load i8*, i8** %3
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 90
br i1 %41, label %42, label %52
42: ; preds = %37
%43 = load i8*, i8** %3
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = sub nsw i32 90, %45
%47 = add nsw i32 %46, 2
%48 = srem i32 %47, 26
%49 = sub nsw i32 122, %48
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %4
store i8 %50, i8* %51
br label %56
52: ; preds = %37, %32
%53 = load i8*, i8** %3
%54 = load i8, i8* %53
%55 = load i8*, i8** %4
store i8 %54, i8* %55
br label %56
56: ; preds = %52, %42
br label %57
57: ; preds = %56, %22
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %4
%60 = load i8*, i8** %3
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %3
br label %7
62: ; preds = %7
%63 = load i8*, i8** %4
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %4
store i8 0, i8* %63
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Source string: %s\0A\00"
define void @caesar_cipher_decode(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %29, label %6
6: ; preds = %2, %23
%7 = phi i8 [ %27, %23 ], [ %4, %2 ]
%8 = phi i8* [ %25, %23 ], [ %1, %2 ]
%9 = phi i8* [ %26, %23 ], [ %0, %2 ]
%10 = add i8 %7, -97
%11 = icmp ult i8 %10, 26
br i1 %11, label %12, label %16
12: ; preds = %6
%13 = sub i8 124, %7
%14 = urem i8 %13, 26
%15 = sub nuw nsw i8 122, %14
br label %23
16: ; preds = %6
%17 = add i8 %7, -65
%18 = icmp ult i8 %17, 26
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = sub i8 92, %7
%21 = urem i8 %20, 26
%22 = sub nuw nsw i8 122, %21
br label %23
23: ; preds = %16, %19, %12
%24 = phi i8 [ %22, %19 ], [ %15, %12 ], [ %7, %16 ]
store i8 %24, i8* %8
%25 = getelementptr inbounds i8, i8* %8, i64 1
%26 = getelementptr inbounds i8, i8* %9, i64 1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %6
29: ; preds = %23, %2
%30 = phi i8* [ %1, %2 ], [ %25, %23 ]
store i8 0, i8* %30
ret void
}