#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*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int optind;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ show_usage(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  char str[81 + 1];
  int opt;
  FILE *in = stdin;
  while ((opt = getopt(argc, argv, "h?")) != -1) {
    switch (opt) {
    case 'h':
    default:
      show_usage(argv[0]);
      exit(1);
    }
  }
  if (argc > optind) {
    in = fopen(argv[optind], "r");
    if (!in) {
      fprintf(stderr, "Unable to open input file \"%s\": %s\n", argv[optind],
              strerror(errno));
      return 1;
    }
  }
  memset(str, '0', 81);
  str[81] = '\0';
  char ch;
  int n = 0;
  while (n < 81 && (ch = fgetc(in)) != EOF) {
    if ((ch >= '0' && ch <= '9') || ch == '*' || ch == '.' || ch == 'x' ||
        ch == 'X') {
      str[n++] = ch;
    }
  }
  printf("%s\n", str);
  if (in != stdin)
    fclose(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e28(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe2b(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x74(%rbp)
cmp    $0xffffffff,%eax
je     1212 <main+0x72>
mov    -0x74(%rbp),%eax
sub    $0x68,%eax
jne    11fc <main+0x5c>
jmp    11f7 <main+0x57>
jmp    11fc <main+0x5c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <show_usage@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x8(%rbp),%eax
mov    0x2dbc(%rip),%rcx
cmp    (%rcx),%eax
jle    12b4 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x2da9(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc6(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    12af <main+0x10f>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2d6d(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x90(%rbp)
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    %rax,%rcx
lea    0xd67(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13da <main+0x23a>
jmp    12b4 <main+0x114>
lea    -0x70(%rbp),%rdi
mov    $0x30,%esi
mov    $0x51,%edx
call   1050 <memset@plt>
movb   $0x0,-0x1f(%rbp)
movl   $0x0,-0x88(%rbp)
xor    %eax,%eax
cmpl   $0x51,-0x88(%rbp)
mov    %al,-0x95(%rbp)
jge    1311 <main+0x171>
mov    -0x80(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x81(%rbp)
movsbl %al,%eax
mov    0x2cdd(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x95(%rbp)
mov    -0x95(%rbp),%al
test   $0x1,%al
jne    1324 <main+0x184>
jmp    13a6 <main+0x206>
movsbl -0x81(%rbp),%eax
cmp    $0x30,%eax
jl     1344 <main+0x1a4>
movsbl -0x81(%rbp),%eax
cmp    $0x39,%eax
jle    1384 <main+0x1e4>
movsbl -0x81(%rbp),%eax
cmp    $0x2a,%eax
je     1384 <main+0x1e4>
movsbl -0x81(%rbp),%eax
cmp    $0x2e,%eax
je     1384 <main+0x1e4>
movsbl -0x81(%rbp),%eax
cmp    $0x78,%eax
je     1384 <main+0x1e4>
movsbl -0x81(%rbp),%eax
cmp    $0x58,%eax
jne    13a1 <main+0x201>
mov    -0x81(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
jmp    12d5 <main+0x135>
lea    -0x70(%rbp),%rsi
lea    0xc74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x80(%rbp),%rax
mov    0x2c27(%rip),%rcx
cmp    (%rcx),%rax
je     13d3 <main+0x233>
mov    -0x80(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2e30(%rip),%r15
mov    (%r15),%rbx
lea    0xe3e(%rip),%rdx
call   10a0 <getopt@plt>
cmp    $0xffffffff,%eax
jne    12d5 <main+0x135>
mov    0x2e01(%rip),%r12
movslq (%r12),%rax
cmp    %ebp,%eax
jge    11fb <main+0x5b>
mov    (%r14,%rax,8),%rdi
lea    0xe19(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     128e <main+0xee>
mov    %rsp,%rdi
mov    $0x30,%esi
mov    $0x51,%edx
call   1050 <memset@plt>
movb   $0x0,0x51(%rsp)
xor    %ebp,%ebp
mov    0x2dc5(%rip),%r14
movabs $0x400000000011,%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <fgetc@plt>
cmp    (%r14),%al
je     126e <main+0xce>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1260 <main+0xc0>
lea    -0x2a(%rax),%ecx
cmp    $0x2e,%cl
ja     1256 <main+0xb6>
movzbl %cl,%ecx
bt     %rcx,%r12
jb     1260 <main+0xc0>
cmp    $0x78,%al
jne    1269 <main+0xc9>
nopw   0x0(%rax,%rax,1)
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%rsp,%rcx,1)
cmp    $0x51,%ebp
jl     1230 <main+0x90>
lea    0xdb0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %ebp,%ebp
cmp    (%r15),%rbx
je     12c6 <main+0x126>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    12c6 <main+0x126>
mov    0x2d33(%rip),%rax
mov    (%rax),%ebx
movslq (%r12),%rax
mov    (%r14,%rax,8),%rbp
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd51(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rdi
call   1080 <show_usage@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [3 x i8] c"h?\00"
@optind = global i32 0
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [36 x i8] c"Unable to open input file \22%s\22: %s\0A\00"
@errno = global i32 0
@EOF = global i8 0
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [82 x i8]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i8
%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** %8
br label %12
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %7
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %26
17: ; preds = %12
%18 = load i32, i32* %7
switch i32 %18, label %20 [
i32 104, label %19
]
19: ; preds = %17
br label %20
20: ; preds = %17, %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @show_usage(i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %12
%27 = load i32, i32* %4
%28 = load i32, i32* @optind
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %50
30: ; preds = %26
%31 = load i8**, i8*** %5
%32 = load i32, i32* @optind
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %36, i32** %8
%37 = load i32*, i32** %8
%38 = icmp ne i32* %37, null
br i1 %38, label %49, label %39
39: ; preds = %30
%40 = load i32, i32* @stderr
%41 = load i8**, i8*** %5
%42 = load i32, i32* @optind
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = load i32, i32* @errno
%47 = call i8* @strerror(i32 %46)
%48 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %45, i8* %47)
store i32 1, i32* %3
br label %107
49: ; preds = %30
br label %50
50: ; preds = %49, %26
%51 = getelementptr inbounds [82 x i8], [82 x i8]* %6, i64 0, i64 0
%52 = call i32 @memset(i8* %51, i32 48, i32 81)
%53 = getelementptr inbounds [82 x i8], [82 x i8]* %6, i64 0, i64 81
store i8 0, i8* %53
store i32 0, i32* %10
br label %54
54: ; preds = %96, %50
%55 = load i32, i32* %10
%56 = icmp slt i32 %55, 81
br i1 %56, label %57, label %64
57: ; preds = %54
%58 = load i32*, i32** %8
%59 = call signext i8 @fgetc(i32* %58)
store i8 %59, i8* %9
%60 = sext i8 %59 to i32
%61 = load i8, i8* @EOF
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %60, %62
br label %64
64: ; preds = %57, %54
%65 = phi i1 [ false, %54 ], [ %63, %57 ]
br i1 %65, label %66, label %97
66: ; preds = %64
%67 = load i8, i8* %9
%68 = sext i8 %67 to i32
%69 = icmp sge i32 %68, 48
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = load i8, i8* %9
%72 = sext i8 %71 to i32
%73 = icmp sle i32 %72, 57
br i1 %73, label %90, label %74
74: ; preds = %70, %66
%75 = load i8, i8* %9
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 42
br i1 %77, label %90, label %78
78: ; preds = %74
%79 = load i8, i8* %9
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 46
br i1 %81, label %90, label %82
82: ; preds = %78
%83 = load i8, i8* %9
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 120
br i1 %85, label %90, label %86
86: ; preds = %82
%87 = load i8, i8* %9
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 88
br i1 %89, label %90, label %96
90: ; preds = %86, %82, %78, %74, %70
%91 = load i8, i8* %9
%92 = load i32, i32* %10
%93 = add nsw i32 %92, 1
store i32 %93, i32* %10
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds [82 x i8], [82 x i8]* %6, i64 0, i64 %94
store i8 %91, i8* %95
br label %96
96: ; preds = %90, %86
br label %54
97: ; preds = %64
%98 = getelementptr inbounds [82 x i8], [82 x i8]* %6, i64 0, i64 0
%99 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %98)
%100 = load i32*, i32** %8
%101 = load i32*, i32** @stdin
%102 = icmp ne i32* %100, %101
br i1 %102, label %103, label %106
103: ; preds = %97
%104 = load i32*, i32** %8
%105 = call i32 @fclose(i32* %104)
br label %106
106: ; preds = %103, %97
store i32 0, i32* %3
br label %107
107: ; preds = %106, %39
%108 = load i32, i32* %3
ret i32 %108
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [3 x i8] c"h?\00"
@optind = global i32 0
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [36 x i8] c"Unable to open input file \22%s\22: %s\0A\00"
@errno = global i32 0
@EOF = global i8 0
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [82 x i8]
%4 = getelementptr inbounds [82 x i8], [82 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** @stdin
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, -1
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @show_usage(i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i32, i32* @optind
%14 = icmp slt i32 %13, %0
br i1 %14, label %15, label %30
15: ; preds = %12
%16 = sext i32 %13 to i64
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %30
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i32, i32* @optind
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = load i32, i32* @errno
%28 = tail call i8* @strerror(i32 %27)
%29 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8* %28)
br label %56
30: ; preds = %15, %12
%31 = phi i32* [ %19, %15 ], [ %5, %12 ]
%32 = call i32 @memset(i8* %4, i32 48, i32 81)
%33 = getelementptr inbounds [82 x i8], [82 x i8]* %3, i64 0, i64 81
store i8 0, i8* %33
br label %34
34: ; preds = %30, %47
%35 = phi i32 [ 0, %30 ], [ %48, %47 ]
%36 = call signext i8 @fgetc(i32* %31)
%37 = load i8, i8* @EOF
%38 = icmp eq i8 %36, %37
br i1 %38, label %50, label %39
39: ; preds = %34
%40 = add i8 %36, -48
%41 = icmp ult i8 %40, 10
br i1 %41, label %43, label %42
42: ; preds = %39
switch i8 %36, label %47 [
i8 120, label %43
i8 88, label %43
i8 46, label %43
i8 42, label %43
]
43: ; preds = %42, %42, %42, %42, %39
%44 = add nsw i32 %35, 1
%45 = sext i32 %35 to i64
%46 = getelementptr inbounds [82 x i8], [82 x i8]* %3, i64 0, i64 %45
store i8 %36, i8* %46
br label %47
47: ; preds = %42, %43
%48 = phi i32 [ %44, %43 ], [ %35, %42 ]
%49 = icmp slt i32 %48, 81
br i1 %49, label %34, label %50
50: ; preds = %47, %34
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%52 = load i32*, i32** @stdin
%53 = icmp eq i32* %31, %52
br i1 %53, label %56, label %54
54: ; preds = %50
%55 = call i32 @fclose(i32* %31)
br label %56
56: ; preds = %50, %54, %21
%57 = phi i32 [ 1, %21 ], [ 0, %54 ], [ 0, %50 ]
ret i32 %57
}