#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_alpha_mirror(char *ch) {
  while (*ch) {
    if (*ch >= 'a' && *ch <= 'z') {
      ft_putchar('m' - (*ch - 'n'));
    } else if (*ch >= 'A' && *ch <= 'Z') {
      ft_putchar('M' - (*ch - 'N'));
    } else
      ft_putchar(*ch);
    ch++;
  }
}


x86 assembly (clang, -O0):
<ft_alpha_mirror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c7 <ft_alpha_mirror+0xb7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1167 <ft_alpha_mirror+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1167 <ft_alpha_mirror+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x6e,%ecx
mov    $0x6d,%eax
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <ft_putchar@plt>
jmp    11b6 <ft_alpha_mirror+0xa6>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     11a5 <ft_alpha_mirror+0x95>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     11a5 <ft_alpha_mirror+0x95>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x4e,%ecx
mov    $0x4d,%eax
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <ft_putchar@plt>
jmp    11b1 <ft_alpha_mirror+0xa1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    11b6 <ft_alpha_mirror+0xa6>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <ft_alpha_mirror+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_alpha_mirror>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1154 <ft_alpha_mirror+0x44>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    1146 <ft_alpha_mirror+0x36>
lea    -0x41(%rax),%ecx
mov    $0x9b,%dl
sub    %al,%dl
cmp    $0x1a,%cl
movzbl %dl,%edx
movzbl %al,%ecx
cmovb  %edx,%ecx
movsbl %cl,%edi
call   1030 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1154 <ft_alpha_mirror+0x44>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1120 <ft_alpha_mirror+0x10>
mov    $0xdb,%cl
sub    %al,%cl
jmp    1133 <ft_alpha_mirror+0x23>
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_alpha_mirror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %48, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %51
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 %25
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 %25
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 110
%22 = sub nsw i32 109, %21
%23 = trunc i32 %22 to i8
%24 = call i32 @ft_putchar(i8 signext %23)
br label %48
25: ; preds = %12, %7
%26 = load i8*, i8** %2
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sge i32 %28, 65
br i1 %29, label %30, label %43
30: ; preds = %25
%31 = load i8*, i8** %2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sle i32 %33, 90
br i1 %34, label %35, label %43
35: ; preds = %30
%36 = load i8*, i8** %2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = sub nsw i32 %38, 78
%40 = sub nsw i32 77, %39
%41 = trunc i32 %40 to i8
%42 = call i32 @ft_putchar(i8 signext %41)
br label %47
43: ; preds = %30, %25
%44 = load i8*, i8** %2
%45 = load i8, i8* %44
%46 = call i32 @ft_putchar(i8 signext %45)
br label %47
47: ; preds = %43, %35
br label %48
48: ; preds = %47, %17
%49 = load i8*, i8** %2
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %2
br label %3
51: ; preds = %3
ret void
}

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