void assoc_print(struct assoc_array *array) {
  puts("\nArray (");
  for (assoc_rewind(array); assoc_valid(array); assoc_next(array)) {
    printf("\t'%s' => %p\n", assoc_key(array), assoc_current(array));
  }
  puts(")\n");
}


x86 assembly (clang, -O0):
<assoc_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1090 <assoc_rewind@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <assoc_valid@plt>
cmp    $0x0,%eax
je     11e5 <assoc_print+0x75>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1060 <assoc_key@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <assoc_current@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1080 <assoc_next@plt>
jmp    1195 <assoc_print+0x25>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assoc_print>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <assoc_rewind@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <assoc_valid@plt>
test   %eax,%eax
je     11ec <assoc_print+0x7c>
lea    0xe65(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <assoc_key@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <assoc_current@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <assoc_next@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <assoc_valid@plt>
test   %eax,%eax
jne    11b0 <assoc_print+0x40>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
%struct.assoc_array = type opaque
@.str = [9 x i8] c"\0AArray (\00"
@.str.1 = [13 x i8] c"\09'%s' => %p\0A\00"
@.str.2 = [3 x i8] c")\0A\00"
define void @assoc_print(%struct.assoc_array* %0) {
%2 = alloca %struct.assoc_array*
store %struct.assoc_array* %0, %struct.assoc_array** %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.assoc_array*, %struct.assoc_array** %2
%5 = call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_rewind to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %4)
br label %6
6: ; preds = %16, %1
%7 = load %struct.assoc_array*, %struct.assoc_array** %2
%8 = call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_valid to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load %struct.assoc_array*, %struct.assoc_array** %2
%12 = call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_key to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %11)
%13 = load %struct.assoc_array*, %struct.assoc_array** %2
%14 = call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_current to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %14)
br label %16
16: ; preds = %10
%17 = load %struct.assoc_array*, %struct.assoc_array** %2
%18 = call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_next to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %17)
br label %6
19: ; preds = %6
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.assoc_array = type opaque
@.str = [9 x i8] c"\0AArray (\00"
@.str.1 = [13 x i8] c"\09'%s' => %p\0A\00"
@.str.2 = [3 x i8] c")\0A\00"
define void @assoc_print(%struct.assoc_array* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_rewind to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%4 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_valid to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %1, %6
%7 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_key to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%8 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_current to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_next to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%11 = tail call i32 (%struct.assoc_array*, ...) bitcast (i32 (...)* @assoc_valid to i32 (%struct.assoc_array*, ...)*)(%struct.assoc_array* %0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %1
%14 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}