#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 net_device {
  int dummy;
};
struct neighbour {
  int dummy;
};
struct neigh_table {
  int dummy;
};

/* Variables and functions */
struct neighbour *neigh_create(struct neigh_table *, void const *,
                               struct net_device *);
struct neighbour *neigh_lookup(struct neigh_table *, void const *,
                               struct net_device *);
struct neighbour *__neigh_lookup_errno(struct neigh_table *tbl,
                                       const void *pkey,
                                       struct net_device *dev) {
  struct neighbour *n = neigh_lookup(tbl, pkey, dev);
  if (n)
    return n;
  return neigh_create(tbl, pkey, dev);
}


x86 assembly (clang, -O0):
<__neigh_lookup_errno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <neigh_lookup@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1161 <__neigh_lookup_errno+0x41>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1176 <__neigh_lookup_errno+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <neigh_create@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__neigh_lookup_errno>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <neigh_lookup@plt>
test   %rax,%rax
je     113e <__neigh_lookup_errno+0x1e>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <neigh_create@plt>

LLVM IR (-O0):
%struct.neighbour = type { i32 }
%struct.neigh_table = type { i32 }
%struct.net_device = type { i32 }
define %struct.neighbour* @__neigh_lookup_errno(%struct.neigh_table* %0, i8* %1, %struct.net_device* %2) {
%4 = alloca %struct.neighbour*
%5 = alloca %struct.neigh_table*
%6 = alloca i8*
%7 = alloca %struct.net_device*
%8 = alloca %struct.neighbour*
store %struct.neigh_table* %0, %struct.neigh_table** %5
store i8* %1, i8** %6
store %struct.net_device* %2, %struct.net_device** %7
%9 = load %struct.neigh_table*, %struct.neigh_table** %5
%10 = load i8*, i8** %6
%11 = load %struct.net_device*, %struct.net_device** %7
%12 = call %struct.neighbour* @neigh_lookup(%struct.neigh_table* %9, i8* %10, %struct.net_device* %11)
store %struct.neighbour* %12, %struct.neighbour** %8
%13 = load %struct.neighbour*, %struct.neighbour** %8
%14 = icmp ne %struct.neighbour* %13, null
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = load %struct.neighbour*, %struct.neighbour** %8
store %struct.neighbour* %16, %struct.neighbour** %4
br label %22
17: ; preds = %3
%18 = load %struct.neigh_table*, %struct.neigh_table** %5
%19 = load i8*, i8** %6
%20 = load %struct.net_device*, %struct.net_device** %7
%21 = call %struct.neighbour* @neigh_create(%struct.neigh_table* %18, i8* %19, %struct.net_device* %20)
store %struct.neighbour* %21, %struct.neighbour** %4
br label %22
22: ; preds = %17, %15
%23 = load %struct.neighbour*, %struct.neighbour** %4
ret %struct.neighbour* %23
}

LLVM IR (-O2):
%struct.neighbour = type { i32 }
%struct.neigh_table = type { i32 }
%struct.net_device = type { i32 }
define %struct.neighbour* @__neigh_lookup_errno(%struct.neigh_table* %0, i8* %1, %struct.net_device* %2) {
%4 = tail call %struct.neighbour* @neigh_lookup(%struct.neigh_table* %0, i8* %1, %struct.net_device* %2)
%5 = icmp eq %struct.neighbour* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call %struct.neighbour* @neigh_create(%struct.neigh_table* %0, i8* %1, %struct.net_device* %2)
br label %8
8: ; preds = %3, %6
%9 = phi %struct.neighbour* [ %7, %6 ], [ %4, %3 ]
ret %struct.neighbour* %9
}