#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*/ ft_putchar(char);
void ft_rot_13(char *str) {
  while (*str) {
    if (*str >= 'a' && *str <= 'z')
      ft_putchar('a' + (*str - 'a' + 13) % 26);
    else if (*str >= 'A' && *str <= 'Z')
      ft_putchar('A' + (*str - 'A' + 13) % 26);
    else
      ft_putchar(*str);
    str++;
  }
}


x86 assembly (clang, -O0):
<ft_rot_13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d9 <ft_rot_13+0xc9>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1170 <ft_rot_13+0x60>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1170 <ft_rot_13+0x60>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
add    $0xd,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <ft_putchar@plt>
jmp    11c8 <ft_rot_13+0xb8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     11b7 <ft_rot_13+0xa7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     11b7 <ft_rot_13+0xa7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0xd,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <ft_putchar@plt>
jmp    11c3 <ft_rot_13+0xb3>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    11c8 <ft_rot_13+0xb8>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <ft_rot_13+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_rot_13>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1173 <ft_rot_13+0x63>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    114a <ft_rot_13+0x3a>
add    $0xac,%al
movzbl %al,%eax
imul   $0x4f,%eax,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %dl,%al
add    $0x61,%al
movsbl %al,%edi
call   1030 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1173 <ft_rot_13+0x63>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
jbe    1120 <ft_rot_13+0x10>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1137 <ft_rot_13+0x27>
add    $0xcc,%al
movzbl %al,%eax
imul   $0x4f,%eax,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %dl,%al
add    $0x41,%al
jmp    1137 <ft_rot_13+0x27>
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_rot_13(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %52, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %55
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 97
br i1 %11, label %12, label %27
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 122
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 97
%22 = add nsw i32 %21, 13
%23 = srem i32 %22, 26
%24 = add nsw i32 97, %23
%25 = trunc i32 %24 to i8
%26 = call i32 @ft_putchar(i8 signext %25)
br label %52
27: ; preds = %12, %7
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 65
br i1 %31, label %32, label %47
32: ; preds = %27
%33 = load i8*, i8** %2
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 90
br i1 %36, label %37, label %47
37: ; preds = %32
%38 = load i8*, i8** %2
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 65
%42 = add nsw i32 %41, 13
%43 = srem i32 %42, 26
%44 = add nsw i32 65, %43
%45 = trunc i32 %44 to i8
%46 = call i32 @ft_putchar(i8 signext %45)
br label %51
47: ; preds = %32, %27
%48 = load i8*, i8** %2
%49 = load i8, i8* %48
%50 = call i32 @ft_putchar(i8 signext %49)
br label %51
51: ; preds = %47, %37
br label %52
52: ; preds = %51, %17
%53 = load i8*, i8** %2
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %2
br label %3
55: ; preds = %3
ret void
}

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