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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int read(int, char *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int fin, comment, charpos;
  char c;
  if (argc > 1) {
    fin = open(argv[1], O_RDONLY, 0);
  } else
    fin = 0;
  comment = charpos = 0;
  while (read(fin, &c, 1) == 1) {
    c &= 0x7f;
    if ((charpos++ == 0 && c == '*') || c == ';')
      comment = 1;
    if (c == '\r') {
      comment = charpos = 0;
      c = '\n';
    }
    if (c == ' ' && !comment)
      c = '\t';
    putc(c & 0x7f, stdout);
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1170 <main+0x40>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x47>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x1d(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jne    1235 <main+0x105>
movsbl -0x1d(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0x1d(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
jne    11ca <main+0x9a>
movsbl -0x1d(%rbp),%eax
cmp    $0x2a,%eax
je     11d7 <main+0xa7>
movsbl -0x1d(%rbp),%eax
cmp    $0x3b,%eax
jne    11de <main+0xae>
movl   $0x1,-0x18(%rbp)
movsbl -0x1d(%rbp),%eax
cmp    $0xd,%eax
jne    11fd <main+0xcd>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0xa,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
cmp    $0x20,%eax
jne    1218 <main+0xe8>
cmpl   $0x0,-0x18(%rbp)
jne    1218 <main+0xe8>
movb   $0x9,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
and    $0x7f,%eax
mov    0x2db2(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <putc@plt>
jmp    1185 <main+0x55>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x2,%edi
jl     1158 <main+0x28>
mov    0x8(%rsi),%rdi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <open@plt>
mov    %eax,%ebx
lea    0x7(%rsp),%rsi
mov    $0x1,%r15d
mov    %ebx,%edi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jne    1206 <main+0xd6>
xor    %ebp,%ebp
lea    0x7(%rsp),%r14
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    11be <main+0x8e>
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%al
cmovne %eax,%ecx
mov    %cl,0x7(%rsp)
mov    0x2e38(%rip),%rax
mov    (%rax),%esi
movzbl %cl,%edi
call   1040 <putc@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jne    1206 <main+0xd6>
movzbl 0x7(%rsp),%eax
and    $0x7f,%al
cmp    $0x3b,%al
cmove  %r15d,%r13d
cmp    $0x2a,%al
mov    %r13d,%ecx
cmove  %r15d,%ecx
test   %r12d,%r12d
cmove  %ecx,%r13d
cmp    $0xd,%al
movzbl %al,%eax
mov    $0xa,%ecx
cmove  %ecx,%eax
cmove  %ebp,%r13d
lea    0x1(%r12),%ecx
mov    %ecx,%r12d
cmove  %ebp,%r12d
mov    %eax,%ecx
test   %r13d,%r13d
jne    1190 <main+0x60>
mov    $0x9,%ecx
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@stdout = 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
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* @O_RDONLY
%17 = call i32 @open(i8* %15, i32 %16, i32 0)
store i32 %17, i32* %6
br label %19
18: ; preds = %2
store i32 0, i32* %6
br label %19
19: ; preds = %18, %12
store i32 0, i32* %8
store i32 0, i32* %7
br label %20
20: ; preds = %54, %19
%21 = load i32, i32* %6
%22 = call i32 @read(i32 %21, i8* %9, i32 1)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %61
24: ; preds = %20
%25 = load i8, i8* %9
%26 = sext i8 %25 to i32
%27 = and i32 %26, 127
%28 = trunc i32 %27 to i8
store i8 %28, i8* %9
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
%31 = icmp eq i32 %29, 0
br i1 %31, label %32, label %36
32: ; preds = %24
%33 = load i8, i8* %9
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 42
br i1 %35, label %40, label %36
36: ; preds = %32, %24
%37 = load i8, i8* %9
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 59
br i1 %39, label %40, label %41
40: ; preds = %36, %32
store i32 1, i32* %7
br label %41
41: ; preds = %40, %36
%42 = load i8, i8* %9
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 13
br i1 %44, label %45, label %46
45: ; preds = %41
store i32 0, i32* %8
store i32 0, i32* %7
store i8 10, i8* %9
br label %46
46: ; preds = %45, %41
%47 = load i8, i8* %9
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 32
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = load i32, i32* %7
%52 = icmp ne i32 %51, 0
br i1 %52, label %54, label %53
53: ; preds = %50
store i8 9, i8* %9
br label %54
54: ; preds = %53, %50, %46
%55 = load i8, i8* %9
%56 = sext i8 %55 to i32
%57 = and i32 %56, 127
%58 = trunc i32 %57 to i8
%59 = load i32, i32* @stdout
%60 = call i32 @putc(i8 signext %58, i32 %59)
br label %20
61: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = load i32, i32* @O_RDONLY
%9 = tail call i32 @open(i8* %7, i32 %8, i32 0)
br label %10
10: ; preds = %2, %5
%11 = phi i32 [ %9, %5 ], [ 0, %2 ]
%12 = call i32 @read(i32 %11, i8* %3, i32 1)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %38
14: ; preds = %10, %14
%15 = phi i32 [ %29, %14 ], [ 0, %10 ]
%16 = phi i32 [ %28, %14 ], [ 0, %10 ]
%17 = load i8, i8* %3
%18 = and i8 %17, 127
%19 = add nsw i32 %15, 1
%20 = icmp eq i32 %15, 0
%21 = icmp eq i8 %18, 42
%22 = select i1 %20, i1 %21, i1 false
%23 = icmp eq i8 %18, 59
%24 = select i1 %22, i1 true, i1 %23
%25 = select i1 %24, i32 1, i32 %16
%26 = icmp eq i8 %18, 13
%27 = select i1 %26, i8 10, i8 %18
%28 = select i1 %26, i32 0, i32 %25
%29 = select i1 %26, i32 0, i32 %19
%30 = icmp ne i8 %27, 32
%31 = icmp ne i32 %28, 0
%32 = select i1 %30, i1 true, i1 %31
%33 = select i1 %32, i8 %27, i8 9
store i8 %33, i8* %3
%34 = load i32, i32* @stdout
%35 = tail call i32 @putc(i8 signext %33, i32 %34)
%36 = call i32 @read(i32 %11, i8* %3, i32 1)
%37 = icmp eq i32 %36, 1
br i1 %37, label %14, label %38
38: ; preds = %14, %10
ret i32 0
}