#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')
      c |= 32;
    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    1229 <main+0xe9>
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     120e <main+0xce>
movsbl -0x1d(%rbp),%eax
cmp    $0x41,%eax
jl     11ee <main+0xae>
movsbl -0x1d(%rbp),%eax
cmp    $0x5a,%eax
jg     11ee <main+0xae>
movsbl -0x1d(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%edi
call   1030 <putchar@plt>
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    1222 <main+0xe2>
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    11b9 <main+0x79>
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
je     11ce <main+0x8e>
cs nopw 0x0(%rax,%rax,1)
lea    -0x41(%rax),%ecx
movzbl %al,%edx
or     $0x20,%al
cmp    $0x1a,%cl
movzbl %al,%ebp
cmovae %edx,%ebp
movsbl %bpl,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r15),%al
jne    1180 <main+0x40>
cmp    $0xa,%bpl
je     11ce <main+0x8e>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11ce <main+0x8e>
mov    (%rsi),%rsi
lea    0xe3d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%r14d
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 %54
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 = %41, %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 %48
28: ; preds = %21
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 65
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i8, i8* %8
%34 = sext i8 %33 to i32
%35 = icmp sle i32 %34, 90
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load i8, i8* %8
%38 = sext i8 %37 to i32
%39 = or i32 %38, 32
%40 = trunc i32 %39 to i8
store i8 %40, i8* %8
br label %41
41: ; preds = %36, %32, %28
%42 = load i8, i8* %8
%43 = call i32 @putchar(i8 signext %42)
%44 = load i8, i8* %8
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 10
%47 = zext i1 %46 to i32
store i32 %47, i32* %7
br label %21
48: ; preds = %21
%49 = load i32, i32* %7
%50 = icmp ne i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = call i32 @putchar(i8 signext 10)
br label %53
53: ; preds = %51, %48
store i32 0, i32* %3
br label %54
54: ; preds = %53, %11
%55 = load i32, i32* %3
ret i32 %55
}

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 %28
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 %28, label %14
14: ; preds = %7, %14
%15 = phi i8 [ %21, %14 ], [ %11, %7 ]
%16 = add i8 %15, -65
%17 = icmp ult i8 %16, 26
%18 = or i8 %15, 32
%19 = select i1 %17, i8 %18, i8 %15
%20 = tail call i32 @putchar(i8 signext %19)
%21 = tail call signext i8 @getc(i32* %10)
%22 = load i8, i8* @EOF
%23 = icmp eq i8 %21, %22
br i1 %23, label %24, label %14
24: ; preds = %14
%25 = icmp eq i8 %19, 10
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = tail call i32 @putchar(i8 signext 10)
br label %28
28: ; preds = %7, %24, %26, %4
%29 = phi i32 [ 1, %4 ], [ 0, %26 ], [ 0, %24 ], [ 0, %7 ]
ret i32 %29
}