#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 */
#define EOF 128
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int fnextc(FILE *f, int flags) {
  register int c;
  c = getc(f);
  for (;;) {
    switch (c) {
    case EOF:
      return (EOF);
    case ' ':
    case '\t':
      break;
    case '#':
      if (flags & 2)
        goto fim;
      while ((c = getc(f)) != '\n' && c != EOF)
        ;
      continue;
    case '\n':
      if (!(flags & 1))
        break;
    default:
    fim:
      ungetc(c, f);
      return (c);
    }
    c = getc(f);
  }
}


x86 assembly (clang, -O0):
<fnextc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x9,%eax
je     11a1 <fnextc+0x81>
jmp    114f <fnextc+0x2f>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
je     1202 <fnextc+0xe2>
jmp    1160 <fnextc+0x40>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
je     11a1 <fnextc+0x81>
jmp    1171 <fnextc+0x51>
mov    -0x1c(%rbp),%eax
sub    $0x23,%eax
je     11a6 <fnextc+0x86>
jmp    1182 <fnextc+0x62>
mov    -0x1c(%rbp),%eax
sub    $0x80,%eax
jne    121b <fnextc+0xfb>
jmp    1195 <fnextc+0x75>
movl   $0x80,-0x4(%rbp)
jmp    1248 <fnextc+0x128>
jmp    1237 <fnextc+0x117>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11ba <fnextc+0x9a>
jmp    1220 <fnextc+0x100>
jmp    11bf <fnextc+0x9f>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x1d(%rbp)
je     11e8 <fnextc+0xc8>
cmpl   $0x80,-0x18(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11f8 <fnextc+0xd8>
jmp    11fd <fnextc+0xdd>
jmp    11bf <fnextc+0x9f>
jmp    113b <fnextc+0x1b>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1216 <fnextc+0xf6>
jmp    1237 <fnextc+0x117>
jmp    121b <fnextc+0xfb>
jmp    1220 <fnextc+0x100>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ungetc@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1248 <fnextc+0x128>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x18(%rbp)
jmp    113b <fnextc+0x1b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnextc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    %eax,%ebp
lea    0xec5(%rip),%r15
jmp    1150 <fnextc+0x30>
nopl   (%rax)
test   $0x1,%r14b
jne    1191 <fnextc+0x71>
mov    %rbx,%rdi
call   1040 <getc@plt>
mov    %eax,%ebp
lea    -0x9(%rbp),%eax
cmp    $0x1a,%eax
ja     1189 <fnextc+0x69>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
test   $0x2,%r14b
jne    1191 <fnextc+0x71>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <getc@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
je     1150 <fnextc+0x30>
cmp    $0x80,%ebp
jne    1170 <fnextc+0x50>
jmp    1150 <fnextc+0x30>
cmp    $0x80,%ebp
je     119b <fnextc+0x7b>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <ungetc@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fnextc(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @getc(i32* %0)
%4 = and i32 %1, 1
%5 = icmp eq i32 %4, 0
%6 = and i32 %1, 2
%7 = icmp eq i32 %6, 0
br label %8
8: ; preds = %18, %2
%9 = phi i32 [ %3, %2 ], [ %19, %18 ]
switch i32 %9, label %14 [
i32 128, label %20
i32 32, label %16
i32 9, label %16
i32 35, label %10
i32 10, label %13
]
10: ; preds = %8
br i1 %7, label %11, label %14
11: ; preds = %10, %11
%12 = tail call i32 @getc(i32* %0)
switch i32 %12, label %11 [
i32 128, label %18
i32 10, label %18
]
13: ; preds = %8
br i1 %5, label %16, label %14
14: ; preds = %8, %13, %10
%15 = tail call i32 @ungetc(i32 %9, i32* %0)
br label %20
16: ; preds = %13, %8, %8
%17 = tail call i32 @getc(i32* %0)
br label %18
18: ; preds = %11, %11, %16
%19 = phi i32 [ %17, %16 ], [ %12, %11 ], [ %12, %11 ]
br label %8
20: ; preds = %8, %14
ret i32 %9
}