#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 EXIT_FAILURE;
scalar_t__ feof(int /*<<< orphan*/ *);
int getc(int /*<<< orphan*/ *);
int GetType(FILE *fp) {
  int c, i;
  do {
    c = getc(fp);
    if (c == '#')
      do {
        c = getc(fp);
      } while (c != '\n');
  } while (c != 'W' && c != 'R' && !feof(fp));
  if (feof(fp))
    return (EXIT_FAILURE);
  else {
    return c;
  }
}


x86 assembly (clang, -O0):
<GetType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x23,-0x14(%rbp)
jne    1162 <GetType+0x42>
jmp    1147 <GetType+0x27>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    1147 <GetType+0x27>
jmp    1162 <GetType+0x42>
jmp    1167 <GetType+0x47>
xor    %eax,%eax
cmpl   $0x57,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     119a <GetType+0x7a>
xor    %eax,%eax
cmpl   $0x52,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     119a <GetType+0x7a>
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    112c <GetType+0xc>
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
je     11c9 <GetType+0xa9>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11cf <GetType+0xaf>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetType>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
jmp    113d <GetType+0x1d>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <feof@plt>
test   %rax,%rax
jne    1174 <GetType+0x54>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0x23,%eax
je     1160 <GetType+0x40>
mov    %eax,%ebp
cmp    $0x52,%eax
je     1174 <GetType+0x54>
cmp    $0x57,%ebp
jne    1130 <GetType+0x10>
jmp    1174 <GetType+0x54>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0xa,%eax
jne    1160 <GetType+0x40>
mov    $0xa,%ebp
jmp    1130 <GetType+0x10>
mov    %rbx,%rdi
call   1030 <feof@plt>
test   %rax,%rax
je     118a <GetType+0x6a>
mov    0x2e58(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i32 @GetType(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
br label %6
6: ; preds = %31, %1
%7 = load i32*, i32** %3
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 35
br i1 %10, label %11, label %19
11: ; preds = %6
br label %12
12: ; preds = %15, %11
%13 = load i32*, i32** %3
%14 = call i32 @getc(i32* %13)
store i32 %14, i32* %4
br label %15
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 10
br i1 %17, label %12, label %18
18: ; preds = %15
br label %19
19: ; preds = %18, %6
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 87
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 82
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32*, i32** %3
%28 = call i64 @feof(i32* %27)
%29 = icmp ne i64 %28, 0
%30 = xor i1 %29, true
br label %31
31: ; preds = %26, %23, %20
%32 = phi i1 [ false, %23 ], [ false, %20 ], [ %30, %26 ]
br i1 %32, label %6, label %33
33: ; preds = %31
%34 = load i32*, i32** %3
%35 = call i64 @feof(i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i32, i32* @EXIT_FAILURE
store i32 %38, i32* %2
br label %41
39: ; preds = %33
%40 = load i32, i32* %4
store i32 %40, i32* %2
br label %41
41: ; preds = %39, %37
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @GetType(i32* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = tail call i32 @getc(i32* %0)
switch i32 %3, label %7 [
i32 35, label %4
i32 87, label %11
i32 82, label %11
]
4: ; preds = %2, %4
%5 = tail call i32 @getc(i32* %0)
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %4
7: ; preds = %4, %2
%8 = phi i32 [ %3, %2 ], [ 10, %4 ]
%9 = tail call i64 @feof(i32* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %2, label %11
11: ; preds = %2, %2, %7
%12 = phi i32 [ %8, %7 ], [ %3, %2 ], [ %3, %2 ]
%13 = tail call i64 @feof(i32* %0)
%14 = icmp eq i64 %13, 0
%15 = load i32, i32* @EXIT_FAILURE
%16 = select i1 %14, i32 %12, i32 %15
ret i32 %16
}