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

/* Variables and functions */
int /*<<< orphan*/ gui_buffer_valid(void *);
int /*<<< orphan*/ gui_nicklist_add_to_infolist(struct t_infolist *, void *,
                                                char const *);
int /*<<< orphan*/ infolist_free(struct t_infolist *);
struct t_infolist *infolist_new(int /*<<< orphan*/ *);
struct t_infolist *plugin_api_infolist_nicklist_cb(const void *pointer,
                                                   void *data,
                                                   const char *infolist_name,
                                                   void *obj_pointer,
                                                   const char *arguments) {
  struct t_infolist *ptr_infolist;
  (void)pointer;
  (void)data;
  (void)infolist_name;
  if (!obj_pointer || (!gui_buffer_valid(obj_pointer)))
    return NULL;
  ptr_infolist = infolist_new(NULL);
  if (!ptr_infolist)
    return NULL;
  if (!gui_nicklist_add_to_infolist(ptr_infolist, obj_pointer, arguments)) {
    infolist_free(ptr_infolist);
    return NULL;
  }
  return ptr_infolist;
}


x86 assembly (clang, -O0):
<plugin_api_infolist_nicklist_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1179 <plugin_api_infolist_nicklist_cb+0x39>
mov    -0x28(%rbp),%rdi
call   1030 <gui_buffer_valid@plt>
cmp    $0x0,%eax
jne    1186 <plugin_api_infolist_nicklist_cb+0x46>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <plugin_api_infolist_nicklist_cb+0xa3>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <infolist_new@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11ab <plugin_api_infolist_nicklist_cb+0x6b>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <plugin_api_infolist_nicklist_cb+0xa3>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <gui_nicklist_add_to_infolist@plt>
cmp    $0x0,%eax
jne    11db <plugin_api_infolist_nicklist_cb+0x9b>
mov    -0x38(%rbp),%rdi
call   1060 <infolist_free@plt>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <plugin_api_infolist_nicklist_cb+0xa3>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plugin_api_infolist_nicklist_cb>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rcx,%rcx
je     1190 <plugin_api_infolist_nicklist_cb+0x50>
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rcx,%rdi
call   1030 <gui_buffer_valid@plt>
test   %eax,%eax
je     1190 <plugin_api_infolist_nicklist_cb+0x50>
xor    %r15d,%r15d
xor    %edi,%edi
call   1040 <infolist_new@plt>
test   %rax,%rax
je     1193 <plugin_api_infolist_nicklist_cb+0x53>
mov    %rax,%r12
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <gui_nicklist_add_to_infolist@plt>
test   %eax,%eax
je     1188 <plugin_api_infolist_nicklist_cb+0x48>
mov    %r12,%r15
jmp    1193 <plugin_api_infolist_nicklist_cb+0x53>
mov    %r12,%rdi
call   1060 <infolist_free@plt>
xor    %r15d,%r15d
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.t_infolist = type { i32 }
define %struct.t_infolist* @plugin_api_infolist_nicklist_cb(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca %struct.t_infolist*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.t_infolist*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %5
%19 = load i8*, i8** %10
%20 = call i32 @gui_buffer_valid(i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %18, %5
store %struct.t_infolist* null, %struct.t_infolist** %6
br label %39
23: ; preds = %18
%24 = call %struct.t_infolist* @infolist_new(i32* null)
store %struct.t_infolist* %24, %struct.t_infolist** %12
%25 = load %struct.t_infolist*, %struct.t_infolist** %12
%26 = icmp ne %struct.t_infolist* %25, null
br i1 %26, label %28, label %27
27: ; preds = %23
store %struct.t_infolist* null, %struct.t_infolist** %6
br label %39
28: ; preds = %23
%29 = load %struct.t_infolist*, %struct.t_infolist** %12
%30 = load i8*, i8** %10
%31 = load i8*, i8** %11
%32 = call i32 @gui_nicklist_add_to_infolist(%struct.t_infolist* %29, i8* %30, i8* %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %28
%35 = load %struct.t_infolist*, %struct.t_infolist** %12
%36 = call i32 @infolist_free(%struct.t_infolist* %35)
store %struct.t_infolist* null, %struct.t_infolist** %6
br label %39
37: ; preds = %28
%38 = load %struct.t_infolist*, %struct.t_infolist** %12
store %struct.t_infolist* %38, %struct.t_infolist** %6
br label %39
39: ; preds = %37, %34, %27, %22
%40 = load %struct.t_infolist*, %struct.t_infolist** %6
ret %struct.t_infolist* %40
}

LLVM IR (-O2):
%struct.t_infolist = type { i32 }
define %struct.t_infolist* @plugin_api_infolist_nicklist_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %3, null
br i1 %6, label %18, label %7
7: ; preds = %5
%8 = tail call i32 @gui_buffer_valid(i8* %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = tail call %struct.t_infolist* @infolist_new(i32* null)
%12 = icmp eq %struct.t_infolist* %11, null
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = tail call i32 @gui_nicklist_add_to_infolist(%struct.t_infolist* %11, i8* %3, i8* %4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @infolist_free(%struct.t_infolist* %11)
br label %18
18: ; preds = %13, %10, %5, %7, %16
%19 = phi %struct.t_infolist* [ null, %16 ], [ null, %7 ], [ null, %5 ], [ null, %10 ], [ %11, %13 ]
ret %struct.t_infolist* %19
}