#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 *);
int main(void) {
  char str[] = "PPAP: Pen Pineapple Apple Pen.";
  printf("String\t=> %s\n", str);
  for (char *p = str; *p;
       *p ^= 0x20 & -(!((*p - 'A') >> 31) & !(('Z' - *p) >> 31)), p++)
    ;
  printf("Lower\t=> %s\n", str);
  for (char *p = str; *p;
       *p ^= 0x20 & -(!((*p - 'a') >> 31) & !(('z' - *p) >> 31)), p++)
    ;
  printf("Upper\t=> %s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x14(%rbp)
mov    0xec4(%rip),%al
mov    %al,-0x12(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e6 <main+0xd6>
jmp    1187 <main+0x77>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
sar    $0x1f,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x38(%rbp),%rcx
movsbl (%rcx),%edx
mov    $0x5a,%ecx
sub    %edx,%ecx
sar    $0x1f,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
xor    %edx,%edx
sub    %eax,%edx
and    $0x20,%edx
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1175 <main+0x65>
lea    -0x30(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmpb   $0x0,(%rax)
je     126f <main+0x15f>
jmp    1210 <main+0x100>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
sar    $0x1f,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x40(%rbp),%rcx
movsbl (%rcx),%edx
mov    $0x7a,%ecx
sub    %edx,%ecx
sar    $0x1f,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
xor    %edx,%edx
sub    %eax,%edx
and    $0x20,%edx
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11fe <main+0xee>
lea    -0x30(%rbp),%rsi
lea    0xdc0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xef4(%rip),%xmm0
movups %xmm0,0xf(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeed(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     116c <main+0x5c>
lea    0x1(%rsp),%rcx
cs nopw 0x0(%rax,%rax,1)
lea    -0x41(%rax),%edx
cmp    $0x1a,%dl
setb   %dl
shl    $0x5,%dl
xor    %al,%dl
mov    %dl,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1150 <main+0x40>
lea    0xeba(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     11ac <main+0x9c>
lea    0x1(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
lea    -0x61(%rax),%edx
cmp    $0x1a,%dl
setb   %dl
shl    $0x5,%dl
xor    %al,%dl
mov    %dl,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1190 <main+0x80>
lea    0xe87(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.str = [31 x i8] c"PPAP: Pen Pineapple Apple Pen.\00"
@.str = [14 x i8] c"String\09=> %s\0A\00"
@.str.1 = [13 x i8] c"Lower\09=> %s\0A\00"
@.str.2 = [13 x i8] c"Upper\09=> %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [31 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [31 x i8]* %2 to i8*
%6 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
store i8* %8, i8** %3
br label %9
9: ; preds = %14, %0
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %41
13: ; preds = %9
br label %14
14: ; preds = %13
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 65
%19 = ashr i32 %18, 31
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = sub nsw i32 90, %25
%27 = ashr i32 %26, 31
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
%31 = and i32 %22, %30
%32 = sub nsw i32 0, %31
%33 = and i32 32, %32
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = xor i32 %36, %33
%38 = trunc i32 %37 to i8
store i8 %38, i8* %34
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %3
br label %9
41: ; preds = %9
%42 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%43 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
store i8* %44, i8** %4
br label %45
45: ; preds = %50, %41
%46 = load i8*, i8** %4
%47 = load i8, i8* %46
%48 = icmp ne i8 %47, 0
br i1 %48, label %49, label %77
49: ; preds = %45
br label %50
50: ; preds = %49
%51 = load i8*, i8** %4
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = sub nsw i32 %53, 97
%55 = ashr i32 %54, 31
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
%58 = zext i1 %57 to i32
%59 = load i8*, i8** %4
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = sub nsw i32 122, %61
%63 = ashr i32 %62, 31
%64 = icmp ne i32 %63, 0
%65 = xor i1 %64, true
%66 = zext i1 %65 to i32
%67 = and i32 %58, %66
%68 = sub nsw i32 0, %67
%69 = and i32 32, %68
%70 = load i8*, i8** %4
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = xor i32 %72, %69
%74 = trunc i32 %73 to i8
store i8 %74, i8* %70
%75 = load i8*, i8** %4
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %4
br label %45
77: ; preds = %45
%78 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%79 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %78)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [31 x i8] c"PPAP: Pen Pineapple Apple Pen.\00"
@.str = [14 x i8] c"String\09=> %s\0A\00"
@.str.1 = [13 x i8] c"Lower\09=> %s\0A\00"
@.str.2 = [13 x i8] c"Upper\09=> %s\0A\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %10, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %20, label %22
10: ; preds = %0, %10
%11 = phi i8 [ %18, %10 ], [ %4, %0 ]
%12 = phi i8* [ %17, %10 ], [ %2, %0 ]
%13 = add i8 %11, -65
%14 = icmp ult i8 %13, 26
%15 = select i1 %14, i8 32, i8 0
%16 = xor i8 %15, %11
store i8 %16, i8* %12
%17 = getelementptr inbounds i8, i8* %12, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %6, label %10
20: ; preds = %22, %6
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
22: ; preds = %6, %22
%23 = phi i8 [ %30, %22 ], [ %8, %6 ]
%24 = phi i8* [ %29, %22 ], [ %2, %6 ]
%25 = add i8 %23, -97
%26 = icmp ult i8 %25, 26
%27 = select i1 %26, i8 32, i8 0
%28 = xor i8 %27, %23
store i8 %28, i8* %24
%29 = getelementptr inbounds i8, i8* %24, i64 1
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %20, label %22
}