#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 atoi(char *);
int /*<<< orphan*/ free(void *);
int rtl_htblGetFlags(void *);
int /*<<< orphan*/ rtl_htblRemove(void *, char *);
int WalkDeleteOdd(void *h, char *k, void *d, void *u) {
  int f = rtl_htblGetFlags(h);
  if ((f & 1) == 1) {
    if (atoi(k) % 2 == 0) {
      rtl_htblRemove(h, k);
      free(d);
    }
    return 0;
  }
  if ((f & 2) == 2) {
    if (((size_t)k) % 2 == 0) {
      rtl_htblRemove(h, k);
    }
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<WalkDeleteOdd>:
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    -0x10(%rbp),%rdi
call   1040 <rtl_htblGetFlags@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    11af <WalkDeleteOdd+0x6f>
mov    -0x18(%rbp),%rdi
call   1060 <atoi@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a3 <WalkDeleteOdd+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <rtl_htblRemove@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <WalkDeleteOdd+0xb0>
mov    -0x2c(%rbp),%eax
and    $0x2,%eax
cmp    $0x2,%eax
jne    11e9 <WalkDeleteOdd+0xa9>
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11dd <WalkDeleteOdd+0x9d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <rtl_htblRemove@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <WalkDeleteOdd+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WalkDeleteOdd>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <rtl_htblGetFlags@plt>
test   $0x1,%al
jne    116f <WalkDeleteOdd+0x2f>
test   $0x1,%r14b
jne    118e <WalkDeleteOdd+0x4e>
and    $0x2,%eax
je     118e <WalkDeleteOdd+0x4e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <rtl_htblRemove@plt>
jmp    118e <WalkDeleteOdd+0x4e>
mov    %r14,%rdi
call   1060 <atoi@plt>
test   $0x1,%al
jne    118e <WalkDeleteOdd+0x4e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <rtl_htblRemove@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @WalkDeleteOdd(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %6
%12 = call i32 @rtl_htblGetFlags(i8* %11)
store i32 %12, i32* %10
%13 = load i32, i32* %10
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %28
16: ; preds = %4
%17 = load i8*, i8** %7
%18 = call i32 @atoi(i8* %17)
%19 = srem i32 %18, 2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i8*, i8** %7
%24 = call i32 @rtl_htblRemove(i8* %22, i8* %23)
%25 = load i8*, i8** %8
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %21, %16
store i32 0, i32* %5
br label %43
28: ; preds = %4
%29 = load i32, i32* %10
%30 = and i32 %29, 2
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %42
32: ; preds = %28
%33 = load i8*, i8** %7
%34 = ptrtoint i8* %33 to i64
%35 = urem i64 %34, 2
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %6
%39 = load i8*, i8** %7
%40 = call i32 @rtl_htblRemove(i8* %38, i8* %39)
br label %41
41: ; preds = %37, %32
store i32 0, i32* %5
br label %43
42: ; preds = %28
store i32 0, i32* %5
br label %43
43: ; preds = %42, %41, %27
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
define i32 @WalkDeleteOdd(i8* %0, i8* %1, i8* nocapture %2, i8* nocapture readnone %3) {
%5 = tail call i32 @rtl_htblGetFlags(i8* %0)
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = tail call i32 @atoi(i8* %1)
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = tail call i32 @rtl_htblRemove(i8* %0, i8* %1)
%14 = tail call i32 @free(i8* %2)
br label %24
15: ; preds = %4
%16 = and i32 %5, 2
%17 = icmp ne i32 %16, 0
%18 = ptrtoint i8* %1 to i64
%19 = and i64 %18, 1
%20 = icmp eq i64 %19, 0
%21 = and i1 %20, %17
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = tail call i32 @rtl_htblRemove(i8* %0, i8* %1)
br label %24
24: ; preds = %15, %22, %8, %12
ret i32 0
}