#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__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int check_version(FILE *fp) {
  char c;
  while (1) {
    fread(&c, 1, 1, fp);
    if (c == '1') {
      fread(&c, 1, 1, fp);
      if (c == '.') {
        fread(&c, 1, 1, fp);
        if (c == '7') {
          fread(&c, 1, 1, fp);
          if (c == '.') {
            return 1;
          }
        }
      }
    }
    if (feof(fp)) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x31,%eax
jne    11cb <check_version+0xab>
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
jne    11c6 <check_version+0xa6>
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x37,%eax
jne    11c1 <check_version+0xa1>
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
jne    11bc <check_version+0x9c>
movl   $0x1,-0x4(%rbp)
jmp    11ef <check_version+0xcf>
jmp    11c1 <check_version+0xa1>
jmp    11c6 <check_version+0xa6>
jmp    11cb <check_version+0xab>
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     11e3 <check_version+0xc3>
jmp    11e8 <check_version+0xc8>
jmp    112c <check_version+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_version>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf(%rsp),%r14
mov    $0x1,%ebp
jmp    114d <check_version+0x2d>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %rax,%rax
jne    11bf <check_version+0x9f>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmpb   $0x31,0xf(%rsp)
jne    1140 <check_version+0x20>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmpb   $0x2e,0xf(%rsp)
jne    1140 <check_version+0x20>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmpb   $0x37,0xf(%rsp)
jne    1140 <check_version+0x20>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmpb   $0x2e,0xf(%rsp)
jne    1140 <check_version+0x20>
jmp    11c1 <check_version+0xa1>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_version(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
br label %5
5: ; preds = %1, %38
%6 = load i32*, i32** %3
%7 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %6)
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 49
br i1 %10, label %11, label %33
11: ; preds = %5
%12 = load i32*, i32** %3
%13 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %12)
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 46
br i1 %16, label %17, label %32
17: ; preds = %11
%18 = load i32*, i32** %3
%19 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %18)
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 55
br i1 %22, label %23, label %31
23: ; preds = %17
%24 = load i32*, i32** %3
%25 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %24)
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 46
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %2
br label %40
30: ; preds = %23
br label %31
31: ; preds = %30, %17
br label %32
32: ; preds = %31, %11
br label %33
33: ; preds = %32, %5
%34 = load i32*, i32** %3
%35 = call i64 @feof(i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
br label %39
38: ; preds = %33
br label %5
39: ; preds = %37
store i32 0, i32* %2
br label %40
40: ; preds = %39, %29
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @check_version(i32* nocapture %0) {
%2 = alloca i8
br label %3
3: ; preds = %19, %1
%4 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 49
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%9 = load i8, i8* %2
%10 = icmp eq i8 %9, 46
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%13 = load i8, i8* %2
%14 = icmp eq i8 %13, 55
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%17 = load i8, i8* %2
%18 = icmp eq i8 %17, 46
br i1 %18, label %22, label %19
19: ; preds = %7, %15, %11, %3
%20 = tail call i64 @feof(i32* %0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %3, label %22
22: ; preds = %19, %15
%23 = phi i32 [ 1, %15 ], [ 0, %19 ]
ret i32 %23
}