#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*/ *);
scalar_t__ strncmp(char *, char *, int);
int readhmm_check(FILE *hmmfile) {
  char s[500];
  int filetype;
  filetype = 0;
  while (fgets(s, 500, hmmfile) != NULL) {
    if (strncmp(s, "NR OF ALPHABETS:", 16) == 0) {
      filetype = 1;
      break;
    } else if (strncmp(s, "ALPHABET LENGTH:", 16) == 0) {
      filetype = 0;
      break;
    }
  }
  rewind(hmmfile);
  return filetype;
}


x86 assembly (clang, -O0):
<readhmm_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x204(%rbp)
lea    -0x200(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x1f4,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11d4 <readhmm_check+0xa4>
lea    -0x200(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1199 <readhmm_check+0x69>
movl   $0x1,-0x204(%rbp)
jmp    11d4 <readhmm_check+0xa4>
lea    -0x200(%rbp),%rdi
lea    0xe6a(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ca <readhmm_check+0x9a>
movl   $0x0,-0x204(%rbp)
jmp    11d4 <readhmm_check+0xa4>
jmp    11cf <readhmm_check+0x9f>
jmp    1149 <readhmm_check+0x19>
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x204(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readhmm_check>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
lea    0xeb4(%rip),%r15
lea    0xebe(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11a6 <readhmm_check+0x76>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a1 <readhmm_check+0x71>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1160 <readhmm_check+0x30>
jmp    11a6 <readhmm_check+0x76>
mov    $0x1,%ebp
mov    %r14,%rdi
call   1040 <rewind@plt>
mov    %ebp,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"NR OF ALPHABETS:\00"
@.str.1 = [17 x i8] c"ALPHABET LENGTH:\00"
define i32 @readhmm_check(i32* %0) {
%2 = alloca i32*
%3 = alloca [500 x i8]
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %21, %1
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32* @fgets(i8* %6, i32 500, i32* %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %22
10: ; preds = %5
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%12 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %4
br label %22
15: ; preds = %10
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 0, i32* %4
br label %22
20: ; preds = %15
br label %21
21: ; preds = %20
br label %5
22: ; preds = %19, %14, %5
%23 = load i32*, i32** %2
%24 = call i32 @rewind(i32* %23)
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@.str = [17 x i8] c"NR OF ALPHABETS:\00"
@.str.1 = [17 x i8] c"ALPHABET LENGTH:\00"
define i32 @readhmm_check(i32* nocapture %0) {
%2 = alloca [500 x i8]
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %10, %1
%5 = call i32* @fgets(i8* %3, i32 500, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 16)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %10, %7, %4
%14 = phi i32 [ 0, %4 ], [ 1, %7 ], [ 0, %10 ]
%15 = call i32 @rewind(i32* %0)
ret i32 %14
}