#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 getc(int /*<<< orphan*/ *);
int read_char(FILE *rfile) {
  static int last;
  int n;
  n = last ? last : getc(rfile);
  while (n == '\\') {
    n = getc(rfile);
    if (n == '\n')
      n = getc(rfile);
    else {
      last = n;
      return (int)'\\';
    }
  }
  if (n == '#')
    while ((n = getc(rfile)) != '\n' && n != EOF)
      ;
  if (n == '\n' || n == '\t')
    return (' ');
  return (n);
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpl   $0x0,0x2f09(%rip)
je     1137 <read_char+0x27>
mov    0x2efd(%rip),%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <read_char+0x33>
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x5c,-0x14(%rbp)
jne    1194 <read_char+0x84>
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    117a <read_char+0x6a>
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
jmp    118f <read_char+0x7f>
mov    -0x14(%rbp),%eax
mov    %eax,0x2ea9(%rip)
movl   $0x5c,-0x4(%rbp)
jmp    1211 <read_char+0x101>
jmp    1149 <read_char+0x39>
cmpl   $0x23,-0x14(%rbp)
jne    11eb <read_char+0xdb>
jmp    11a3 <read_char+0x93>
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
je     11d1 <read_char+0xc1>
mov    -0x14(%rbp),%eax
mov    0x2e1f(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11e1 <read_char+0xd1>
jmp    11e6 <read_char+0xd6>
jmp    11a3 <read_char+0x93>
jmp    11eb <read_char+0xdb>
cmpl   $0xa,-0x14(%rbp)
je     11ff <read_char+0xef>
cmpl   $0x9,-0x14(%rbp)
jne    120b <read_char+0xfb>
movl   $0x20,-0x4(%rbp)
jmp    1211 <read_char+0x101>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2f0f(%rip),%eax
test   %eax,%eax
jne    1129 <read_char+0x19>
mov    %rbx,%rdi
call   1030 <getc@plt>
cmp    $0x5c,%eax
jne    1148 <read_char+0x38>
mov    %rbx,%rdi
call   1030 <getc@plt>
cmp    $0xa,%eax
je     1121 <read_char+0x11>
mov    %eax,0x2eeb(%rip)
mov    $0x5c,%ecx
jmp    1182 <read_char+0x72>
cmp    $0x23,%eax
jne    1174 <read_char+0x64>
mov    0x2e94(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <getc@plt>
mov    (%r14),%ecx
cmp    $0xa,%eax
je     1174 <read_char+0x64>
cmp    %ecx,%eax
jne    1160 <read_char+0x50>
lea    -0x9(%rax),%ecx
cmp    $0x2,%ecx
mov    $0x20,%ecx
cmovae %eax,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@read_char.last = internal global i32 0
@EOF = global i32 0
define i32 @read_char(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32, i32* @read_char.last
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @read_char.last
br label %12
9: ; preds = %1
%10 = load i32*, i32** %3
%11 = call i32 @getc(i32* %10)
br label %12
12: ; preds = %9, %7
%13 = phi i32 [ %8, %7 ], [ %11, %9 ]
store i32 %13, i32* %4
br label %14
14: ; preds = %27, %12
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 92
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32*, i32** %3
%19 = call i32 @getc(i32* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32*, i32** %3
%24 = call i32 @getc(i32* %23)
store i32 %24, i32* %4
br label %27
25: ; preds = %17
%26 = load i32, i32* %4
store i32 %26, i32* @read_char.last
store i32 92, i32* %2
br label %53
27: ; preds = %22
br label %14
28: ; preds = %14
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 35
br i1 %30, label %31, label %44
31: ; preds = %28
br label %32
32: ; preds = %42, %31
%33 = load i32*, i32** %3
%34 = call i32 @getc(i32* %33)
store i32 %34, i32* %4
%35 = icmp ne i32 %34, 10
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* %4
%38 = load i32, i32* @EOF
%39 = icmp ne i32 %37, %38
br label %40
40: ; preds = %36, %32
%41 = phi i1 [ false, %32 ], [ %39, %36 ]
br i1 %41, label %42, label %43
42: ; preds = %40
br label %32
43: ; preds = %40
br label %44
44: ; preds = %43, %28
%45 = load i32, i32* %4
%46 = icmp eq i32 %45, 10
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 9
br i1 %49, label %50, label %51
50: ; preds = %47, %44
store i32 32, i32* %2
br label %53
51: ; preds = %47
%52 = load i32, i32* %4
store i32 %52, i32* %2
br label %53
53: ; preds = %51, %50, %25
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
@read_char.last = internal unnamed_addr global i32 0
@EOF = global i32 0
define i32 @read_char(i32* nocapture %0) {
%2 = load i32, i32* @read_char.last
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1, %8
%5 = tail call i32 @getc(i32* %0)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %2, %1 ], [ %5, %4 ]
switch i32 %7, label %18 [
i32 92, label %8
i32 35, label %12
]
8: ; preds = %6
%9 = tail call i32 @getc(i32* %0)
%10 = icmp eq i32 %9, 10
br i1 %10, label %4, label %11
11: ; preds = %8
store i32 %9, i32* @read_char.last
br label %23
12: ; preds = %6, %12
%13 = tail call i32 @getc(i32* %0)
%14 = icmp ne i32 %13, 10
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %13, %15
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %12, label %18
18: ; preds = %12, %6
%19 = phi i32 [ %7, %6 ], [ %13, %12 ]
%20 = add i32 %19, -9
%21 = icmp ult i32 %20, 2
%22 = select i1 %21, i32 32, i32 %19
br label %23
23: ; preds = %18, %11
%24 = phi i32 [ 92, %11 ], [ %22, %18 ]
ret i32 %24
}