#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__ get_line(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *findLine(FILE *plr_file, char *tag) {
  static char line[5000];
  rewind(plr_file);
  while (get_line(plr_file, line)) {
    if (!strncmp(tag, line, strlen(tag))) {
      return line + strlen(tag);
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<findLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x10(%rbp),%rdi
lea    0x2eec(%rip),%rsi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     11c3 <findLine+0x83>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0x2ebf(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11be <findLine+0x7e>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
movslq %eax,%rcx
lea    0x2e9e(%rip),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    11cb <findLine+0x8b>
jmp    1159 <findLine+0x19>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLine>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1060 <rewind@plt>
lea    0x2ef6(%rip),%rbx
xor    %r15d,%r15d
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <get_line@plt>
test   %rax,%rax
je     1199 <findLine+0x59>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1160 <findLine+0x20>
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%r15
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@findLine.line = internal global [5000 x i8] zeroinitializer
define i8* @findLine(i32* %0, i8* %1) {
%3 = tail call i32 @rewind(i32* %0)
br label %4
4: ; preds = %7, %2
%5 = tail call i64 @get_line(i32* %0, i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @findLine.line, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %1)
%9 = tail call i32 @strncmp(i8* %1, i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @findLine.line, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %7
%12 = tail call i32 @strlen(i8* %1)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5000 x i8], [5000 x i8]* @findLine.line, i64 0, i64 %13
br label %15
15: ; preds = %4, %11
%16 = phi i8* [ %14, %11 ], [ null, %4 ]
ret i8* %16
}