#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 */
scalar_t__ wf_next_token(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ wf_skip_line(int /*<<< orphan*/ *);
int wf_expect_eol(FILE *fp) {
  char c;
  if (wf_next_token(&c, 1, fp) == 0 || c == '\n') {
    return 0;
  }
  if (c == '#') {
    wf_skip_line(fp);
    if (wf_next_token(&c, 1, fp) == 0 || c == '\n') {
      return 0;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<wf_expect_eol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x11(%rbp),%rdi
mov    $0x1,%esi
call   1030 <wf_next_token@plt>
cmp    $0x0,%rax
je     1155 <wf_expect_eol+0x35>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    1161 <wf_expect_eol+0x41>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <wf_expect_eol+0x98>
movsbl -0x11(%rbp),%eax
cmp    $0x23,%eax
jne    11b1 <wf_expect_eol+0x91>
mov    -0x10(%rbp),%rdi
call   1040 <wf_skip_line@plt>
mov    -0x10(%rbp),%rdx
lea    -0x11(%rbp),%rdi
mov    $0x1,%esi
call   1030 <wf_next_token@plt>
cmp    $0x0,%rax
je     11a0 <wf_expect_eol+0x80>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11ac <wf_expect_eol+0x8c>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <wf_expect_eol+0x98>
jmp    11b1 <wf_expect_eol+0x91>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wf_expect_eol>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1030 <wf_next_token@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1176 <wf_expect_eol+0x56>
mov    0x7(%rsp),%al
cmp    $0xa,%al
je     1176 <wf_expect_eol+0x56>
cmp    $0x23,%al
jne    1171 <wf_expect_eol+0x51>
mov    %rbx,%rdi
call   1040 <wf_skip_line@plt>
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1030 <wf_next_token@plt>
test   %rax,%rax
je     1176 <wf_expect_eol+0x56>
cmpb   $0xa,0x7(%rsp)
je     1176 <wf_expect_eol+0x56>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wf_expect_eol(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i64 @wf_next_token(i8* %4, i32 1, i32* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %8, %1
store i32 0, i32* %2
br label %30
13: ; preds = %8
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 35
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32*, i32** %3
%19 = call i32 @wf_skip_line(i32* %18)
%20 = load i32*, i32** %3
%21 = call i64 @wf_next_token(i8* %4, i32 1, i32* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %17
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %28
27: ; preds = %23, %17
store i32 0, i32* %2
br label %30
28: ; preds = %23
br label %29
29: ; preds = %28, %13
store i32 -1, i32* %2
br label %30
30: ; preds = %29, %27, %12
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @wf_expect_eol(i32* %0) {
%2 = alloca i8
%3 = call i64 @wf_next_token(i8* %2, i32 1, i32* %0)
%4 = icmp eq i64 %3, 0
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 10
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %18, label %8
8: ; preds = %1
%9 = icmp eq i8 %5, 35
br i1 %9, label %10, label %17
10: ; preds = %8
%11 = call i32 @wf_skip_line(i32* %0)
%12 = call i64 @wf_next_token(i8* %2, i32 1, i32* %0)
%13 = icmp eq i64 %12, 0
%14 = load i8, i8* %2
%15 = icmp eq i8 %14, 10
%16 = select i1 %13, i1 true, i1 %15
br i1 %16, label %18, label %17
17: ; preds = %10, %8
br label %18
18: ; preds = %10, %1, %17
%19 = phi i32 [ -1, %17 ], [ 0, %1 ], [ 0, %10 ]
ret i32 %19
}