#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 */

/* Variables and functions */
int /*<<< orphan*/ print_logdata(long long, long long, int, unsigned char *,
                                 int);
int tr_scanner(void *arg, long long seq, long long timestamp, int hash,
               unsigned char *buf, int size) {
  long long end_ts = *(long long *)arg;
  if (end_ts != -1LL && end_ts < timestamp) {
    return 0;
  }
  print_logdata(seq, timestamp, hash, buf, size);
  return 1;
}


x86 assembly (clang, -O0):
<tr_scanner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0xffffffffffffffff,-0x40(%rbp)
je     115f <tr_scanner+0x4f>
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    115f <tr_scanner+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    117e <tr_scanner+0x6e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%r8d
call   1030 <print_logdata@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr_scanner>:
push   %rax
mov    (%rdi),%rdi
cmp    $0xffffffffffffffff,%rdi
je     1123 <tr_scanner+0x13>
xor    %eax,%eax
cmp    %rdx,%rdi
jge    1123 <tr_scanner+0x13>
pop    %rcx
ret
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
mov    %r8,%rcx
mov    %r9d,%r8d
call   1030 <print_logdata@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @tr_scanner(i8* nocapture %0, i64 %1, i64 %2, i32 %3, i8* %4, i32 %5) {
%7 = bitcast i8* %0 to i64*
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, -1
%10 = icmp slt i64 %8, %2
%11 = and i1 %9, %10
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = tail call i32 @print_logdata(i64 %1, i64 %2, i32 %3, i8* %4, i32 %5)
br label %14
14: ; preds = %6, %12
%15 = phi i32 [ 1, %12 ], [ 0, %6 ]
ret i32 %15
}