#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ (*init)(int /*<<< orphan*/ *);
};
typedef TYPE_1__ CONF_METHOD;
typedef int /*<<< orphan*/ CONF;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *malloc(int);
scalar_t__ stub1(int /*<<< orphan*/ *);
CONF *def_create(CONF_METHOD *meth) {
  CONF *ret;
  ret = malloc(sizeof(CONF) + sizeof(unsigned short *));
  if (ret)
    if (meth->init(ret) == 0) {
      free(ret);
      ret = NULL;
    }
  return ret;
}


x86 assembly (clang, -O0):
<def_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1172 <def_create+0x52>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
cmp    $0x0,%rax
jne    116d <def_create+0x4d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
jmp    1172 <def_create+0x52>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_create>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xc,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     114c <def_create+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
call   *(%r14)
test   %rax,%rax
jne    114e <def_create+0x2e>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 (i32*)* }
define i32* @def_create(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
%3 = alloca i32*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%4 = call i32* @malloc(i32 12)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%10 = load i64 (i32*)*, i64 (i32*)** %9
%11 = load i32*, i32** %3
%12 = call i64 %10(i32* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i32*, i32** %3
%16 = call i32 @free(i32* %15)
store i32* null, i32** %3
br label %17
17: ; preds = %14, %7
br label %18
18: ; preds = %17, %1
%19 = load i32*, i32** %3
ret i32* %19
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 (i32*)* }
define i32* @def_create(%struct.TYPE_3__* nocapture %0) {
%2 = tail call i32* @malloc(i32 12)
%3 = icmp eq i32* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%6 = load i64 (i32*)*, i64 (i32*)** %5
%7 = tail call i64 %6(i32* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @free(i32* %2)
br label %11
11: ; preds = %4, %9, %1
%12 = phi i32* [ null, %9 ], [ %2, %4 ], [ null, %1 ]
ret i32* %12
}