#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 /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int seqfile_has_labels(FILE *seqfile) {
  char row[30000];
  rewind(seqfile);
  while (1) {
    if (fgets(row, 30000, seqfile) != NULL) {
      if (row[0] == '/') {
        rewind(seqfile);
        return 0;
      }
    } else {
      rewind(seqfile);
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<seqfile_has_labels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7540,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
lea    -0x7540(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x7530,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1181 <seqfile_has_labels+0x61>
movsbl -0x7540(%rbp),%eax
cmp    $0x2f,%eax
jne    117c <seqfile_has_labels+0x5c>
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
movl   $0x0,-0x4(%rbp)
jmp    119b <seqfile_has_labels+0x7b>
jmp    1196 <seqfile_has_labels+0x76>
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119b <seqfile_has_labels+0x7b>
jmp    1138 <seqfile_has_labels+0x18>
mov    -0x4(%rbp),%eax
add    $0x7540,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seqfile_has_labels>:
push   %rbp
push   %r14
push   %rbx
sub    $0x7530,%rsp
mov    %rdi,%rbx
call   1030 <rewind@plt>
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x7530,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     115f <seqfile_has_labels+0x3f>
cmpb   $0x2f,(%rsp)
jne    1140 <seqfile_has_labels+0x20>
xor    %ebp,%ebp
jmp    1164 <seqfile_has_labels+0x44>
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
call   1030 <rewind@plt>
mov    %ebp,%eax
add    $0x7530,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @seqfile_has_labels(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [30000 x i8]
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @rewind(i32* %5)
br label %7
7: ; preds = %1, %24
%8 = getelementptr inbounds [30000 x i8], [30000 x i8]* %4, i64 0, i64 0
%9 = load i32*, i32** %3
%10 = call i32* @fgets(i8* %8, i32 30000, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = getelementptr inbounds [30000 x i8], [30000 x i8]* %4, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32*, i32** %3
%19 = call i32 @rewind(i32* %18)
store i32 0, i32* %2
br label %25
20: ; preds = %12
br label %24
21: ; preds = %7
%22 = load i32*, i32** %3
%23 = call i32 @rewind(i32* %22)
store i32 -1, i32* %2
br label %25
24: ; preds = %20
br label %7
25: ; preds = %21, %17
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @seqfile_has_labels(i32* nocapture %0) {
%2 = alloca [30000 x i8]
%3 = getelementptr inbounds [30000 x i8], [30000 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @rewind(i32* %0)
br label %5
5: ; preds = %8, %1
%6 = call i32* @fgets(i8* %3, i32 30000, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 47
br i1 %10, label %11, label %5
11: ; preds = %5, %8
%12 = phi i32 [ 0, %8 ], [ -1, %5 ]
%13 = call i32 @rewind(i32* %0)
ret i32 %12
}