#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 */
struct avl_tree {
  int dummy;
};
struct avl_node {
  int dummy;
};

/* Variables and functions */
int del_node_avltree(struct avl_tree *, struct avl_node *, void (*)(void *));
struct avl_node *find_name_node_avltree(struct avl_tree *, char *);
int del_name_node_avltree(struct avl_tree *t, char *key,
                          void (*d_free)(void *)) {
  struct avl_node *dn;
  if (t == NULL)
    return -1;
  dn = find_name_node_avltree(t, key);
  if (dn == NULL)
    return -1;
  return del_node_avltree(t, dn, d_free);
}


x86 assembly (clang, -O0):
<del_name_node_avltree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <del_name_node_avltree+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <del_name_node_avltree+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <find_name_node_avltree@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1173 <del_name_node_avltree+0x53>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <del_name_node_avltree+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <del_node_avltree@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_name_node_avltree>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     114e <del_name_node_avltree+0x2e>
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <find_name_node_avltree@plt>
test   %rax,%rax
je     114e <del_name_node_avltree+0x2e>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <del_node_avltree@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.avl_tree = type { i32 }
%struct.avl_node = type { i32 }
define i32 @del_name_node_avltree(%struct.avl_tree* %0, i8* %1, void (i8*)* %2) {
%4 = alloca i32
%5 = alloca %struct.avl_tree*
%6 = alloca i8*
%7 = alloca void (i8*)*
%8 = alloca %struct.avl_node*
store %struct.avl_tree* %0, %struct.avl_tree** %5
store i8* %1, i8** %6
store void (i8*)* %2, void (i8*)** %7
%9 = load %struct.avl_tree*, %struct.avl_tree** %5
%10 = icmp eq %struct.avl_tree* %9, null
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 -1, i32* %4
br label %24
12: ; preds = %3
%13 = load %struct.avl_tree*, %struct.avl_tree** %5
%14 = load i8*, i8** %6
%15 = call %struct.avl_node* @find_name_node_avltree(%struct.avl_tree* %13, i8* %14)
store %struct.avl_node* %15, %struct.avl_node** %8
%16 = load %struct.avl_node*, %struct.avl_node** %8
%17 = icmp eq %struct.avl_node* %16, null
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 -1, i32* %4
br label %24
19: ; preds = %12
%20 = load %struct.avl_tree*, %struct.avl_tree** %5
%21 = load %struct.avl_node*, %struct.avl_node** %8
%22 = load void (i8*)*, void (i8*)** %7
%23 = call i32 @del_node_avltree(%struct.avl_tree* %20, %struct.avl_node* %21, void (i8*)* %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %19, %18, %11
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
%struct.avl_tree = type { i32 }
%struct.avl_node = type { i32 }
define i32 @del_name_node_avltree(%struct.avl_tree* %0, i8* %1, void (i8*)* %2) {
%4 = icmp eq %struct.avl_tree* %0, null
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call %struct.avl_node* @find_name_node_avltree(%struct.avl_tree* %0, i8* %1)
%7 = icmp eq %struct.avl_node* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @del_node_avltree(%struct.avl_tree* %0, %struct.avl_node* %6, void (i8*)* %2)
br label %10
10: ; preds = %5, %3, %8
%11 = phi i32 [ %9, %8 ], [ -1, %3 ], [ -1, %5 ]
ret i32 %11
}