#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 trace_common(FILE *f, int *type, int *time, int *task, int *cpu) {
  *type = trace_read_int(f);
  *time = trace_read_int(f);
  *task = trace_read_int(f);
  *cpu = trace_read_int(f);
  if (feof(f)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<trace_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    -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     119f <trace_common+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <trace_common+0x86>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace_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>
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 @trace_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** %7
%16 = call i32 @trace_read_int(i32* %15)
%17 = load i32*, i32** %9
store i32 %16, i32* %17
%18 = load i32*, i32** %7
%19 = call i32 @trace_read_int(i32* %18)
%20 = load i32*, i32** %10
store i32 %19, i32* %20
%21 = load i32*, i32** %7
%22 = call i32 @trace_read_int(i32* %21)
%23 = load i32*, i32** %11
store i32 %22, i32* %23
%24 = load i32*, i32** %7
%25 = call i64 @feof(i32* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %5
store i32 -1, i32* %6
br label %29
28: ; preds = %5
store i32 0, i32* %6
br label %29
29: ; preds = %28, %27
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
define i32 @trace_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)
store i32 %6, i32* %1
%7 = tail call i32 @trace_read_int(i32* %0)
store i32 %7, i32* %2
%8 = tail call i32 @trace_read_int(i32* %0)
store i32 %8, i32* %3
%9 = tail call i32 @trace_read_int(i32* %0)
store i32 %9, i32* %4
%10 = tail call i64 @feof(i32* %0)
%11 = icmp ne i64 %10, 0
%12 = sext i1 %11 to i32
ret i32 %12
}