#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*/ assert(int);
int atoi(char const *);
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strcmp(char const *, char *);
int remove_even_foreach(void *key, void *value, void *user_data) {
  const char *_key = (const char *)key;
  const char *_value = (const char *)value;
  int i;
  char val[20];
  assert(_key != NULL);
  assert(*_key != 0);
  assert(_value != NULL);
  assert(*_value != 0);
  i = atoi(_key);
  sprintf(val, "%d value", i);
  assert(strcmp(_value, val) == 0);
  return ((i % 2) == 0) ? 1 : 0;
}


x86 assembly (clang, -O0):
<remove_even_foreach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xe30(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_even_foreach>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,(%rbx)
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,(%r14)
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
not    %ebx
lea    0xe65(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
and    $0x1,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d value\00"
define i32 @remove_even_foreach(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [20 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %4
store i8* %11, i8** %7
%12 = load i8*, i8** %5
store i8* %12, i8** %8
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i8*, i8** %8
%24 = icmp ne i8* %23, null
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i8*, i8** %8
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i8*, i8** %7
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %9
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%36 = load i32, i32* %9
%37 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = load i8*, i8** %8
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%40 = call i64 @strcmp(i8* %38, i8* %39)
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = load i32, i32* %9
%45 = srem i32 %44, 2
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i32 1, i32 0
ret i32 %48
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d value\00"
define i32 @remove_even_foreach(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%6 = icmp ne i8* %0, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = load i8, i8* %0
%10 = icmp ne i8 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = icmp ne i8* %1, null
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = load i8, i8* %1
%17 = icmp ne i8 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 @atoi(i8* %0)
%21 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i64 @strcmp(i8* %1, i8* %5)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = and i32 %20, 1
%27 = xor i32 %26, 1
ret i32 %27
}