#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*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int FileUtil_nextPrefixedLine(FILE *fp, char *string, char *line) {
  int lenString = strlen(string);
  fgets(line, 1024, fp);
  while (!feof(fp)) {
    if (!strncmp(line, string, lenString)) {
      return 1;
    }
    fgets(line, 1024, fp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<FileUtil_nextPrefixedLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1190 <FileUtil_nextPrefixedLine+0x50>
jmp    11cc <FileUtil_nextPrefixedLine+0x8c>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11b5 <FileUtil_nextPrefixedLine+0x75>
movl   $0x1,-0x4(%rbp)
jmp    11d3 <FileUtil_nextPrefixedLine+0x93>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
jmp    1172 <FileUtil_nextPrefixedLine+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileUtil_nextPrefixedLine>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
xor    %r12d,%r12d
test   %eax,%eax
jne    11b5 <FileUtil_nextPrefixedLine+0x75>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11af <FileUtil_nextPrefixedLine+0x6f>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     1180 <FileUtil_nextPrefixedLine+0x40>
jmp    11b5 <FileUtil_nextPrefixedLine+0x75>
mov    $0x1,%r12d
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @FileUtil_nextPrefixedLine(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %8
%11 = load i8*, i8** %7
%12 = load i32*, i32** %5
%13 = call i32 @fgets(i8* %11, i32 1024, i32* %12)
br label %14
14: ; preds = %26, %3
%15 = load i32*, i32** %5
%16 = call i32 @feof(i32* %15)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
br i1 %18, label %19, label %30
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = call i32 @strncmp(i8* %20, i8* %21, i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %19
store i32 1, i32* %4
br label %31
26: ; preds = %19
%27 = load i8*, i8** %7
%28 = load i32*, i32** %5
%29 = call i32 @fgets(i8* %27, i32 1024, i32* %28)
br label %14
30: ; preds = %14
store i32 0, i32* %4
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @FileUtil_nextPrefixedLine(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 @fgets(i8* %2, i32 1024, i32* %0)
%6 = tail call i32 @feof(i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %3, %11
%9 = tail call i32 @strncmp(i8* %2, i8* %1, i32 %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @fgets(i8* %2, i32 1024, i32* %0)
%13 = tail call i32 @feof(i32* %0)
%14 = icmp eq i32 %13, 0
br i1 %14, label %8, label %15
15: ; preds = %8, %11, %3
%16 = phi i32 [ 0, %3 ], [ 0, %11 ], [ 1, %8 ]
ret i32 %16
}