#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 */
int EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int getchar();
scalar_t__ isupper(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ tolower(int);
int main(int argc, char *argv[]) {
  char line1[200];
  FILE *fileinput = stdin;
  FILE *fileoutput;
  argv[0] = line1;
  printf("line1 is %s", line1);
  fileinput = fopen(line1, "r");
  fileoutput = fopen(argv[0], "w");
  int ltr1, ltr2;
  ltr1 = getchar();
  while (ltr1 != EOF) {
    if ((isupper(ltr1)) == 0) {
      tolower(ltr1);
      fprintf(fileoutput, "%u", ltr1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe8(%rbp)
lea    -0xe0(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
lea    -0xe0(%rbp),%rsi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xe8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xf0(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xf4(%rbp)
mov    -0xf4(%rbp),%eax
mov    0x2df7(%rip),%rcx
cmp    (%rcx),%eax
je     1224 <main+0xd4>
mov    -0xf4(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
jne    121f <main+0xcf>
mov    -0xf0(%rbp),%rdi
mov    -0xf4(%rbp),%edx
lea    0xdf6(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11dc <main+0x8c>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
mov    %rsp,%rbp
mov    %rbp,(%rsi)
lea    0xe93(%rip),%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
lea    0xe90(%rip),%rsi
mov    %rbp,%rdi
call   1070 <fopen@plt>
mov    (%rbx),%rdi
lea    0xe80(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e44(%rip),%rbx
cmp    (%rbx),%eax
jne    11b8 <main+0x68>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe4f(%rip),%r14
jmp    11d4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    (%rbx),%ebp
je     11a8 <main+0x58>
mov    %ebp,%edi
call   1060 <isupper@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
jmp    11d0 <main+0x80>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [12 x i8] c"line1 is %s\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@EOF = global i32 0
@.str.3 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [200 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32*, i32** @stdin
store i32* %11, i32** %7
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
store i8* %12, i8** %14
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %7
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %8
%23 = call i32 (...) @getchar()
store i32 %23, i32* %9
br label %24
24: ; preds = %38, %2
%25 = load i32, i32* %9
%26 = load i32, i32* @EOF
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %39
28: ; preds = %24
%29 = load i32, i32* %9
%30 = call i64 @isupper(i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i32, i32* %9
%34 = call i32 @tolower(i32 %33)
%35 = load i32*, i32** %8
%36 = load i32, i32* %9
%37 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32, %28
br label %24
39: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [12 x i8] c"line1 is %s\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@EOF = global i32 0
@.str.3 = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
store i8* %4, i8** %1
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8*, i8** %1
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @getchar()
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %20, label %12
12: ; preds = %2, %17
%13 = call i64 @isupper(i32 %9)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %9)
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %9, %18
br i1 %19, label %20, label %12
20: ; preds = %17, %2
ret i32 0
}