#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 */
scalar_t__ feof(int /*<<< orphan*/ *);
int trace_read_int(int /*<<< orphan*/ *);
int jtrace_common(FILE *f, int *len, int *type, int *time, int *task) {
  *len = trace_read_int(f);
  *len = *len - 3 * 4;
  *type = trace_read_int(f);
  *time = trace_read_int(f);
  *task = trace_read_int(f);
  if (feof(f)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<jtrace_common>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0xc,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     11ae <jtrace_common+0x8e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b5 <jtrace_common+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jtrace_common>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
call   1030 <trace_read_int@plt>
add    $0xfffffff4,%eax
mov    %eax,0x0(%r13)
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    %eax,(%r12)
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    %eax,(%r15)
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    %eax,(%r14)
mov    %rbx,%rdi
call   1040 <feof@plt>
neg    %rax
sbb    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @jtrace_common(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%12 = load i32*, i32** %7
%13 = call i32 @trace_read_int(i32* %12)
%14 = load i32*, i32** %8
store i32 %13, i32* %14
%15 = load i32*, i32** %8
%16 = load i32, i32* %15
%17 = sub nsw i32 %16, 12
%18 = load i32*, i32** %8
store i32 %17, i32* %18
%19 = load i32*, i32** %7
%20 = call i32 @trace_read_int(i32* %19)
%21 = load i32*, i32** %9
store i32 %20, i32* %21
%22 = load i32*, i32** %7
%23 = call i32 @trace_read_int(i32* %22)
%24 = load i32*, i32** %10
store i32 %23, i32* %24
%25 = load i32*, i32** %7
%26 = call i32 @trace_read_int(i32* %25)
%27 = load i32*, i32** %11
store i32 %26, i32* %27
%28 = load i32*, i32** %7
%29 = call i64 @feof(i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %5
store i32 -1, i32* %6
br label %33
32: ; preds = %5
store i32 0, i32* %6
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %6
ret i32 %34
}

LLVM IR (-O2):
define i32 @jtrace_common(i32* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = tail call i32 @trace_read_int(i32* %0)
%7 = add nsw i32 %6, -12
store i32 %7, i32* %1
%8 = tail call i32 @trace_read_int(i32* %0)
store i32 %8, i32* %2
%9 = tail call i32 @trace_read_int(i32* %0)
store i32 %9, i32* %3
%10 = tail call i32 @trace_read_int(i32* %0)
store i32 %10, i32* %4
%11 = tail call i64 @feof(i32* %0)
%12 = icmp ne i64 %11, 0
%13 = sext i1 %12 to i32
ret i32 %13
}