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

/* Variables and functions */
int EINVAL;
int EIO;
int ENOENT;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ logError(char *, int, ...);
scalar_t__ lseek(int, int, int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
int read(int, char *, int);
char *strerror(scalar_t__);
int getFileContentEx(const char *filename, char *buff, int64_t offset,
                     int64_t *size) {
  int fd;
  int read_bytes;
  if (*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, "
             "invalid size: "
             "%lld",
             1056, *size);
    return EINVAL;
  }
  fd = open(filename, O_RDONLY);
  if (fd < 0) {
    *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",
             1066, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : ENOENT;
  }
  if (offset > 0 && lseek(fd, offset, SEEK_SET) < 0) {
    *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",
             1077, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : EIO;
  }
  if ((read_bytes = read(fd, buff, *size)) < 0) {
    *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",
             1088, filename, errno,
             (strerror(errno) != NULL ? strerror(errno) : "Unkown error"));
    return errno != 0 ? errno : EIO;
  }
  *size = read_bytes;
  *(buff + (*size)) = '\0';
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<getFileContentEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jg     11b1 <getFileContentEx+0x51>
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
lea    0xe6c(%rip),%rdi
mov    $0x420,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1499 <getFileContentEx+0x339>
mov    -0x10(%rbp),%rdi
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    128e <getFileContentEx+0x12e>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2de7(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2dd9(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
cmp    $0x0,%rax
je     1221 <getFileContentEx+0xc1>
mov    0x2dc0(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
mov    %rax,-0x48(%rbp)
jmp    1231 <getFileContentEx+0xd1>
lea    0xf78(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1231 <getFileContentEx+0xd1>
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%r8
lea    0xe7f(%rip),%rdi
mov    $0x42a,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2d79(%rip),%rax
cmpq   $0x0,(%rax)
je     1274 <getFileContentEx+0x114>
mov    0x2d68(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1282 <getFileContentEx+0x122>
mov    0x2d35(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1499 <getFileContentEx+0x339>
cmpl   $0x0,-0x1c(%rbp)
jle    137c <getFileContentEx+0x21c>
mov    -0x2c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2d23(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
cmp    $0x0,%rax
jge    137c <getFileContentEx+0x21c>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2cf9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    0x2ceb(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
cmp    $0x0,%rax
je     130f <getFileContentEx+0x1af>
mov    0x2cd2(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
mov    %rax,-0x68(%rbp)
jmp    131f <getFileContentEx+0x1bf>
lea    0xe8a(%rip),%rax
mov    %rax,-0x68(%rbp)
jmp    131f <getFileContentEx+0x1bf>
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%r8
lea    0xe7b(%rip),%rdi
mov    $0x435,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2c8b(%rip),%rax
cmpq   $0x0,(%rax)
je     1362 <getFileContentEx+0x202>
mov    0x2c7a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
jmp    1370 <getFileContentEx+0x210>
mov    0x2c6f(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1499 <getFileContentEx+0x339>
mov    -0x2c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
call   1060 <read@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
jge    1472 <getFileContentEx+0x312>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2c15(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2c07(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
cmp    $0x0,%rax
je     13f6 <getFileContentEx+0x296>
mov    0x2bee(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
mov    %rax,-0x88(%rbp)
jmp    1409 <getFileContentEx+0x2a9>
lea    0xda3(%rip),%rax
mov    %rax,-0x88(%rbp)
jmp    1409 <getFileContentEx+0x2a9>
mov    -0x78(%rbp),%rcx
mov    -0x80(%rbp),%rdx
mov    -0x88(%rbp),%r8
lea    0xe6c(%rip),%rdi
mov    $0x440,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2b9e(%rip),%rax
cmpq   $0x0,(%rax)
je     1452 <getFileContentEx+0x2f2>
mov    0x2b8d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
jmp    1463 <getFileContentEx+0x303>
mov    0x2b7f(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1499 <getFileContentEx+0x339>
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileContentEx>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    (%rcx),%edx
test   %edx,%edx
jle    11d7 <getFileContentEx+0x77>
mov    %rcx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
test   %eax,%eax
js     11f6 <getFileContentEx+0x96>
mov    %eax,%r12d
test   %ebp,%ebp
jle    11ae <getFileContentEx+0x4e>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %ebp,%esi
call   1030 <lseek@plt>
test   %rax,%rax
js     1256 <getFileContentEx+0xf6>
mov    (%rbx),%edx
mov    %r12d,%edi
mov    %r15,%rsi
call   1060 <read@plt>
test   %eax,%eax
js     1222 <getFileContentEx+0xc2>
mov    %eax,(%rbx)
mov    %eax,%eax
movb   $0x0,(%r15,%rax,1)
mov    %r12d,%edi
call   1050 <close@plt>
xor    %eax,%eax
jmp    1303 <getFileContentEx+0x1a3>
lea    0xe22(%rip),%rdi
mov    $0x420,%esi
xor    %eax,%eax
call   1040 <logError@plt>
mov    0x2dcf(%rip),%rax
jmp    1301 <getFileContentEx+0x1a1>
movl   $0x0,(%rbx)
mov    0x2dcd(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   1080 <strerror@plt>
test   %rax,%rax
je     128a <getFileContentEx+0x12a>
mov    0x0(%rbp),%rdi
call   1080 <strerror@plt>
mov    %rax,%r8
jmp    1291 <getFileContentEx+0x131>
movl   $0x0,(%rbx)
mov    %r12d,%edi
call   1050 <close@plt>
mov    0x2d99(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   1080 <strerror@plt>
test   %rax,%rax
je     12bc <getFileContentEx+0x15c>
mov    0x0(%rbp),%rdi
call   1080 <strerror@plt>
mov    %rax,%r8
jmp    12c3 <getFileContentEx+0x163>
movl   $0x0,(%rbx)
mov    %r12d,%edi
call   1050 <close@plt>
mov    0x2d65(%rip),%rbp
mov    0x0(%rbp),%rbx
mov    %rbx,%rdi
call   1080 <strerror@plt>
test   %rax,%rax
je     12d1 <getFileContentEx+0x171>
mov    0x0(%rbp),%rdi
call   1080 <strerror@plt>
mov    %rax,%r8
jmp    12d8 <getFileContentEx+0x178>
lea    0xf0f(%rip),%r8
lea    0xe2b(%rip),%rdi
mov    $0x42a,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <logError@plt>
mov    0x0(%rbp),%rax
test   %rax,%rax
jne    1303 <getFileContentEx+0x1a3>
mov    0x2cf6(%rip),%rax
jmp    1301 <getFileContentEx+0x1a1>
lea    0xedd(%rip),%r8
lea    0xfc1(%rip),%rdi
mov    $0x440,%esi
jmp    12e4 <getFileContentEx+0x184>
lea    0xec8(%rip),%r8
lea    0xece(%rip),%rdi
mov    $0x435,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <logError@plt>
mov    0x0(%rbp),%rax
test   %rax,%rax
jne    1303 <getFileContentEx+0x1a3>
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [195 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, invalid size: %lld\00"
@EINVAL = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [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.2 = [13 x i8] c"Unkown error\00"
@ENOENT = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [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.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 @getFileContentEx(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%12 = load i32*, i32** %9
%13 = load i32, i32* %12
%14 = icmp sle i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %4
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 1056, i32 %17)
%19 = load i32, i32* @EINVAL
store i32 %19, i32* %5
br label %128
20: ; preds = %4
%21 = load i8*, i8** %6
%22 = load i32, i32* @O_RDONLY
%23 = call i32 @open(i8* %21, i32 %22)
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %50
26: ; preds = %20
%27 = load i32*, i32** %9
store i32 0, i32* %27
%28 = load i8*, i8** %6
%29 = load i64, i64* @errno
%30 = load i64, i64* @errno
%31 = call i8* @strerror(i64 %30)
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = load i64, i64* @errno
%35 = call i8* @strerror(i64 %34)
br label %37
36: ; preds = %26
br label %37
37: ; preds = %36, %33
%38 = phi i8* [ %35, %33 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %36 ]
%39 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([221 x i8], [221 x i8]* @.str.1, i64 0, i64 0), i32 1066, i8* %28, i64 %29, i8* %38)
%40 = load i64, i64* @errno
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = load i64, i64* @errno
br label %47
44: ; preds = %37
%45 = load i32, i32* @ENOENT
%46 = sext i32 %45 to i64
br label %47
47: ; preds = %44, %42
%48 = phi i64 [ %43, %42 ], [ %46, %44 ]
%49 = trunc i64 %48 to i32
store i32 %49, i32* %5
br label %128
50: ; preds = %20
%51 = load i32, i32* %8
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %85
53: ; preds = %50
%54 = load i32, i32* %10
%55 = load i32, i32* %8
%56 = load i32, i32* @SEEK_SET
%57 = call i64 @lseek(i32 %54, i32 %55, i32 %56)
%58 = icmp slt i64 %57, 0
br i1 %58, label %59, label %85
59: ; preds = %53
%60 = load i32*, i32** %9
store i32 0, i32* %60
%61 = load i32, i32* %10
%62 = call i32 @close(i32 %61)
%63 = load i8*, i8** %6
%64 = load i64, i64* @errno
%65 = load i64, i64* @errno
%66 = call i8* @strerror(i64 %65)
%67 = icmp ne i8* %66, null
br i1 %67, label %68, label %71
68: ; preds = %59
%69 = load i64, i64* @errno
%70 = call i8* @strerror(i64 %69)
br label %72
71: ; preds = %59
br label %72
72: ; preds = %71, %68
%73 = phi i8* [ %70, %68 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %71 ]
%74 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.3, i64 0, i64 0), i32 1077, i8* %63, i64 %64, i8* %73)
%75 = load i64, i64* @errno
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %72
%78 = load i64, i64* @errno
br label %82
79: ; preds = %72
%80 = load i32, i32* @EIO
%81 = sext i32 %80 to i64
br label %82
82: ; preds = %79, %77
%83 = phi i64 [ %78, %77 ], [ %81, %79 ]
%84 = trunc i64 %83 to i32
store i32 %84, i32* %5
br label %128
85: ; preds = %53, %50
%86 = load i32, i32* %10
%87 = load i8*, i8** %7
%88 = load i32*, i32** %9
%89 = load i32, i32* %88
%90 = call i32 @read(i32 %86, i8* %87, i32 %89)
store i32 %90, i32* %11
%91 = icmp slt i32 %90, 0
br i1 %91, label %92, label %118
92: ; preds = %85
%93 = load i32*, i32** %9
store i32 0, i32* %93
%94 = load i32, i32* %10
%95 = call i32 @close(i32 %94)
%96 = load i8*, i8** %6
%97 = load i64, i64* @errno
%98 = load i64, i64* @errno
%99 = call i8* @strerror(i64 %98)
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %104
101: ; preds = %92
%102 = load i64, i64* @errno
%103 = call i8* @strerror(i64 %102)
br label %105
104: ; preds = %92
br label %105
105: ; preds = %104, %101
%106 = phi i8* [ %103, %101 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %104 ]
%107 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([226 x i8], [226 x i8]* @.str.4, i64 0, i64 0), i32 1088, i8* %96, i64 %97, i8* %106)
%108 = load i64, i64* @errno
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %105
%111 = load i64, i64* @errno
br label %115
112: ; preds = %105
%113 = load i32, i32* @EIO
%114 = sext i32 %113 to i64
br label %115
115: ; preds = %112, %110
%116 = phi i64 [ %111, %110 ], [ %114, %112 ]
%117 = trunc i64 %116 to i32
store i32 %117, i32* %5
br label %128
118: ; preds = %85
%119 = load i32, i32* %11
%120 = load i32*, i32** %9
store i32 %119, i32* %120
%121 = load i8*, i8** %7
%122 = load i32*, i32** %9
%123 = load i32, i32* %122
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8, i8* %121, i64 %124
store i8 0, i8* %125
%126 = load i32, i32* %10
%127 = call i32 @close(i32 %126)
store i32 0, i32* %5
br label %128
128: ; preds = %118, %115, %82, %47, %15
%129 = load i32, i32* %5
ret i32 %129
}

LLVM IR (-O2):
@.str = [195 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, invalid size: %lld\00"
@EINVAL = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [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.2 = [13 x i8] c"Unkown error\00"
@ENOENT = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [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.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 @getFileContentEx(i8* %0, i8* nocapture %1, i32 %2, i32* nocapture %3) {
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 1056, i32 %5)
%9 = load i32, i32* @EINVAL
br label %78
10: ; preds = %4
%11 = load i32, i32* @O_RDONLY
%12 = tail call i32 @open(i8* %0, i32 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %10
store i32 0, i32* %3
%15 = load i64, i64* @errno
%16 = tail call i8* @strerror(i64 %15)
%17 = icmp eq i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i64, i64* @errno
%20 = tail call i8* @strerror(i64 %19)
br label %21
21: ; preds = %14, %18
%22 = phi i8* [ %20, %18 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %14 ]
%23 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([221 x i8], [221 x i8]* @.str.1, i64 0, i64 0), i32 1066, i8* %0, i64 %15, i8* %22)
%24 = load i64, i64* @errno
%25 = icmp eq i64 %24, 0
%26 = load i32, i32* @ENOENT
%27 = zext i32 %26 to i64
%28 = select i1 %25, i64 %27, i64 %24
%29 = trunc i64 %28 to i32
br label %78
30: ; preds = %10
%31 = icmp sgt i32 %2, 0
br i1 %31, label %32, label %53
32: ; preds = %30
%33 = load i32, i32* @SEEK_SET
%34 = tail call i64 @lseek(i32 %12, i32 %2, i32 %33)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %53
36: ; preds = %32
store i32 0, i32* %3
%37 = tail call i32 @close(i32 %12)
%38 = load i64, i64* @errno
%39 = tail call i8* @strerror(i64 %38)
%40 = icmp eq i8* %39, null
br i1 %40, label %44, label %41
41: ; preds = %36
%42 = load i64, i64* @errno
%43 = tail call i8* @strerror(i64 %42)
br label %44
44: ; preds = %36, %41
%45 = phi i8* [ %43, %41 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %36 ]
%46 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.3, i64 0, i64 0), i32 1077, i8* %0, i64 %38, i8* %45)
%47 = load i64, i64* @errno
%48 = icmp eq i64 %47, 0
%49 = load i32, i32* @EIO
%50 = zext i32 %49 to i64
%51 = select i1 %48, i64 %50, i64 %47
%52 = trunc i64 %51 to i32
br label %78
53: ; preds = %32, %30
%54 = load i32, i32* %3
%55 = tail call i32 @read(i32 %12, i8* %1, i32 %54)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %74
57: ; preds = %53
store i32 0, i32* %3
%58 = tail call i32 @close(i32 %12)
%59 = load i64, i64* @errno
%60 = tail call i8* @strerror(i64 %59)
%61 = icmp eq i8* %60, null
br i1 %61, label %65, label %62
62: ; preds = %57
%63 = load i64, i64* @errno
%64 = tail call i8* @strerror(i64 %63)
br label %65
65: ; preds = %57, %62
%66 = phi i8* [ %64, %62 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %57 ]
%67 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([226 x i8], [226 x i8]* @.str.4, i64 0, i64 0), i32 1088, i8* %0, i64 %59, i8* %66)
%68 = load i64, i64* @errno
%69 = icmp eq i64 %68, 0
%70 = load i32, i32* @EIO
%71 = zext i32 %70 to i64
%72 = select i1 %69, i64 %71, i64 %68
%73 = trunc i64 %72 to i32
br label %78
74: ; preds = %53
store i32 %55, i32* %3
%75 = zext i32 %55 to i64
%76 = getelementptr inbounds i8, i8* %1, i64 %75
store i8 0, i8* %76
%77 = tail call i32 @close(i32 %12)
br label %78
78: ; preds = %74, %65, %44, %21, %7
%79 = phi i32 [ %9, %7 ], [ %29, %21 ], [ %52, %44 ], [ %73, %65 ], [ 0, %74 ]
ret i32 %79
}