#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 inter {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct typed_value *);
struct typed_value *inter_undef_value(struct inter *, char *, int);
int /*<<< orphan*/ typed_value_destruct(struct typed_value *, struct inter *);
void inter_free_value(struct inter *inter, char *name, int name_len) {
  struct typed_value *value = inter_undef_value(inter, name, name_len);
  if (value) {
    typed_value_destruct(value, inter);
    free(value);
  }
}


x86 assembly (clang, -O0):
<inter_free_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <inter_undef_value@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1178 <inter_free_value+0x48>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <typed_value_destruct@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inter_free_value>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <inter_undef_value@plt>
test   %rax,%rax
je     115e <inter_free_value+0x2e>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <typed_value_destruct@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.inter = type { i32 }
%struct.typed_value = type { i32 }
define void @inter_free_value(%struct.inter* %0, i8* %1, i32 %2) {
%4 = alloca %struct.inter*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.typed_value*
store %struct.inter* %0, %struct.inter** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load %struct.inter*, %struct.inter** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call %struct.typed_value* @inter_undef_value(%struct.inter* %8, i8* %9, i32 %10)
store %struct.typed_value* %11, %struct.typed_value** %7
%12 = load %struct.typed_value*, %struct.typed_value** %7
%13 = icmp ne %struct.typed_value* %12, null
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load %struct.typed_value*, %struct.typed_value** %7
%16 = load %struct.inter*, %struct.inter** %4
%17 = call i32 @typed_value_destruct(%struct.typed_value* %15, %struct.inter* %16)
%18 = load %struct.typed_value*, %struct.typed_value** %7
%19 = call i32 @free(%struct.typed_value* %18)
br label %20
20: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
%struct.inter = type { i32 }
%struct.typed_value = type { i32 }
define void @inter_free_value(%struct.inter* %0, i8* %1, i32 %2) {
%4 = tail call %struct.typed_value* @inter_undef_value(%struct.inter* %0, i8* %1, i32 %2)
%5 = icmp eq %struct.typed_value* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @typed_value_destruct(%struct.typed_value* %4, %struct.inter* %0)
%8 = tail call i32 @free(%struct.typed_value* %4)
br label %9
9: ; preds = %6, %3
ret void
}