#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 *fgets(char *, int, int /*<<< orphan*/ *);
int RfileReadLine(FILE *fp, int buflen, char *buffer) {
  char *s = NULL;
  do {
    s = fgets(buffer, buflen, fp);
    if (s == NULL)
      break;
  } while ((buffer[0] == '#') || (buffer[0] == '%'));
  if (s == NULL)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<RfileReadLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <fgets@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    114f <RfileReadLine+0x3f>
jmp    1184 <RfileReadLine+0x74>
jmp    1154 <RfileReadLine+0x44>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0x29(%rbp)
je     1179 <RfileReadLine+0x69>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    112b <RfileReadLine+0x1b>
cmpq   $0x0,-0x28(%rbp)
jne    119b <RfileReadLine+0x8b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a2 <RfileReadLine+0x92>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RfileReadLine>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %rdx,%rdi
mov    %rbp,%rdx
call   1030 <fgets@plt>
mov    $0xffffffff,%r14d
jmp    114e <RfileReadLine+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
je     1161 <RfileReadLine+0x51>
movzbl (%rbx),%eax
cmp    $0x25,%al
je     1140 <RfileReadLine+0x30>
cmp    $0x23,%al
je     1140 <RfileReadLine+0x30>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RfileReadLine(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* null, i8** %8
br label %9
9: ; preds = %30, %3
%10 = load i8*, i8** %7
%11 = load i32, i32* %6
%12 = load i32*, i32** %5
%13 = call i8* @fgets(i8* %10, i32 %11, i32* %12)
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %9
br label %32
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i8*, i8** %7
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 35
br i1 %23, label %30, label %24
24: ; preds = %18
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 37
br label %30
30: ; preds = %24, %18
%31 = phi i1 [ true, %18 ], [ %29, %24 ]
br i1 %31, label %9, label %32
32: ; preds = %30, %16
%33 = load i8*, i8** %8
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 -1, i32* %4
br label %37
36: ; preds = %32
store i32 0, i32* %4
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @RfileReadLine(i32* nocapture %0, i32 %1, i8* %2) {
%4 = tail call i8* @fgets(i8* %2, i32 %1, i32* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3, %8
%7 = load i8, i8* %2
switch i8 %7, label %11 [
i8 35, label %8
i8 37, label %8
]
8: ; preds = %6, %6
%9 = tail call i8* @fgets(i8* %2, i32 %1, i32* %0)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %6
11: ; preds = %8, %6, %3
%12 = phi i32 [ -1, %3 ], [ 0, %6 ], [ -1, %8 ]
ret i32 %12
}