#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ str_cmp(char *, char *);
int _fio_read_header(FILE *fp, char *fname, char *buf) {
  char *sbuf = buf;
  while ((*buf = fgetc(fp)) != 0x0D)
    buf++;
  *buf = '\0';
  if (str_cmp(sbuf, fname))
    return -1;
  buf = sbuf;
  while ((*buf = fgetc(fp)) != 0x0D)
    buf++;
  *buf = '\0';
  buf = sbuf;
  while ((*buf = fgetc(fp)) != 0x0D)
    buf++;
  *buf = '\0';
  if (str_cmp(sbuf, "10")) {
    printf("Hash Size (%s != %s), ", sbuf, "10");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<_fio_read_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    -0x20(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0xd,%eax
je     1178 <_fio_read_header+0x48>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114c <_fio_read_header+0x1c>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <str_cmp@plt>
cmp    $0x0,%rax
je     11a2 <_fio_read_header+0x72>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <_fio_read_header+0x12c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    -0x20(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0xd,%eax
je     11d6 <_fio_read_header+0xa6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11aa <_fio_read_header+0x7a>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    -0x20(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0xd,%eax
je     1211 <_fio_read_header+0xe1>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11e5 <_fio_read_header+0xb5>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1030 <str_cmp@plt>
cmp    $0x0,%rax
je     1255 <_fio_read_header+0x125>
mov    -0x28(%rbp),%rsi
lea    0xdc6(%rip),%rdi
lea    0xdbc(%rip),%rdx
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    125c <_fio_read_header+0x12c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fio_read_header>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rdx,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xd,%al
jne    1150 <_fio_read_header+0x20>
movb   $0x0,-0x1(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <str_cmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    11f9 <_fio_read_header+0xc9>
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xd,%al
jne    1190 <_fio_read_header+0x60>
movb   $0x0,-0x1(%rbx)
mov    %r14,%rbx
nopl   0x0(%rax)
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xd,%al
jne    11b0 <_fio_read_header+0x80>
movb   $0x0,-0x1(%rbx)
lea    0xe33(%rip),%rsi
mov    %r14,%rdi
call   1030 <str_cmp@plt>
test   %rax,%rax
je     11f4 <_fio_read_header+0xc4>
lea    0xe22(%rip),%rdi
lea    0xe18(%rip),%rdx
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11f9 <_fio_read_header+0xc9>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"10\00"
@.str.1 = [23 x i8] c"Hash Size (%s != %s), \00"
define i32 @_fio_read_header(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %7
store i8* %9, i8** %8
br label %10
10: ; preds = %16, %3
%11 = load i32*, i32** %5
%12 = call signext i8 @fgetc(i32* %11)
%13 = load i8*, i8** %7
store i8 %12, i8* %13
%14 = sext i8 %12 to i32
%15 = icmp ne i32 %14, 13
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %7
br label %10
19: ; preds = %10
%20 = load i8*, i8** %7
store i8 0, i8* %20
%21 = load i8*, i8** %8
%22 = load i8*, i8** %6
%23 = call i64 @str_cmp(i8* %21, i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 -1, i32* %4
br label %58
26: ; preds = %19
%27 = load i8*, i8** %8
store i8* %27, i8** %7
br label %28
28: ; preds = %34, %26
%29 = load i32*, i32** %5
%30 = call signext i8 @fgetc(i32* %29)
%31 = load i8*, i8** %7
store i8 %30, i8* %31
%32 = sext i8 %30 to i32
%33 = icmp ne i32 %32, 13
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %7
br label %28
37: ; preds = %28
%38 = load i8*, i8** %7
store i8 0, i8* %38
%39 = load i8*, i8** %8
store i8* %39, i8** %7
br label %40
40: ; preds = %46, %37
%41 = load i32*, i32** %5
%42 = call signext i8 @fgetc(i32* %41)
%43 = load i8*, i8** %7
store i8 %42, i8* %43
%44 = sext i8 %42 to i32
%45 = icmp ne i32 %44, 13
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = load i8*, i8** %7
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %7
br label %40
49: ; preds = %40
%50 = load i8*, i8** %7
store i8 0, i8* %50
%51 = load i8*, i8** %8
%52 = call i64 @str_cmp(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = load i8*, i8** %8
%56 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %58
57: ; preds = %49
store i32 1, i32* %4
br label %58
58: ; preds = %57, %54, %25
%59 = load i32, i32* %4
ret i32 %59
}

LLVM IR (-O2):
@.str = [3 x i8] c"10\00"
@.str.1 = [23 x i8] c"Hash Size (%s != %s), \00"
define i32 @_fio_read_header(i32* nocapture %0, i8* %1, i8* %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i8* [ %2, %3 ], [ %8, %4 ]
%6 = tail call signext i8 @fgetc(i32* %0)
store i8 %6, i8* %5
%7 = icmp eq i8 %6, 13
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %9, label %4
9: ; preds = %4
store i8 0, i8* %5
%10 = tail call i64 @str_cmp(i8* %2, i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %9, %12
%13 = phi i8* [ %16, %12 ], [ %2, %9 ]
%14 = tail call signext i8 @fgetc(i32* %0)
store i8 %14, i8* %13
%15 = icmp eq i8 %14, 13
%16 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %15, label %17, label %12
17: ; preds = %12
store i8 0, i8* %13
br label %18
18: ; preds = %18, %17
%19 = phi i8* [ %2, %17 ], [ %22, %18 ]
%20 = tail call signext i8 @fgetc(i32* %0)
store i8 %20, i8* %19
%21 = icmp eq i8 %20, 13
%22 = getelementptr inbounds i8, i8* %19, i64 1
br i1 %21, label %23, label %18
23: ; preds = %18
store i8 0, i8* %19
%24 = tail call i64 @str_cmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %23, %9, %26
%29 = phi i32 [ 0, %26 ], [ -1, %9 ], [ 1, %23 ]
ret i32 %29
}