#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 */
void *Evt_data(void *);
scalar_t__ Evt_hdrSize();
scalar_t__ HadTu_paddedSize(void *);
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ errno;
scalar_t__ fread(void *, int, scalar_t__, int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *, int,
                          int /*<<< orphan*/);
void *Evt_fget(FILE *file) {
  static char pool[(1024 * 1024)];
  static void *evt = pool;
  if (Evt_hdrSize() != fread(evt, 1, Evt_hdrSize(), file)) {
    syslog(LOG_DEBUG, "%s:%d: %s",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/desdemonda/cbmroot/refs/heads/master/"
           "fles/trb/daq_anal/evt.c",
           229, strerror(errno));
    return NULL;
  }
  if (HadTu_paddedSize(evt) - Evt_hdrSize() !=
      fread(Evt_data(evt), 1, HadTu_paddedSize(evt) - Evt_hdrSize(), file)) {
    syslog(LOG_ERR, "%s:%d: %s",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/desdemonda/cbmroot/refs/heads/master/"
           "fles/trb/daq_anal/evt.c",
           234, strerror(errno));
    return NULL;
  }
  return evt;
}


x86 assembly (clang, -O0):
<Evt_fget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <Evt_hdrSize@plt>
mov    %rax,-0x18(%rbp)
mov    0x2ed2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <Evt_hdrSize@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     11f3 <Evt_fget+0x93>
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%r8d
lea    0xe2b(%rip),%rsi
lea    0xe2e(%rip),%rdx
mov    $0xe5,%ecx
call   1050 <syslog@plt>
movq   $0x0,-0x8(%rbp)
jmp    12b8 <Evt_fget+0x158>
mov    0x2e56(%rip),%rdi
call   1060 <HadTu_paddedSize@plt>
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1070 <Evt_hdrSize@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    0x2e31(%rip),%rdi
call   1040 <Evt_data@plt>
mov    %rax,-0x38(%rbp)
mov    0x2e21(%rip),%rdi
call   1060 <HadTu_paddedSize@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1070 <Evt_hdrSize@plt>
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rdi
sub    %rax,%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     12ad <Evt_fget+0x14d>
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %eax,%r8d
lea    0xd71(%rip),%rsi
lea    0xd74(%rip),%rdx
mov    $0xea,%ecx
call   1050 <syslog@plt>
movq   $0x0,-0x8(%rbp)
jmp    12b8 <Evt_fget+0x158>
mov    0x2d9c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Evt_fget>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <Evt_hdrSize@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1070 <Evt_hdrSize@plt>
lea    0x2eda(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r14,%rcx
call   1030 <fread@plt>
cmp    %rax,%r15
jne    11f9 <Evt_fget+0x99>
mov    %rbx,%rdi
call   1060 <HadTu_paddedSize@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1070 <Evt_hdrSize@plt>
sub    %rax,%r15
mov    %rbx,%rdi
call   1040 <Evt_data@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1060 <HadTu_paddedSize@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1070 <Evt_hdrSize@plt>
sub    %rax,%r13
mov    %r12,%rdi
mov    $0x1,%esi
mov    %r13,%rdx
mov    %r14,%rcx
call   1030 <fread@plt>
cmp    %rax,%r15
je     1231 <Evt_fget+0xd1>
mov    $0xea,%ebx
mov    0x2dd1(%rip),%rax
jmp    1205 <Evt_fget+0xa5>
mov    $0xe5,%ebx
mov    0x2dd3(%rip),%rax
mov    (%rax),%ebp
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xde4(%rip),%rsi
lea    0xde7(%rip),%rdx
mov    %ebp,%edi
mov    %ebx,%ecx
mov    %eax,%r8d
call   1050 <syslog@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@Evt_fget.pool = internal global [1048576 x i8] zeroinitializer
@Evt_fget.evt = internal global i8* getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i32 0, i32 0)
@LOG_DEBUG = global i32 0
@.str = [10 x i8] c"%s:%d: %s\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/desdemonda/cbmroot/refs/heads/master/fles/trb/daq_anal/evt.c\00"
@errno = global i32 0
@LOG_ERR = global i32 0
define i8* @Evt_fget(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i32* %0, i32** %3
%4 = call i64 (...) @Evt_hdrSize()
%5 = load i8*, i8** @Evt_fget.evt
%6 = call i64 (...) @Evt_hdrSize()
%7 = load i32*, i32** %3
%8 = call i64 @fread(i8* %5, i32 1, i64 %6, i32* %7)
%9 = icmp ne i64 %4, %8
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i32, i32* @LOG_DEBUG
%12 = load i32, i32* @errno
%13 = call i32 @strerror(i32 %12)
%14 = call i32 @syslog(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 229, i32 %13)
store i8* null, i8** %2
br label %36
15: ; preds = %1
%16 = load i8*, i8** @Evt_fget.evt
%17 = call i64 @HadTu_paddedSize(i8* %16)
%18 = call i64 (...) @Evt_hdrSize()
%19 = sub nsw i64 %17, %18
%20 = load i8*, i8** @Evt_fget.evt
%21 = call i8* @Evt_data(i8* %20)
%22 = load i8*, i8** @Evt_fget.evt
%23 = call i64 @HadTu_paddedSize(i8* %22)
%24 = call i64 (...) @Evt_hdrSize()
%25 = sub nsw i64 %23, %24
%26 = load i32*, i32** %3
%27 = call i64 @fread(i8* %21, i32 1, i64 %25, i32* %26)
%28 = icmp ne i64 %19, %27
br i1 %28, label %29, label %34
29: ; preds = %15
%30 = load i32, i32* @LOG_ERR
%31 = load i32, i32* @errno
%32 = call i32 @strerror(i32 %31)
%33 = call i32 @syslog(i32 %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 234, i32 %32)
store i8* null, i8** %2
br label %36
34: ; preds = %15
%35 = load i8*, i8** @Evt_fget.evt
store i8* %35, i8** %2
br label %36
36: ; preds = %34, %29, %10
%37 = load i8*, i8** %2
ret i8* %37
}

LLVM IR (-O2):
@Evt_fget.pool = internal global [1048576 x i8] zeroinitializer
@LOG_DEBUG = global i32 0
@.str = [10 x i8] c"%s:%d: %s\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/desdemonda/cbmroot/refs/heads/master/fles/trb/daq_anal/evt.c\00"
@errno = global i32 0
@LOG_ERR = global i32 0
define i8* @Evt_fget(i32* nocapture %0) {
%2 = tail call i64 (...) @Evt_hdrSize()
%3 = tail call i64 (...) @Evt_hdrSize()
%4 = tail call i64 @fread(i8* getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i64 0, i64 0), i32 1, i64 %3, i32* %0)
%5 = icmp eq i64 %2, %4
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = tail call i64 @HadTu_paddedSize(i8* getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i64 0, i64 0))
%8 = tail call i64 (...) @Evt_hdrSize()
%9 = sub nsw i64 %7, %8
%10 = tail call i8* @Evt_data(i8* getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i64 0, i64 0))
%11 = tail call i64 @HadTu_paddedSize(i8* getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i64 0, i64 0))
%12 = tail call i64 (...) @Evt_hdrSize()
%13 = sub nsw i64 %11, %12
%14 = tail call i64 @fread(i8* %10, i32 1, i64 %13, i32* %0)
%15 = icmp eq i64 %9, %14
br i1 %15, label %23, label %16
16: ; preds = %6, %1
%17 = phi i32* [ @LOG_DEBUG, %1 ], [ @LOG_ERR, %6 ]
%18 = phi i32 [ 229, %1 ], [ 234, %6 ]
%19 = load i32, i32* %17
%20 = load i32, i32* @errno
%21 = tail call i32 @strerror(i32 %20)
%22 = tail call i32 @syslog(i32 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %21)
br label %23
23: ; preds = %16, %6
%24 = phi i8* [ getelementptr inbounds ([1048576 x i8], [1048576 x i8]* @Evt_fget.pool, i64 0, i64 0), %6 ], [ null, %16 ]
ret i8* %24
}