#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 *Mem_Calloc(size_t, char *, int);
int /*<<< orphan*/ Mem_FreadSize_t(size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ Mem_FreadStr(char *, size_t, int /*<<< orphan*/ *);
char *Mem_FgetStr(FILE *fp) {
  size_t len;
  char *buf;
  Mem_FreadSize_t(&len, fp);
  buf = Mem_Calloc((size_t)(len + 1) * sizeof(*(buf)),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/itahsieh/sparx-alpha/"
                   "refs/heads/alpha3.stable/src/memory.c",
                   231);
  Mem_FreadStr(buf, len, fp);
  return buf;
}


x86 assembly (clang, -O0):
<Mem_FgetStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <Mem_FreadSize_t@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
lea    0xea4(%rip),%rsi
mov    $0xe7,%edx
call   1040 <Mem_Calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1050 <Mem_FreadStr@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mem_FgetStr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <Mem_FreadSize_t@plt>
mov    (%rsp),%rdi
add    $0x1,%rdi
lea    0xeaf(%rip),%rsi
mov    $0xe7,%edx
call   1040 <Mem_Calloc@plt>
mov    %rax,%rbx
mov    (%rsp),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <Mem_FreadStr@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/itahsieh/sparx-alpha/refs/heads/alpha3.stable/src/memory.c\00"
define i8* @Mem_FgetStr(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i8*
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @Mem_FreadSize_t(i64* %3, i32* %5)
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = mul i64 %8, 1
%10 = call i8* @Mem_Calloc(i64 %9, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 231)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i64, i64* %3
%13 = load i32*, i32** %2
%14 = call i32 @Mem_FreadStr(i8* %11, i64 %12, i32* %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
@.str = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/itahsieh/sparx-alpha/refs/heads/alpha3.stable/src/memory.c\00"
define i8* @Mem_FgetStr(i32* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @Mem_FreadSize_t(i64* %2, i32* %0)
%5 = load i64, i64* %2
%6 = add i64 %5, 1
%7 = call i8* @Mem_Calloc(i64 %6, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 231)
%8 = load i64, i64* %2
%9 = call i32 @Mem_FreadStr(i8* %7, i64 %8, i32* %0)
ret i8* %7
}