#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 */
typedef int /*<<< orphan*/ out_msg;

/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  char rot_table_ucase[] = "NOPQRSTUVWXYZABCDEFGHIJKLM";
  char rot_table_lcase[] = "nopqrstuvwxyzabcdefghijklm";
  char out_char = '?';
  char out_msg[] = "x\n";
  unsigned char in_char = '!';
  if (argc > 1 && argv[1][0])
    in_char = argv[1][0];
  if (in_char >= ' ' && in_char < 'A') {
    out_char = in_char;
  } else if (in_char >= 'A' && in_char < 'a') {
    out_char = rot_table_ucase[in_char - 'A'];
  } else {
    out_char = rot_table_lcase[in_char - 'a'];
  }
  out_msg[0] = out_char;
  write(1, out_msg, sizeof(out_msg) - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeca(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0xec2(%rip),%al
mov    %al,-0x16(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x38(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x36(%rbp)
movb   $0x3f,-0x51(%rbp)
mov    0xea0(%rip),%ax
mov    %ax,-0x54(%rbp)
mov    0xe98(%rip),%al
mov    %al,-0x52(%rbp)
movb   $0x21,-0x55(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d7 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d7 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x55(%rbp)
movzbl -0x55(%rbp),%eax
cmp    $0x20,%eax
jl     11fc <main+0xec>
movzbl -0x55(%rbp),%eax
cmp    $0x41,%eax
jge    11fc <main+0xec>
mov    -0x55(%rbp),%al
mov    %al,-0x51(%rbp)
jmp    1240 <main+0x130>
movzbl -0x55(%rbp),%eax
cmp    $0x41,%eax
jl     122b <main+0x11b>
movzbl -0x55(%rbp),%eax
cmp    $0x61,%eax
jge    122b <main+0x11b>
movzbl -0x55(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x30(%rbp,%rax,1),%al
mov    %al,-0x51(%rbp)
jmp    123b <main+0x12b>
movzbl -0x55(%rbp),%eax
sub    $0x61,%eax
cltq
mov    -0x50(%rbp,%rax,1),%al
mov    %al,-0x51(%rbp)
jmp    1240 <main+0x130>
mov    -0x51(%rbp),%al
mov    %al,-0x54(%rbp)
lea    -0x54(%rbp),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x6(%rsp)
movw   $0xa78,0x4(%rsp)
mov    $0x21,%al
cmp    $0x2,%edi
jl     1165 <main+0x55>
mov    0x8(%rsi),%rax
movzbl (%rax),%ecx
test   %cl,%cl
mov    $0x21,%eax
cmovne %ecx,%eax
lea    -0x20(%rax),%ecx
cmp    $0x21,%cl
jb     1165 <main+0x55>
movzbl %al,%ecx
add    $0xbf,%al
lea    -0x41(%rcx),%edx
lea    0xeb4(%rip),%rsi
add    %rdx,%rsi
cmp    $0x20,%al
mov    %ecx,%eax
lea    0xec6(%rip),%rcx
lea    -0x61(%rax,%rcx,1),%rax
cmovb  %rsi,%rax
mov    (%rax),%al
mov    %al,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.rot_table_ucase = [27 x i8] c"NOPQRSTUVWXYZABCDEFGHIJKLM\00"
@__const.main.rot_table_lcase = [27 x i8] c"nopqrstuvwxyzabcdefghijklm\00"
@__const.main.out_msg = [3 x i8] c"x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = select i1 %10, i8 33, i8 %9
%12 = zext i8 %11 to i32
%13 = add i8 %11, -32
%14 = icmp ult i8 %13, 33
br i1 %14, label %26, label %15
15: ; preds = %6
%16 = add i8 %11, -65
%17 = icmp ult i8 %16, 32
%18 = add nsw i32 %12, -65
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.rot_table_ucase, i64 0, i64 %19
%21 = add nsw i32 %12, -97
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.rot_table_lcase, i64 0, i64 %22
%24 = select i1 %17, i8* %20, i8* %23
%25 = load i8, i8* %24
br label %26
26: ; preds = %15, %2, %6
%27 = phi i8 [ %11, %6 ], [ 33, %2 ], [ %25, %15 ]
store i8 %27, i8* %4
%28 = call i32 @write(i32 1, i8* %4, i32 2)
ret i32 0
}