#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 typed_value {
  int dummy;
};
struct prefix {
  int dummy;
};
struct key_value {
  int dummy;
};

/* Variables and functions */
scalar_t__ hash_map_sym_pop_value(struct key_value *);
struct key_value *prefix_find_value_binding(struct prefix *, char *, int);
struct typed_value *prefix_undef_value(struct prefix *self, char *name,
                                       int name_len) {
  struct key_value *binding = prefix_find_value_binding(self, name, name_len);
  if (binding) {
    return (struct typed_value *)hash_map_sym_pop_value(binding);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<prefix_undef_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <prefix_find_value_binding@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1164 <prefix_undef_value+0x44>
mov    -0x28(%rbp),%rdi
call   1030 <hash_map_sym_pop_value@plt>
mov    %rax,-0x8(%rbp)
jmp    116c <prefix_undef_value+0x4c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix_undef_value>:
push   %rax
call   1040 <prefix_find_value_binding@plt>
test   %rax,%rax
je     1135 <prefix_undef_value+0x15>
mov    %rax,%rdi
call   1030 <hash_map_sym_pop_value@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.typed_value = type { i32 }
%struct.prefix = type { i32 }
%struct.key_value = type { i32 }
define %struct.typed_value* @prefix_undef_value(%struct.prefix* %0, i8* %1, i32 %2) {
%4 = alloca %struct.typed_value*
%5 = alloca %struct.prefix*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.key_value*
store %struct.prefix* %0, %struct.prefix** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load %struct.prefix*, %struct.prefix** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call %struct.key_value* @prefix_find_value_binding(%struct.prefix* %9, i8* %10, i32 %11)
store %struct.key_value* %12, %struct.key_value** %8
%13 = load %struct.key_value*, %struct.key_value** %8
%14 = icmp ne %struct.key_value* %13, null
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load %struct.key_value*, %struct.key_value** %8
%17 = call i64 @hash_map_sym_pop_value(%struct.key_value* %16)
%18 = inttoptr i64 %17 to %struct.typed_value*
store %struct.typed_value* %18, %struct.typed_value** %4
br label %20
19: ; preds = %3
store %struct.typed_value* null, %struct.typed_value** %4
br label %20
20: ; preds = %19, %15
%21 = load %struct.typed_value*, %struct.typed_value** %4
ret %struct.typed_value* %21
}

LLVM IR (-O2):
%struct.typed_value = type { i32 }
%struct.prefix = type { i32 }
%struct.key_value = type { i32 }
define %struct.typed_value* @prefix_undef_value(%struct.prefix* %0, i8* %1, i32 %2) {
%4 = tail call %struct.key_value* @prefix_find_value_binding(%struct.prefix* %0, i8* %1, i32 %2)
%5 = icmp eq %struct.key_value* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i64 @hash_map_sym_pop_value(%struct.key_value* %4)
%8 = inttoptr i64 %7 to %struct.typed_value*
br label %9
9: ; preds = %3, %6
%10 = phi %struct.typed_value* [ %8, %6 ], [ null, %3 ]
ret %struct.typed_value* %10
}