#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 */

/* Variables and functions */
char *blc_construct_iface_by_name(char const *, int *);
int /*<<< orphan*/ blc_verify_iface(char *, int *);
int /*<<< orphan*/ free(char *);
char *blc_get_iface_by_name(const char *name, int *err) {
  char *rv = blc_construct_iface_by_name(name, err);
  if (!rv) {
    return 0;
  }
  if (!blc_verify_iface(rv, err)) {
    free(rv);
    return 0;
  } else {
    return rv;
  }
}


x86 assembly (clang, -O0):
<blc_get_iface_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <blc_construct_iface_by_name@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1169 <blc_get_iface_by_name+0x39>
movq   $0x0,-0x8(%rbp)
jmp    119d <blc_get_iface_by_name+0x6d>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <blc_verify_iface@plt>
cmp    $0x0,%eax
jne    1195 <blc_get_iface_by_name+0x65>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    119d <blc_get_iface_by_name+0x6d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blc_get_iface_by_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <blc_construct_iface_by_name@plt>
test   %rax,%rax
je     115b <blc_get_iface_by_name+0x2b>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <blc_verify_iface@plt>
test   %eax,%eax
jne    115d <blc_get_iface_by_name+0x2d>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @blc_get_iface_by_name(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
%7 = load i8*, i8** %4
%8 = load i32*, i32** %5
%9 = call i8* @blc_construct_iface_by_name(i8* %7, i32* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i8* null, i8** %3
br label %23
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load i32*, i32** %5
%16 = call i32 @blc_verify_iface(i8* %14, i32* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = load i8*, i8** %6
%20 = call i32 @free(i8* %19)
store i8* null, i8** %3
br label %23
21: ; preds = %13
%22 = load i8*, i8** %6
store i8* %22, i8** %3
br label %23
23: ; preds = %21, %18, %12
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @blc_get_iface_by_name(i8* %0, i32* %1) {
%3 = tail call i8* @blc_construct_iface_by_name(i8* %0, i32* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @blc_verify_iface(i8* %3, i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @free(i8* %3)
br label %10
10: ; preds = %5, %2, %8
%11 = phi i8* [ null, %8 ], [ null, %2 ], [ %3, %5 ]
ret i8* %11
}