#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;
char fgetc(int /*<<< orphan*/ *);
void read_sudoku(FILE *in, char *read_input) {
  char ch;
  int n = 0;
  while (n < 81 && (ch = fgetc(in)) != EOF) {
    if ((ch >= '0' && ch <= '9') || ch == '*' || ch == '.' || ch == 'x' ||
        ch == 'X') {
      read_input[n++] = ch;
    }
  }
}


x86 assembly (clang, -O0):
<read_sudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x51,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jge    1157 <read_sudoku+0x47>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e9c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1167 <read_sudoku+0x57>
jmp    11d2 <read_sudoku+0xc2>
movsbl -0x11(%rbp),%eax
cmp    $0x30,%eax
jl     1181 <read_sudoku+0x71>
movsbl -0x11(%rbp),%eax
cmp    $0x39,%eax
jle    11b5 <read_sudoku+0xa5>
movsbl -0x11(%rbp),%eax
cmp    $0x2a,%eax
je     11b5 <read_sudoku+0xa5>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
je     11b5 <read_sudoku+0xa5>
movsbl -0x11(%rbp),%eax
cmp    $0x78,%eax
je     11b5 <read_sudoku+0xa5>
movsbl -0x11(%rbp),%eax
cmp    $0x58,%eax
jne    11cd <read_sudoku+0xbd>
mov    -0x11(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1127 <read_sudoku+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sudoku>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
mov    0x2ec1(%rip),%r15
movabs $0x400000000011,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r15),%al
je     117f <read_sudoku+0x6f>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1170 <read_sudoku+0x60>
lea    -0x2a(%rax),%ecx
cmp    $0x2e,%cl
ja     1166 <read_sudoku+0x56>
movzbl %cl,%ecx
bt     %rcx,%r12
jb     1170 <read_sudoku+0x60>
cmp    $0x78,%al
jne    117a <read_sudoku+0x6a>
nopw   0x0(%rax,%rax,1)
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%r14,%rcx,1)
cmp    $0x51,%ebp
jl     1140 <read_sudoku+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @read_sudoku(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %6
br label %7
7: ; preds = %50, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 81
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = call signext i8 @fgetc(i32* %11)
store i8 %12, i8* %5
%13 = sext i8 %12 to i32
%14 = load i8, i8* @EOF
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %13, %15
br label %17
17: ; preds = %10, %7
%18 = phi i1 [ false, %7 ], [ %16, %10 ]
br i1 %18, label %19, label %51
19: ; preds = %17
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 57
br i1 %26, label %43, label %27
27: ; preds = %23, %19
%28 = load i8, i8* %5
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 42
br i1 %30, label %43, label %31
31: ; preds = %27
%32 = load i8, i8* %5
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 46
br i1 %34, label %43, label %35
35: ; preds = %31
%36 = load i8, i8* %5
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 120
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i8, i8* %5
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 88
br i1 %42, label %43, label %50
43: ; preds = %39, %35, %31, %27, %23
%44 = load i8, i8* %5
%45 = load i8*, i8** %4
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
store i8 %44, i8* %49
br label %50
50: ; preds = %43, %39
br label %7
51: ; preds = %17
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @read_sudoku(i32* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %2, %16
%4 = phi i32 [ 0, %2 ], [ %17, %16 ]
%5 = tail call signext i8 @fgetc(i32* %0)
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %5, %6
br i1 %7, label %19, label %8
8: ; preds = %3
%9 = add i8 %5, -48
%10 = icmp ult i8 %9, 10
br i1 %10, label %12, label %11
11: ; preds = %8
switch i8 %5, label %16 [
i8 120, label %12
i8 88, label %12
i8 46, label %12
i8 42, label %12
]
12: ; preds = %11, %11, %11, %11, %8
%13 = add nsw i32 %4, 1
%14 = sext i32 %4 to i64
%15 = getelementptr inbounds i8, i8* %1, i64 %14
store i8 %5, i8* %15
br label %16
16: ; preds = %11, %12
%17 = phi i32 [ %13, %12 ], [ %4, %11 ]
%18 = icmp slt i32 %17, 81
br i1 %18, label %3, label %19
19: ; preds = %16, %3
ret void
}