#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*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, char *argv[]) {
  FILE *fp;
  bool p = true;
  char c;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while ((c = getc(fp)) != EOF) {
    if (c >= 'a' && c <= 'z')
      putchar(c & 223);
    else if (c >= 'A' && c <= 'Z')
      putchar(c | 32);
    else
      putchar(c);
    p = c == '\n';
  }
  if (!p)
    putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1186 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1268 <main+0x128>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %al,-0x1d(%rbp)
movsbl %al,%eax
mov    0x2e29(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     124d <main+0x10d>
movsbl -0x1d(%rbp),%eax
cmp    $0x61,%eax
jl     11fa <main+0xba>
movsbl -0x1d(%rbp),%eax
cmp    $0x7a,%eax
jg     11fa <main+0xba>
movsbl -0x1d(%rbp),%eax
and    $0xdf,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1236 <main+0xf6>
movsbl -0x1d(%rbp),%eax
cmp    $0x41,%eax
jl     1228 <main+0xe8>
movsbl -0x1d(%rbp),%eax
cmp    $0x5a,%eax
jg     1228 <main+0xe8>
movsbl -0x1d(%rbp),%eax
or     $0x20,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1231 <main+0xf1>
movsbl -0x1d(%rbp),%edi
call   1030 <putchar@plt>
jmp    1236 <main+0xf6>
movsbl -0x1d(%rbp),%eax
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a9 <main+0x69>
cmpl   $0x0,-0x1c(%rbp)
jne    1261 <main+0x121>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11b8 <main+0x78>
mov    0x8(%rsi),%rdi
lea    0xebb(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <getc@plt>
mov    0x2e7a(%rip),%r15
xor    %r14d,%r14d
cmp    (%r15),%al
jne    11a9 <main+0x69>
jmp    11df <main+0x9f>
nopl   0x0(%rax,%rax,1)
lea    -0x41(%rbp),%eax
mov    %ebp,%ecx
or     $0x20,%cl
cmp    $0x1a,%al
movzbl %bpl,%edx
movzbl %cl,%eax
cmovae %edx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r15),%al
je     11cf <main+0x8f>
mov    %eax,%ebp
lea    -0x61(%rbp),%eax
cmp    $0x19,%al
ja     1180 <main+0x40>
mov    %ebp,%eax
and    $0xdf,%al
jmp    1194 <main+0x54>
mov    (%rsi),%rsi
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%r14d
jmp    11df <main+0x9f>
cmp    $0xa,%bpl
je     11df <main+0x9f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %71
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
br label %21
21: ; preds = %60, %16
%22 = load i32*, i32** %6
%23 = call signext i8 @getc(i32* %22)
store i8 %23, i8* %8
%24 = sext i8 %23 to i32
%25 = load i8, i8* @EOF
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %24, %26
br i1 %27, label %28, label %65
28: ; preds = %21
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 97
br i1 %31, label %32, label %42
32: ; preds = %28
%33 = load i8, i8* %8
%34 = sext i8 %33 to i32
%35 = icmp sle i32 %34, 122
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i8, i8* %8
%38 = sext i8 %37 to i32
%39 = and i32 %38, 223
%40 = trunc i32 %39 to i8
%41 = call i32 @putchar(i8 signext %40)
br label %60
42: ; preds = %32, %28
%43 = load i8, i8* %8
%44 = sext i8 %43 to i32
%45 = icmp sge i32 %44, 65
br i1 %45, label %46, label %56
46: ; preds = %42
%47 = load i8, i8* %8
%48 = sext i8 %47 to i32
%49 = icmp sle i32 %48, 90
br i1 %49, label %50, label %56
50: ; preds = %46
%51 = load i8, i8* %8
%52 = sext i8 %51 to i32
%53 = or i32 %52, 32
%54 = trunc i32 %53 to i8
%55 = call i32 @putchar(i8 signext %54)
br label %59
56: ; preds = %46, %42
%57 = load i8, i8* %8
%58 = call i32 @putchar(i8 signext %57)
br label %59
59: ; preds = %56, %50
br label %60
60: ; preds = %59, %36
%61 = load i8, i8* %8
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 10
%64 = zext i1 %63 to i32
store i32 %64, i32* %7
br label %21
65: ; preds = %21
%66 = load i32, i32* %7
%67 = icmp ne i32 %66, 0
br i1 %67, label %70, label %68
68: ; preds = %65
%69 = call i32 @putchar(i8 signext 10)
br label %70
70: ; preds = %68, %65
store i32 0, i32* %3
br label %71
71: ; preds = %70, %11
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %35
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call signext i8 @getc(i32* %10)
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %11, %12
br i1 %13, label %35, label %14
14: ; preds = %7, %25
%15 = phi i8 [ %28, %25 ], [ %11, %7 ]
%16 = add i8 %15, -97
%17 = icmp ult i8 %16, 26
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = and i8 %15, -33
br label %25
20: ; preds = %14
%21 = add i8 %15, -65
%22 = icmp ult i8 %21, 26
%23 = or i8 %15, 32
%24 = select i1 %22, i8 %23, i8 %15
br label %25
25: ; preds = %20, %18
%26 = phi i8 [ %19, %18 ], [ %24, %20 ]
%27 = tail call i32 @putchar(i8 signext %26)
%28 = tail call signext i8 @getc(i32* %10)
%29 = load i8, i8* @EOF
%30 = icmp eq i8 %28, %29
br i1 %30, label %31, label %14
31: ; preds = %25
%32 = icmp eq i8 %15, 10
br i1 %32, label %35, label %33
33: ; preds = %31
%34 = tail call i32 @putchar(i8 signext 10)
br label %35
35: ; preds = %7, %31, %33, %4
%36 = phi i32 [ 1, %4 ], [ 0, %33 ], [ 0, %31 ], [ 0, %7 ]
ret i32 %36
}