#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*/ SEEK_SET;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int strlen(char *);
void ReadFileLine(FILE *Handle, unsigned int Line, char *String) {
  unsigned int i;
  fseek(Handle, 0, SEEK_SET);
  for (i = 0; i < Line; i++)
    fgets(String, 256, Handle);
  String[strlen(String) - 1] = '\0';
}


x86 assembly (clang, -O0):
<ReadFileLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    118a <ReadFileLine+0x5a>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115e <ReadFileLine+0x2e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadFileLine>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
test   %ebp,%ebp
je     1165 <ReadFileLine+0x35>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
add    $0xffffffff,%ebp
jne    1150 <ReadFileLine+0x20>
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @ReadFileLine(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32*, i32** %4
%9 = load i32, i32* @SEEK_SET
%10 = call i32 @fseek(i32* %8, i32 0, i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %19, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32*, i32** %4
%18 = call i32 @fgets(i8* %16, i32 256, i32* %17)
br label %19
19: ; preds = %15
%20 = load i32, i32* %7
%21 = add i32 %20, 1
store i32 %21, i32* %7
br label %11
22: ; preds = %11
%23 = load i8*, i8** %6
%24 = load i8*, i8** %6
%25 = call i32 @strlen(i8* %24)
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %23, i64 %27
store i8 0, i8* %28
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @ReadFileLine(i32* nocapture %0, i32 %1, i8* %2) {
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @fseek(i32* %0, i32 0, i32 %4)
%6 = icmp eq i32 %1, 0
br i1 %6, label %12, label %7
7: ; preds = %3, %7
%8 = phi i32 [ %10, %7 ], [ 0, %3 ]
%9 = tail call i32 @fgets(i8* %2, i32 256, i32* %0)
%10 = add nuw i32 %8, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %12, label %7
12: ; preds = %7, %3
%13 = tail call i32 @strlen(i8* %2)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %2, i64 %15
store i8 0, i8* %16
ret void
}