#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(void *);
void aux_apply(const void *key, void **value, void *cl) {
  assert(key);
  assert(value);
  assert(*value);
  struct v_s {
    char *value;
  };
  struct char_count_s {
    char c;
    int count;
  };
  struct v_s *v = (struct v_s *)*value;
  struct char_count_s *cc = (struct char_count_s *)cl;
  char *c = v->value;
  while (*c) {
    if (*c == cc->c)
      cc->count++;
    c++;
  }
}


x86 assembly (clang, -O0):
<aux_apply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a1 <aux_apply+0x91>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1190 <aux_apply+0x80>
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1160 <aux_apply+0x50>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aux_apply>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    (%r14),%rdi
call   1030 <assert@plt>
mov    (%r14),%rax
mov    (%rax),%rax
mov    (%rax),%dl
test   %dl,%dl
je     1165 <aux_apply+0x55>
mov    (%rbx),%cl
add    $0x1,%rax
jmp    115b <aux_apply+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%edx
add    $0x1,%rax
test   %dl,%dl
je     1165 <aux_apply+0x55>
cmp    %cl,%dl
jne    1150 <aux_apply+0x40>
addl   $0x1,0x4(%rbx)
jmp    1150 <aux_apply+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.v_s = type { i8* }
%struct.char_count_s = type { i8, i32 }
define void @aux_apply(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca %struct.v_s*
%8 = alloca %struct.char_count_s*
%9 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%10 = load i8*, i8** %4
%11 = call i32 @assert(i8* %10)
%12 = load i8**, i8*** %5
%13 = bitcast i8** %12 to i8*
%14 = call i32 @assert(i8* %13)
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = call i32 @assert(i8* %16)
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
%20 = bitcast i8* %19 to %struct.v_s*
store %struct.v_s* %20, %struct.v_s** %7
%21 = load i8*, i8** %6
%22 = bitcast i8* %21 to %struct.char_count_s*
store %struct.char_count_s* %22, %struct.char_count_s** %8
%23 = load %struct.v_s*, %struct.v_s** %7
%24 = getelementptr inbounds %struct.v_s, %struct.v_s* %23, i32 0, i32 0
%25 = load i8*, i8** %24
store i8* %25, i8** %9
br label %26
26: ; preds = %44, %3
%27 = load i8*, i8** %9
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = load i8*, i8** %9
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load %struct.char_count_s*, %struct.char_count_s** %8
%35 = getelementptr inbounds %struct.char_count_s, %struct.char_count_s* %34, i32 0, i32 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %33, %37
br i1 %38, label %39, label %44
39: ; preds = %30
%40 = load %struct.char_count_s*, %struct.char_count_s** %8
%41 = getelementptr inbounds %struct.char_count_s, %struct.char_count_s* %40, i32 0, i32 1
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
store i32 %43, i32* %41
br label %44
44: ; preds = %39, %30
%45 = load i8*, i8** %9
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %9
br label %26
47: ; preds = %26
ret void
}

LLVM IR (-O2):
%struct.v_s = type { i8* }
define void @aux_apply(i8* %0, i8** %1, i8* nocapture %2) {
%4 = tail call i32 @assert(i8* %0)
%5 = bitcast i8** %1 to i8*
%6 = tail call i32 @assert(i8* %5)
%7 = load i8*, i8** %1
%8 = tail call i32 @assert(i8* %7)
%9 = bitcast i8** %1 to %struct.v_s**
%10 = load %struct.v_s*, %struct.v_s** %9
%11 = getelementptr inbounds %struct.v_s, %struct.v_s* %10, i64 0, i32 0
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %3
%16 = load i8, i8* %2
%17 = getelementptr inbounds i8, i8* %2, i64 4
%18 = bitcast i8* %17 to i32*
br label %19
19: ; preds = %15, %26
%20 = phi i8 [ %13, %15 ], [ %28, %26 ]
%21 = phi i8* [ %12, %15 ], [ %27, %26 ]
%22 = icmp eq i8 %20, %16
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %18
%25 = add nsw i32 %24, 1
store i32 %25, i32* %18
br label %26
26: ; preds = %23, %19
%27 = getelementptr inbounds i8, i8* %21, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %19
30: ; preds = %26, %3
ret void
}