#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 scalar_t__ int64_t;

/* Variables and functions */
int EIO;
int ENOENT;
int ENOMEM;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ logError(char *, int, ...);
scalar_t__ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ malloc(int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
scalar_t__ read(int, char *, scalar_t__);
char *strerror(scalar_t__);
int getFileContent(const char *filename, char **buff, int64_t *file_size) {
  int fd;
  fd = open(filename, O_RDONLY);
  if (fd < 0) {
    *buff = NULL;
    *file_size = 0;
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/shared_func.c"
             ", line: %d, "
             "open file %s fail, "
             "errno: %d, error info: %s",
             986, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : ENOENT;
  }
  if ((*file_size = lseek(fd, 0, SEEK_END)) < 0) {
    *buff = NULL;
    *file_size = 0;
    close(fd);
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/shared_func.c"
             ", line: %d, "
             "lseek file %s fail, "
             "errno: %d, error info: %s",
             998, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : EIO;
  }
  *buff = (char *)malloc(*file_size + 1);
  if (*buff == NULL) {
    *file_size = 0;
    close(fd);
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/shared_func.c"
             ", line: %d, "
             "malloc %d bytes fail",
             1010, (int)(*file_size + 1));
    return errno != 0 ? errno : ENOMEM;
  }
  if (lseek(fd, 0, SEEK_SET) < 0) {
    *buff = NULL;
    *file_size = 0;
    close(fd);
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/shared_func.c"
             ", line: %d, "
             "lseek file %s fail, "
             "errno: %d, error info: %s",
             1022, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : EIO;
  }
  if (read(fd, *buff, *file_size) != *file_size) {
    free(*buff);
    *buff = NULL;
    *file_size = 0;
    close(fd);
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/shared_func.c"
             ", line: %d, "
             "read from file %s fail, "
             "errno: %d, error info: %s",
             1034, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : EIO;
  }
  (*buff)[*file_size] = '\0';
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<getFileContent>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1280 <getFileContent+0x100>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x2de5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    0x2dd7(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
cmp    $0x0,%rax
je     1213 <getFileContent+0x93>
mov    0x2dbe(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,-0x40(%rbp)
jmp    1223 <getFileContent+0xa3>
lea    0xec3(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    1223 <getFileContent+0xa3>
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%r8
lea    0xdca(%rip),%rdi
mov    $0x3da,%esi
mov    $0x0,%al
call   1050 <logError@plt>
mov    0x2d77(%rip),%rax
cmpq   $0x0,(%rax)
je     1266 <getFileContent+0xe6>
mov    0x2d66(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    1274 <getFileContent+0xf4>
mov    0x2d3b(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1652 <getFileContent+0x4d2>
mov    -0x24(%rbp),%edi
mov    0x2d5e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jge    1376 <getFileContent+0x1f6>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2cef(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    0x2ce1(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
cmp    $0x0,%rax
je     1309 <getFileContent+0x189>
mov    0x2cc8(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,-0x60(%rbp)
jmp    1319 <getFileContent+0x199>
lea    0xdcd(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    1319 <getFileContent+0x199>
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%r8
lea    0xdbe(%rip),%rdi
mov    $0x3e6,%esi
mov    $0x0,%al
call   1050 <logError@plt>
mov    0x2c81(%rip),%rax
cmpq   $0x0,(%rax)
je     135c <getFileContent+0x1dc>
mov    0x2c70(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    136a <getFileContent+0x1ea>
mov    0x2c6d(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1652 <getFileContent+0x4d2>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1411 <getFileContent+0x291>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %eax,%edx
lea    0xe01(%rip),%rdi
mov    $0x3f2,%esi
mov    $0x0,%al
call   1050 <logError@plt>
mov    0x2be6(%rip),%rax
cmpq   $0x0,(%rax)
je     13f7 <getFileContent+0x277>
mov    0x2bd5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
jmp    1405 <getFileContent+0x285>
mov    0x2bca(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1652 <getFileContent+0x4d2>
mov    -0x24(%rbp),%edi
mov    0x2b9d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
cmp    $0x0,%rax
jge    1512 <getFileContent+0x392>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2b65(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2b57(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
cmp    $0x0,%rax
je     1496 <getFileContent+0x316>
mov    0x2b3e(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,-0x88(%rbp)
jmp    14a9 <getFileContent+0x329>
lea    0xc40(%rip),%rax
mov    %rax,-0x88(%rbp)
jmp    14a9 <getFileContent+0x329>
mov    -0x78(%rbp),%rcx
mov    -0x80(%rbp),%rdx
mov    -0x88(%rbp),%r8
lea    0xc2b(%rip),%rdi
mov    $0x3fe,%esi
mov    $0x0,%al
call   1050 <logError@plt>
mov    0x2aee(%rip),%rax
cmpq   $0x0,(%rax)
je     14f2 <getFileContent+0x372>
mov    0x2add(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
jmp    1503 <getFileContent+0x383>
mov    0x2ad7(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1652 <getFileContent+0x4d2>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
call   1070 <read@plt>
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
je     1631 <getFileContent+0x4b1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2a4f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    0x2a3e(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
cmp    $0x0,%rax
je     15af <getFileContent+0x42f>
mov    0x2a25(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,-0xa8(%rbp)
jmp    15c2 <getFileContent+0x442>
lea    0xb27(%rip),%rax
mov    %rax,-0xa8(%rbp)
jmp    15c2 <getFileContent+0x442>
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%r8
lea    0xcaf(%rip),%rdi
mov    $0x40a,%esi
mov    $0x0,%al
call   1050 <logError@plt>
mov    0x29cf(%rip),%rax
cmpq   $0x0,(%rax)
je     1611 <getFileContent+0x491>
mov    0x29be(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xb0(%rbp)
jmp    1622 <getFileContent+0x4a2>
mov    0x29b8(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1652 <getFileContent+0x4d2>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileContent>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
test   %eax,%eax
js     121e <getFileContent+0x9e>
mov    %eax,%ebp
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %rax,(%rbx)
test   %rax,%rax
js     1259 <getFileContent+0xd9>
add    $0x1,%eax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     129b <getFileContent+0x11b>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <lseek@plt>
test   %rax,%rax
js     1319 <getFileContent+0x199>
mov    (%r15),%rsi
mov    (%rbx),%rdx
mov    %ebp,%edi
call   1070 <read@plt>
mov    (%r15),%rdi
cmp    (%rbx),%rax
jne    1369 <getFileContent+0x1e9>
movb   $0x0,(%rdi,%rax,1)
mov    %ebp,%edi
call   1060 <close@plt>
xor    %eax,%eax
jmp    13f0 <getFileContent+0x270>
movq   $0x0,(%r15)
movq   $0x0,(%rbx)
mov    0x2d8d(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   10a0 <strerror@plt>
test   %rax,%rax
je     12e0 <getFileContent+0x160>
mov    0x0(%rbp),%rdi
call   10a0 <strerror@plt>
mov    %rax,%r8
jmp    12e7 <getFileContent+0x167>
movq   $0x0,(%r15)
movq   $0x0,(%rbx)
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x2d4b(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   10a0 <strerror@plt>
test   %rax,%rax
je     1354 <getFileContent+0x1d4>
mov    0x0(%rbp),%rdi
call   10a0 <strerror@plt>
mov    %rax,%r8
jmp    135b <getFileContent+0x1db>
movq   $0x0,(%rbx)
mov    %ebp,%edi
call   1060 <close@plt>
mov    (%rbx),%edx
add    $0x1,%edx
lea    0xf13(%rip),%rdi
mov    $0x3f2,%esi
xor    %eax,%eax
call   1050 <logError@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%rax
test   %rax,%rax
jne    13f0 <getFileContent+0x270>
mov    0x2ced(%rip),%rax
jmp    13ee <getFileContent+0x26e>
lea    0xdf6(%rip),%r8
lea    0xd12(%rip),%rdi
mov    $0x3da,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <logError@plt>
mov    0x0(%rbp),%rax
test   %rax,%rax
jne    13f0 <getFileContent+0x270>
mov    0x2c94(%rip),%rax
jmp    13ee <getFileContent+0x26e>
movq   $0x0,(%r15)
movq   $0x0,(%rbx)
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x2c8b(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   10a0 <strerror@plt>
test   %rax,%rax
je     13a9 <getFileContent+0x229>
mov    0x0(%rbp),%rdi
call   10a0 <strerror@plt>
mov    %rax,%r8
jmp    13b0 <getFileContent+0x230>
lea    0xd82(%rip),%r8
lea    0xd88(%rip),%rdi
mov    $0x3e6,%esi
jmp    13d1 <getFileContent+0x251>
call   1030 <free@plt>
movq   $0x0,(%r15)
movq   $0x0,(%rbx)
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x2c36(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   10a0 <strerror@plt>
test   %rax,%rax
je     13be <getFileContent+0x23e>
mov    0x0(%rbp),%rdi
call   10a0 <strerror@plt>
mov    %rax,%r8
jmp    13c5 <getFileContent+0x245>
lea    0xd2d(%rip),%r8
lea    0xd33(%rip),%rdi
mov    $0x3fe,%esi
jmp    13d1 <getFileContent+0x251>
lea    0xd18(%rip),%r8
lea    0xec1(%rip),%rdi
mov    $0x40a,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <logError@plt>
mov    0x0(%rbp),%rax
test   %rax,%rax
jne    13f0 <getFileContent+0x270>
mov    0x2be2(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [221 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, open file %s fail, errno: %d, error info: %s\00"
@errno = global i64 0
@.str.1 = [13 x i8] c"Unkown error\00"
@ENOENT = global i32 0
@SEEK_END = global i32 0
@.str.2 = [222 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, lseek file %s fail, errno: %d, error info: %s\00"
@EIO = global i32 0
@.str.3 = [197 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, malloc %d bytes fail\00"
@ENOMEM = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [226 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, read from file %s fail, errno: %d, error info: %s\00"
define i32 @getFileContent(i8* %0, i8** %1, i64* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i64*
%8 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i64* %2, i64** %7
%9 = load i8*, i8** %5
%10 = load i32, i32* @O_RDONLY
%11 = call i32 @open(i8* %9, i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %39
14: ; preds = %3
%15 = load i8**, i8*** %6
store i8* null, i8** %15
%16 = load i64*, i64** %7
store i64 0, i64* %16
%17 = load i8*, i8** %5
%18 = load i64, i64* @errno
%19 = load i64, i64* @errno
%20 = call i8* @strerror(i64 %19)
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i64, i64* @errno
%24 = call i8* @strerror(i64 %23)
br label %26
25: ; preds = %14
br label %26
26: ; preds = %25, %22
%27 = phi i8* [ %24, %22 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %25 ]
%28 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([221 x i8], [221 x i8]* @.str, i64 0, i64 0), i32 986, i8* %17, i64 %18, i8* %27)
%29 = load i64, i64* @errno
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = load i64, i64* @errno
br label %36
33: ; preds = %26
%34 = load i32, i32* @ENOENT
%35 = sext i32 %34 to i64
br label %36
36: ; preds = %33, %31
%37 = phi i64 [ %32, %31 ], [ %35, %33 ]
%38 = trunc i64 %37 to i32
store i32 %38, i32* %4
br label %182
39: ; preds = %3
%40 = load i32, i32* %8
%41 = load i32, i32* @SEEK_END
%42 = call i64 @lseek(i32 %40, i32 0, i32 %41)
%43 = load i64*, i64** %7
store i64 %42, i64* %43
%44 = icmp slt i64 %42, 0
br i1 %44, label %45, label %72
45: ; preds = %39
%46 = load i8**, i8*** %6
store i8* null, i8** %46
%47 = load i64*, i64** %7
store i64 0, i64* %47
%48 = load i32, i32* %8
%49 = call i32 @close(i32 %48)
%50 = load i8*, i8** %5
%51 = load i64, i64* @errno
%52 = load i64, i64* @errno
%53 = call i8* @strerror(i64 %52)
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %58
55: ; preds = %45
%56 = load i64, i64* @errno
%57 = call i8* @strerror(i64 %56)
br label %59
58: ; preds = %45
br label %59
59: ; preds = %58, %55
%60 = phi i8* [ %57, %55 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %58 ]
%61 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.2, i64 0, i64 0), i32 998, i8* %50, i64 %51, i8* %60)
%62 = load i64, i64* @errno
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = load i64, i64* @errno
br label %69
66: ; preds = %59
%67 = load i32, i32* @EIO
%68 = sext i32 %67 to i64
br label %69
69: ; preds = %66, %64
%70 = phi i64 [ %65, %64 ], [ %68, %66 ]
%71 = trunc i64 %70 to i32
store i32 %71, i32* %4
br label %182
72: ; preds = %39
%73 = load i64*, i64** %7
%74 = load i64, i64* %73
%75 = add nsw i64 %74, 1
%76 = trunc i64 %75 to i32
%77 = call i64 @malloc(i32 %76)
%78 = inttoptr i64 %77 to i8*
%79 = load i8**, i8*** %6
store i8* %78, i8** %79
%80 = load i8**, i8*** %6
%81 = load i8*, i8** %80
%82 = icmp eq i8* %81, null
br i1 %82, label %83, label %102
83: ; preds = %72
%84 = load i64*, i64** %7
store i64 0, i64* %84
%85 = load i32, i32* %8
%86 = call i32 @close(i32 %85)
%87 = load i64*, i64** %7
%88 = load i64, i64* %87
%89 = add nsw i64 %88, 1
%90 = trunc i64 %89 to i32
%91 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.3, i64 0, i64 0), i32 1010, i32 %90)
%92 = load i64, i64* @errno
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %83
%95 = load i64, i64* @errno
br label %99
96: ; preds = %83
%97 = load i32, i32* @ENOMEM
%98 = sext i32 %97 to i64
br label %99
99: ; preds = %96, %94
%100 = phi i64 [ %95, %94 ], [ %98, %96 ]
%101 = trunc i64 %100 to i32
store i32 %101, i32* %4
br label %182
102: ; preds = %72
%103 = load i32, i32* %8
%104 = load i32, i32* @SEEK_SET
%105 = call i64 @lseek(i32 %103, i32 0, i32 %104)
%106 = icmp slt i64 %105, 0
br i1 %106, label %107, label %134
107: ; preds = %102
%108 = load i8**, i8*** %6
store i8* null, i8** %108
%109 = load i64*, i64** %7
store i64 0, i64* %109
%110 = load i32, i32* %8
%111 = call i32 @close(i32 %110)
%112 = load i8*, i8** %5
%113 = load i64, i64* @errno
%114 = load i64, i64* @errno
%115 = call i8* @strerror(i64 %114)
%116 = icmp ne i8* %115, null
br i1 %116, label %117, label %120
117: ; preds = %107
%118 = load i64, i64* @errno
%119 = call i8* @strerror(i64 %118)
br label %121
120: ; preds = %107
br label %121
121: ; preds = %120, %117
%122 = phi i8* [ %119, %117 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %120 ]
%123 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.2, i64 0, i64 0), i32 1022, i8* %112, i64 %113, i8* %122)
%124 = load i64, i64* @errno
%125 = icmp ne i64 %124, 0
br i1 %125, label %126, label %128
126: ; preds = %121
%127 = load i64, i64* @errno
br label %131
128: ; preds = %121
%129 = load i32, i32* @EIO
%130 = sext i32 %129 to i64
br label %131
131: ; preds = %128, %126
%132 = phi i64 [ %127, %126 ], [ %130, %128 ]
%133 = trunc i64 %132 to i32
store i32 %133, i32* %4
br label %182
134: ; preds = %102
%135 = load i32, i32* %8
%136 = load i8**, i8*** %6
%137 = load i8*, i8** %136
%138 = load i64*, i64** %7
%139 = load i64, i64* %138
%140 = call i64 @read(i32 %135, i8* %137, i64 %139)
%141 = load i64*, i64** %7
%142 = load i64, i64* %141
%143 = icmp ne i64 %140, %142
br i1 %143, label %144, label %174
144: ; preds = %134
%145 = load i8**, i8*** %6
%146 = load i8*, i8** %145
%147 = call i32 @free(i8* %146)
%148 = load i8**, i8*** %6
store i8* null, i8** %148
%149 = load i64*, i64** %7
store i64 0, i64* %149
%150 = load i32, i32* %8
%151 = call i32 @close(i32 %150)
%152 = load i8*, i8** %5
%153 = load i64, i64* @errno
%154 = load i64, i64* @errno
%155 = call i8* @strerror(i64 %154)
%156 = icmp ne i8* %155, null
br i1 %156, label %157, label %160
157: ; preds = %144
%158 = load i64, i64* @errno
%159 = call i8* @strerror(i64 %158)
br label %161
160: ; preds = %144
br label %161
161: ; preds = %160, %157
%162 = phi i8* [ %159, %157 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %160 ]
%163 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([226 x i8], [226 x i8]* @.str.4, i64 0, i64 0), i32 1034, i8* %152, i64 %153, i8* %162)
%164 = load i64, i64* @errno
%165 = icmp ne i64 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %161
%167 = load i64, i64* @errno
br label %171
168: ; preds = %161
%169 = load i32, i32* @EIO
%170 = sext i32 %169 to i64
br label %171
171: ; preds = %168, %166
%172 = phi i64 [ %167, %166 ], [ %170, %168 ]
%173 = trunc i64 %172 to i32
store i32 %173, i32* %4
br label %182
174: ; preds = %134
%175 = load i8**, i8*** %6
%176 = load i8*, i8** %175
%177 = load i64*, i64** %7
%178 = load i64, i64* %177
%179 = getelementptr inbounds i8, i8* %176, i64 %178
store i8 0, i8* %179
%180 = load i32, i32* %8
%181 = call i32 @close(i32 %180)
store i32 0, i32* %4
br label %182
182: ; preds = %174, %171, %131, %99, %69, %36
%183 = load i32, i32* %4
ret i32 %183
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [221 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, open file %s fail, errno: %d, error info: %s\00"
@errno = global i64 0
@.str.1 = [13 x i8] c"Unkown error\00"
@ENOENT = global i32 0
@SEEK_END = global i32 0
@.str.2 = [222 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, lseek file %s fail, errno: %d, error info: %s\00"
@EIO = global i32 0
@.str.3 = [197 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, malloc %d bytes fail\00"
@ENOMEM = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [226 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/shared_func.c, line: %d, read from file %s fail, errno: %d, error info: %s\00"
define i32 @getFileContent(i8* %0, i8** nocapture %1, i64* nocapture %2) {
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %3
store i8* null, i8** %1
store i64 0, i64* %2
%8 = load i64, i64* @errno
%9 = tail call i8* @strerror(i64 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = load i64, i64* @errno
%13 = tail call i8* @strerror(i64 %12)
br label %14
14: ; preds = %7, %11
%15 = phi i8* [ %13, %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %7 ]
%16 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([221 x i8], [221 x i8]* @.str, i64 0, i64 0), i32 986, i8* %0, i64 %8, i8* %15)
%17 = load i64, i64* @errno
%18 = icmp eq i64 %17, 0
%19 = load i32, i32* @ENOENT
%20 = zext i32 %19 to i64
%21 = select i1 %18, i64 %20, i64 %17
%22 = trunc i64 %21 to i32
br label %111
23: ; preds = %3
%24 = load i32, i32* @SEEK_END
%25 = tail call i64 @lseek(i32 %5, i32 0, i32 %24)
store i64 %25, i64* %2
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %44
27: ; preds = %23
store i8* null, i8** %1
store i64 0, i64* %2
%28 = tail call i32 @close(i32 %5)
%29 = load i64, i64* @errno
%30 = tail call i8* @strerror(i64 %29)
%31 = icmp eq i8* %30, null
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = load i64, i64* @errno
%34 = tail call i8* @strerror(i64 %33)
br label %35
35: ; preds = %27, %32
%36 = phi i8* [ %34, %32 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %27 ]
%37 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.2, i64 0, i64 0), i32 998, i8* %0, i64 %29, i8* %36)
%38 = load i64, i64* @errno
%39 = icmp eq i64 %38, 0
%40 = load i32, i32* @EIO
%41 = zext i32 %40 to i64
%42 = select i1 %39, i64 %41, i64 %38
%43 = trunc i64 %42 to i32
br label %111
44: ; preds = %23
%45 = trunc i64 %25 to i32
%46 = add i32 %45, 1
%47 = tail call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to i8*
store i8* %48, i8** %1
%49 = icmp eq i64 %47, 0
br i1 %49, label %50, label %62
50: ; preds = %44
store i64 0, i64* %2
%51 = tail call i32 @close(i32 %5)
%52 = load i64, i64* %2
%53 = trunc i64 %52 to i32
%54 = add i32 %53, 1
%55 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.3, i64 0, i64 0), i32 1010, i32 %54)
%56 = load i64, i64* @errno
%57 = icmp eq i64 %56, 0
%58 = load i32, i32* @ENOMEM
%59 = zext i32 %58 to i64
%60 = select i1 %57, i64 %59, i64 %56
%61 = trunc i64 %60 to i32
br label %111
62: ; preds = %44
%63 = load i32, i32* @SEEK_SET
%64 = tail call i64 @lseek(i32 %5, i32 0, i32 %63)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %83
66: ; preds = %62
store i8* null, i8** %1
store i64 0, i64* %2
%67 = tail call i32 @close(i32 %5)
%68 = load i64, i64* @errno
%69 = tail call i8* @strerror(i64 %68)
%70 = icmp eq i8* %69, null
br i1 %70, label %74, label %71
71: ; preds = %66
%72 = load i64, i64* @errno
%73 = tail call i8* @strerror(i64 %72)
br label %74
74: ; preds = %66, %71
%75 = phi i8* [ %73, %71 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %66 ]
%76 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.2, i64 0, i64 0), i32 1022, i8* %0, i64 %68, i8* %75)
%77 = load i64, i64* @errno
%78 = icmp eq i64 %77, 0
%79 = load i32, i32* @EIO
%80 = zext i32 %79 to i64
%81 = select i1 %78, i64 %80, i64 %77
%82 = trunc i64 %81 to i32
br label %111
83: ; preds = %62
%84 = load i8*, i8** %1
%85 = load i64, i64* %2
%86 = tail call i64 @read(i32 %5, i8* %84, i64 %85)
%87 = load i64, i64* %2
%88 = icmp eq i64 %86, %87
%89 = load i8*, i8** %1
br i1 %88, label %108, label %90
90: ; preds = %83
%91 = tail call i32 @free(i8* %89)
store i8* null, i8** %1
store i64 0, i64* %2
%92 = tail call i32 @close(i32 %5)
%93 = load i64, i64* @errno
%94 = tail call i8* @strerror(i64 %93)
%95 = icmp eq i8* %94, null
br i1 %95, label %99, label %96
96: ; preds = %90
%97 = load i64, i64* @errno
%98 = tail call i8* @strerror(i64 %97)
br label %99
99: ; preds = %90, %96
%100 = phi i8* [ %98, %96 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %90 ]
%101 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([226 x i8], [226 x i8]* @.str.4, i64 0, i64 0), i32 1034, i8* %0, i64 %93, i8* %100)
%102 = load i64, i64* @errno
%103 = icmp eq i64 %102, 0
%104 = load i32, i32* @EIO
%105 = zext i32 %104 to i64
%106 = select i1 %103, i64 %105, i64 %102
%107 = trunc i64 %106 to i32
br label %111
108: ; preds = %83
%109 = getelementptr inbounds i8, i8* %89, i64 %86
store i8 0, i8* %109
%110 = tail call i32 @close(i32 %5)
br label %111
111: ; preds = %108, %99, %74, %50, %35, %14
%112 = phi i32 [ %22, %14 ], [ %43, %35 ], [ %61, %50 ], [ %82, %74 ], [ %107, %99 ], [ 0, %108 ]
ret i32 %112
}