#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 */
struct tlog_pkt_pos {
  int dummy;
};
struct tlog_pkt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ tlog_pkt_is_valid(struct tlog_pkt const *);
int /*<<< orphan*/ tlog_pkt_pos_is_compatible(struct tlog_pkt_pos const *,
                                              struct tlog_pkt const *);
int /*<<< orphan*/ tlog_pkt_pos_is_in(struct tlog_pkt_pos const *,
                                      struct tlog_pkt const *);
int /*<<< orphan*/ tlog_pkt_pos_is_valid(struct tlog_pkt_pos const *);
bool tlog_pkt_pos_is_past(const struct tlog_pkt_pos *pos,
                          const struct tlog_pkt *pkt) {
  assert(tlog_pkt_pos_is_valid(pos));
  assert(tlog_pkt_is_valid(pkt));
  assert(tlog_pkt_pos_is_compatible(pos, pkt));
  return !tlog_pkt_pos_is_in(pos, pkt);
}


x86 assembly (clang, -O0):
<tlog_pkt_pos_is_past>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tlog_pkt_pos_is_valid@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1070 <tlog_pkt_is_valid@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <tlog_pkt_pos_is_compatible@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <tlog_pkt_pos_is_in@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlog_pkt_pos_is_past>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <tlog_pkt_pos_is_valid@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %r14,%rdi
call   1070 <tlog_pkt_is_valid@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <tlog_pkt_pos_is_compatible@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <tlog_pkt_pos_is_in@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tlog_pkt_pos = type { i32 }
%struct.tlog_pkt = type { i32 }
define i32 @tlog_pkt_pos_is_past(%struct.tlog_pkt_pos* %0, %struct.tlog_pkt* %1) {
%3 = alloca %struct.tlog_pkt_pos*
%4 = alloca %struct.tlog_pkt*
store %struct.tlog_pkt_pos* %0, %struct.tlog_pkt_pos** %3
store %struct.tlog_pkt* %1, %struct.tlog_pkt** %4
%5 = load %struct.tlog_pkt_pos*, %struct.tlog_pkt_pos** %3
%6 = call i32 @tlog_pkt_pos_is_valid(%struct.tlog_pkt_pos* %5)
%7 = call i32 @assert(i32 %6)
%8 = load %struct.tlog_pkt*, %struct.tlog_pkt** %4
%9 = call i32 @tlog_pkt_is_valid(%struct.tlog_pkt* %8)
%10 = call i32 @assert(i32 %9)
%11 = load %struct.tlog_pkt_pos*, %struct.tlog_pkt_pos** %3
%12 = load %struct.tlog_pkt*, %struct.tlog_pkt** %4
%13 = call i32 @tlog_pkt_pos_is_compatible(%struct.tlog_pkt_pos* %11, %struct.tlog_pkt* %12)
%14 = call i32 @assert(i32 %13)
%15 = load %struct.tlog_pkt_pos*, %struct.tlog_pkt_pos** %3
%16 = load %struct.tlog_pkt*, %struct.tlog_pkt** %4
%17 = call i32 @tlog_pkt_pos_is_in(%struct.tlog_pkt_pos* %15, %struct.tlog_pkt* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
%struct.tlog_pkt_pos = type { i32 }
%struct.tlog_pkt = type { i32 }
define i32 @tlog_pkt_pos_is_past(%struct.tlog_pkt_pos* %0, %struct.tlog_pkt* %1) {
%3 = tail call i32 @tlog_pkt_pos_is_valid(%struct.tlog_pkt_pos* %0)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @tlog_pkt_is_valid(%struct.tlog_pkt* %1)
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @tlog_pkt_pos_is_compatible(%struct.tlog_pkt_pos* %0, %struct.tlog_pkt* %1)
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @tlog_pkt_pos_is_in(%struct.tlog_pkt_pos* %0, %struct.tlog_pkt* %1)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}