#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 */
unsigned char *zipmapXDel(unsigned char *, unsigned char *, unsigned int,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ *zipmapXLookupRaw(unsigned char *, unsigned char *,
                                     unsigned int, int /*<<< orphan*/ *,
                                     unsigned int *);
int zipmapXExists(unsigned char **zm, unsigned char *key, unsigned int klen,
                  unsigned int timestamp) {
  unsigned int ts;
  if (zipmapXLookupRaw(*zm, key, klen, NULL, &ts) == NULL)
    return 0;
  if (ts < timestamp) {
    *zm = zipmapXDel(*zm, key, klen, NULL);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<zipmapXExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x24(%rbp),%r8
call   1040 <zipmapXLookupRaw@plt>
cmp    $0x0,%rax
jne    1167 <zipmapXExists+0x47>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <zipmapXExists+0x87>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    11a0 <zipmapXExists+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <zipmapXDel@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11a7 <zipmapXExists+0x87>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zipmapXExists>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r12d
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
mov    (%rdi),%rdi
xor    %ebp,%ebp
lea    0xc(%rsp),%r8
xor    %ecx,%ecx
call   1040 <zipmapXLookupRaw@plt>
test   %rax,%rax
je     116f <zipmapXExists+0x4f>
mov    $0x1,%ebp
cmp    %r12d,0xc(%rsp)
jae    116f <zipmapXExists+0x4f>
mov    (%rbx),%rdi
xor    %ebp,%ebp
mov    %r15,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
call   1030 <zipmapXDel@plt>
mov    %rax,(%rbx)
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @zipmapXExists(i8** nocapture %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = load i8*, i8** %0
%8 = call i32* @zipmapXLookupRaw(i8* %7, i8* %1, i32 %2, i32* null, i32* %5)
%9 = icmp eq i32* %8, null
br i1 %9, label %16, label %10
10: ; preds = %4
%11 = load i32, i32* %5
%12 = icmp ult i32 %11, %3
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %0
%15 = call i8* @zipmapXDel(i8* %14, i8* %1, i32 %2, i32* null)
store i8* %15, i8** %0
br label %16
16: ; preds = %10, %4, %13
%17 = phi i32 [ 0, %13 ], [ 0, %4 ], [ 1, %10 ]
ret i32 %17
}