#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *fin, *fout;
  int ch;
  fin = fopen(argv[1], "r");
  fout = fopen(argv[2], "wb+");
  while (ch = fgetc(fin) != EOF) {
    if (ch == '.') {
      do {
        fputc(ch, fout);
        ch = fgetc(fin);
      } while (ch < 'a' && ch > 'z' && ch < 'A' && ch > 'Z' && ch != EOF);
      if (ch >= 'a')
        ch += 'A' - 'a';
    }
    fputc(ch, fout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe95(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    11a3 <main+0x73>
jmp    124c <main+0x11c>
cmpl   $0x2e,-0x24(%rbp)
jne    123b <main+0x10b>
jmp    11b2 <main+0x82>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jge    1218 <main+0xe8>
xor    %eax,%eax
cmpl   $0x7a,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jle    1218 <main+0xe8>
xor    %eax,%eax
cmpl   $0x41,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jge    1218 <main+0xe8>
xor    %eax,%eax
cmpl   $0x5a,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jle    1218 <main+0xe8>
mov    -0x24(%rbp),%eax
mov    0x2dd8(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11b2 <main+0x82>
cmpl   $0x61,-0x24(%rbp)
jl     1236 <main+0x106>
mov    -0x24(%rbp),%eax
add    $0xffffffe0,%eax
mov    %eax,-0x24(%rbp)
jmp    123b <main+0x10b>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <fputc@plt>
jmp    1176 <main+0x46>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xebd(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xeac(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    0x2e7b(%rip),%r15
cmp    (%r15),%eax
je     119a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r14,%rdi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
jne    1180 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"wb+\00"
@EOF = global i32 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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %7
br label %17
17: ; preds = %58, %2
%18 = load i32*, i32** %6
%19 = call i32 @fgetc(i32* %18)
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
%22 = zext i1 %21 to i32
store i32 %22, i32* %8
br i1 %21, label %23, label %62
23: ; preds = %17
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, 46
br i1 %25, label %26, label %58
26: ; preds = %23
br label %27
27: ; preds = %49, %26
%28 = load i32, i32* %8
%29 = load i32*, i32** %7
%30 = call i32 @fputc(i32 %28, i32* %29)
%31 = load i32*, i32** %6
%32 = call i32 @fgetc(i32* %31)
store i32 %32, i32* %8
br label %33
33: ; preds = %27
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 97
br i1 %35, label %36, label %49
36: ; preds = %33
%37 = load i32, i32* %8
%38 = icmp sgt i32 %37, 122
br i1 %38, label %39, label %49
39: ; preds = %36
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 65
br i1 %41, label %42, label %49
42: ; preds = %39
%43 = load i32, i32* %8
%44 = icmp sgt i32 %43, 90
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i32, i32* %8
%47 = load i32, i32* @EOF
%48 = icmp ne i32 %46, %47
br label %49
49: ; preds = %45, %42, %39, %36, %33
%50 = phi i1 [ false, %42 ], [ false, %39 ], [ false, %36 ], [ false, %33 ], [ %48, %45 ]
br i1 %50, label %27, label %51
51: ; preds = %49
%52 = load i32, i32* %8
%53 = icmp sge i32 %52, 97
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %8
%56 = add nsw i32 %55, -32
store i32 %56, i32* %8
br label %57
57: ; preds = %54, %51
br label %58
58: ; preds = %57, %23
%59 = load i32, i32* %8
%60 = load i32*, i32** %7
%61 = call i32 @fputc(i32 %59, i32* %60)
br label %17
62: ; preds = %17
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"wb+\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @fgetc(i32* %5)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %17, label %12
12: ; preds = %2, %12
%13 = tail call i32 @fputc(i32 1, i32* %8)
%14 = tail call i32 @fgetc(i32* %5)
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %12
17: ; preds = %12, %2
ret i32 0
}