#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_complex_avltree(struct avl_tree *, struct avl_node *, void *,
                             void (*)(void *, char *, void *));
struct avl_node *find_name_node_avltree(struct avl_tree *, char *);
int del_name_node_complex_avltree(struct avl_tree *t, char *key, void *global,
                                  void (*complex_free)(void *global, char *key,
                                                       void *payload)) {
  struct avl_node *dn;
  if (t == NULL) {
    return -1;
  }
  dn = find_name_node_avltree(t, key);
  if (dn == NULL) {
    return -1;
  }
  return del_node_complex_avltree(t, dn, global, complex_free);
}


x86 assembly (clang, -O0):
<del_name_node_complex_avltree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114f <del_name_node_complex_avltree+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <del_name_node_complex_avltree+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <find_name_node_avltree@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1177 <del_name_node_complex_avltree+0x57>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <del_name_node_complex_avltree+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <del_node_complex_avltree@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_name_node_complex_avltree>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1153 <del_name_node_complex_avltree+0x33>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
call   1040 <find_name_node_avltree@plt>
test   %rax,%rax
je     1153 <del_name_node_complex_avltree+0x33>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <del_node_complex_avltree@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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