#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 rlite {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rl_key_delete_with_value(struct rlite *,
                                            unsigned char const *, long);
int rl_key_get_hash_ignore_expire(struct rlite *, unsigned char *,
                                  unsigned char *, long *, long *,
                                  unsigned long long *, long *, int);
int sha1(unsigned char const *, long, unsigned char *);
int rl_key_get_ignore_expire(struct rlite *db, const unsigned char *key,
                             long keylen, unsigned char *type,
                             long *string_page, long *value_page,
                             unsigned long long *expires, long *version,
                             int ignore_expire) {
  unsigned char digest[20];
  int retval;
  retval = sha1(key, keylen, digest);
  if (0 != retval)
    goto cleanup;
  ;
  retval =
      rl_key_get_hash_ignore_expire(db, digest, type, string_page, value_page,
                                    expires, version, ignore_expire);
  if (2 != retval && 10 != retval)
    goto cleanup;
  ;
  if (retval == 10) {
    rl_key_delete_with_value(db, key, keylen);
    if (version) {
      *version = 0;
    }
    retval = 3;
  }
cleanup:
  return retval;
}


x86 assembly (clang, -O0):
<rl_key_get_ignore_expire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1030 <sha1@plt>
mov    %eax,-0x54(%rbp)
xor    %eax,%eax
cmp    -0x54(%rbp),%eax
je     117f <rl_key_get_ignore_expire+0x4f>
jmp    120c <rl_key_get_ignore_expire+0xdc>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <rl_key_get_hash_ignore_expire@plt>
mov    %eax,-0x54(%rbp)
mov    $0x2,%eax
cmp    -0x54(%rbp),%eax
je     11cf <rl_key_get_ignore_expire+0x9f>
mov    $0xa,%eax
cmp    -0x54(%rbp),%eax
je     11cf <rl_key_get_ignore_expire+0x9f>
jmp    120c <rl_key_get_ignore_expire+0xdc>
cmpl   $0xa,-0x54(%rbp)
jne    1207 <rl_key_get_ignore_expire+0xd7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <rl_key_delete_with_value@plt>
cmpq   $0x0,0x18(%rbp)
je     1200 <rl_key_get_ignore_expire+0xd0>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x3,-0x54(%rbp)
jmp    120c <rl_key_get_ignore_expire+0xdc>
mov    -0x54(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rl_key_get_ignore_expire>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%rbp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsp,%rdx
mov    %rsi,%rdi
mov    %r14,%rsi
call   1030 <sha1@plt>
test   %eax,%eax
jne    11b4 <rl_key_get_ignore_expire+0x84>
mov    0x60(%rsp),%r10d
mov    0x58(%rsp),%rax
mov    0x50(%rsp),%r9
mov    %rsp,%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r12,%r8
mov    %rax,%rbp
push   %r10
push   %rax
call   1040 <rl_key_get_hash_ignore_expire@plt>
add    $0x10,%rsp
cmp    $0xa,%eax
jne    11b4 <rl_key_get_ignore_expire+0x84>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <rl_key_delete_with_value@plt>
mov    $0x3,%eax
test   %rbp,%rbp
je     11b4 <rl_key_get_ignore_expire+0x84>
movq   $0x0,0x0(%rbp)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rlite = type { i32 }
define i32 @rl_key_get_ignore_expire(%struct.rlite* %0, i8* %1, i64 %2, i8* %3, i64* %4, i64* %5, i64* %6, i64* %7, i32 %8) {
%10 = alloca %struct.rlite*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64*
%15 = alloca i64*
%16 = alloca i64*
%17 = alloca i64*
%18 = alloca i32
%19 = alloca [20 x i8]
%20 = alloca i32
store %struct.rlite* %0, %struct.rlite** %10
store i8* %1, i8** %11
store i64 %2, i64* %12
store i8* %3, i8** %13
store i64* %4, i64** %14
store i64* %5, i64** %15
store i64* %6, i64** %16
store i64* %7, i64** %17
store i32 %8, i32* %18
%21 = load i8*, i8** %11
%22 = load i64, i64* %12
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%24 = call i32 @sha1(i8* %21, i64 %22, i8* %23)
store i32 %24, i32* %20
%25 = load i32, i32* %20
%26 = icmp ne i32 0, %25
br i1 %26, label %27, label %28
27: ; preds = %9
br label %58
28: ; preds = %9
%29 = load %struct.rlite*, %struct.rlite** %10
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %19, i64 0, i64 0
%31 = load i8*, i8** %13
%32 = load i64*, i64** %14
%33 = load i64*, i64** %15
%34 = load i64*, i64** %16
%35 = load i64*, i64** %17
%36 = load i32, i32* %18
%37 = call i32 @rl_key_get_hash_ignore_expire(%struct.rlite* %29, i8* %30, i8* %31, i64* %32, i64* %33, i64* %34, i64* %35, i32 %36)
store i32 %37, i32* %20
%38 = load i32, i32* %20
%39 = icmp ne i32 2, %38
br i1 %39, label %40, label %44
40: ; preds = %28
%41 = load i32, i32* %20
%42 = icmp ne i32 10, %41
br i1 %42, label %43, label %44
43: ; preds = %40
br label %58
44: ; preds = %40, %28
%45 = load i32, i32* %20
%46 = icmp eq i32 %45, 10
br i1 %46, label %47, label %57
47: ; preds = %44
%48 = load %struct.rlite*, %struct.rlite** %10
%49 = load i8*, i8** %11
%50 = load i64, i64* %12
%51 = call i32 @rl_key_delete_with_value(%struct.rlite* %48, i8* %49, i64 %50)
%52 = load i64*, i64** %17
%53 = icmp ne i64* %52, null
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = load i64*, i64** %17
store i64 0, i64* %55
br label %56
56: ; preds = %54, %47
store i32 3, i32* %20
br label %57
57: ; preds = %56, %44
br label %58
58: ; preds = %57, %43, %27
%59 = load i32, i32* %20
ret i32 %59
}

LLVM IR (-O2):
%struct.rlite = type { i32 }
define i32 @rl_key_get_ignore_expire(%struct.rlite* %0, i8* %1, i64 %2, i8* %3, i64* %4, i64* %5, i64* %6, i64* %7, i32 %8) {
%10 = alloca [20 x i8]
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%12 = call i32 @sha1(i8* %1, i64 %2, i8* %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = call i32 @rl_key_get_hash_ignore_expire(%struct.rlite* %0, i8* %11, i8* %3, i64* %4, i64* %5, i64* %6, i64* %7, i32 %8)
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = call i32 @rl_key_delete_with_value(%struct.rlite* %0, i8* %1, i64 %2)
%19 = icmp eq i64* %7, null
br i1 %19, label %21, label %20
20: ; preds = %17
store i64 0, i64* %7
br label %21
21: ; preds = %17, %20, %14, %9
%22 = phi i32 [ %12, %9 ], [ %15, %14 ], [ 3, %20 ], [ 3, %17 ]
ret i32 %22
}