#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 /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, unsigned int);
int /*<<< orphan*/ puts(char *);
unsigned int strlen(char const *);
unsigned int iterate_first(void *state, const char *key, void **data) {
  unsigned int *state_firsts = 0;
  unsigned int **data_int = 0;
  if (!state) {
    puts("iterate_each: state undef");
    assert(0);
  }
  if (!key) {
    puts("iterate_each: key undef");
    assert(0);
  }
  if (!data) {
    puts("iterate_each: data undef");
    assert(0);
  }
  data_int = (unsigned int **)data;
  state_firsts = state;
  state_firsts[0] = strlen(key);
  state_firsts[1] = **data_int;
  state_firsts[2] += 1;
  printf("iterate_first: saw pair ('%s': '%u')\n", key, **data_int);
  return 0;
}


x86 assembly (clang, -O0):
<iterate_first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1182 <iterate_first+0x42>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
jne    11a0 <iterate_first+0x60>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
jne    11be <iterate_first+0x7e>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edx
lea    0xe3b(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterate_first>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     118c <iterate_first+0x4c>
test   %r14,%r14
je     11a4 <iterate_first+0x64>
test   %r15,%r15
je     11bc <iterate_first+0x7c>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,(%rbx)
mov    (%r15),%rax
mov    (%rax),%ecx
mov    %ecx,0x4(%rbx)
addl   $0x1,0x8(%rbx)
mov    (%rax),%edx
lea    0xecf(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
test   %r14,%r14
jne    1158 <iterate_first+0x18>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
test   %r15,%r15
jne    115d <iterate_first+0x1d>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <assert@plt>
jmp    115d <iterate_first+0x1d>

LLVM IR (-O0):
@.str = [26 x i8] c"iterate_each: state undef\00"
@.str.1 = [24 x i8] c"iterate_each: key undef\00"
@.str.2 = [25 x i8] c"iterate_each: data undef\00"
@.str.3 = [38 x i8] c"iterate_first: saw pair ('%s': '%u')\0A\00"
define i32 @iterate_first(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i32**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
store i32* null, i32** %7
store i32** null, i32*** %8
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @assert(i32 0)
br label %14
14: ; preds = %11, %3
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @assert(i32 0)
br label %20
20: ; preds = %17, %14
%21 = load i8**, i8*** %6
%22 = icmp ne i8** %21, null
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @assert(i32 0)
br label %26
26: ; preds = %23, %20
%27 = load i8**, i8*** %6
%28 = bitcast i8** %27 to i32**
store i32** %28, i32*** %8
%29 = load i8*, i8** %4
%30 = bitcast i8* %29 to i32*
store i32* %30, i32** %7
%31 = load i8*, i8** %5
%32 = call i32 @strlen(i8* %31)
%33 = load i32*, i32** %7
%34 = getelementptr inbounds i32, i32* %33, i64 0
store i32 %32, i32* %34
%35 = load i32**, i32*** %8
%36 = load i32*, i32** %35
%37 = load i32, i32* %36
%38 = load i32*, i32** %7
%39 = getelementptr inbounds i32, i32* %38, i64 1
store i32 %37, i32* %39
%40 = load i32*, i32** %7
%41 = getelementptr inbounds i32, i32* %40, i64 2
%42 = load i32, i32* %41
%43 = add i32 %42, 1
store i32 %43, i32* %41
%44 = load i8*, i8** %5
%45 = load i32**, i32*** %8
%46 = load i32*, i32** %45
%47 = load i32, i32* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %44, i32 %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"iterate_each: state undef\00"
@.str.1 = [24 x i8] c"iterate_each: key undef\00"
@.str.2 = [25 x i8] c"iterate_each: data undef\00"
@.str.3 = [38 x i8] c"iterate_first: saw pair ('%s': '%u')\0A\00"
define i32 @iterate_first(i8* %0, i8* %1, i8** %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @assert(i32 0)
br label %8
8: ; preds = %5, %3
%9 = icmp eq i8* %1, null
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @assert(i32 0)
br label %13
13: ; preds = %10, %8
%14 = icmp eq i8** %2, null
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @assert(i32 0)
br label %18
18: ; preds = %15, %13
%19 = bitcast i8** %2 to i32**
%20 = bitcast i8* %0 to i32*
%21 = tail call i32 @strlen(i8* %1)
store i32 %21, i32* %20
%22 = load i32*, i32** %19
%23 = load i32, i32* %22
%24 = getelementptr inbounds i8, i8* %0, i64 4
%25 = bitcast i8* %24 to i32*
store i32 %23, i32* %25
%26 = getelementptr inbounds i8, i8* %0, i64 8
%27 = bitcast i8* %26 to i32*
%28 = load i32, i32* %27
%29 = add i32 %28, 1
store i32 %29, i32* %27
%30 = load i32, i32* %22
%31 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %1, i32 %30)
ret i32 0
}