#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_hashtable {
  int dummy;
};
struct t_gui_window {
  int dummy;
};
struct t_gui_buffer {
  int dummy;
};
struct t_gui_bar_item {
  int dummy;
};

/* Variables and functions */
char *gui_buffer_get_plugin_name(struct t_gui_buffer *);
char *strdup(char const *);
char *gui_bar_item_buffer_plugin_cb(const void *pointer, void *data,
                                    struct t_gui_bar_item *item,
                                    struct t_gui_window *window,
                                    struct t_gui_buffer *buffer,
                                    struct t_hashtable *extra_info) {
  const char *plugin_name;
  (void)pointer;
  (void)data;
  (void)item;
  (void)window;
  (void)extra_info;
  if (!buffer)
    return NULL;
  plugin_name = gui_buffer_get_plugin_name(buffer);
  return (plugin_name) ? strdup(plugin_name) : strdup("");
}


x86 assembly (clang, -O0):
<gui_bar_item_buffer_plugin_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1158 <gui_bar_item_buffer_plugin_cb+0x38>
movq   $0x0,-0x8(%rbp)
jmp    119a <gui_bar_item_buffer_plugin_cb+0x7a>
mov    -0x30(%rbp),%rdi
call   1030 <gui_buffer_get_plugin_name@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1182 <gui_bar_item_buffer_plugin_cb+0x62>
mov    -0x40(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x48(%rbp)
jmp    1192 <gui_bar_item_buffer_plugin_cb+0x72>
lea    0xe77(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_bar_item_buffer_plugin_cb>:
test   %r8,%r8
je     1140 <gui_bar_item_buffer_plugin_cb+0x20>
push   %rax
mov    %r8,%rdi
call   1030 <gui_buffer_get_plugin_name@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     1143 <gui_bar_item_buffer_plugin_cb+0x23>
mov    %rax,%rdi
jmp    1040 <strdup@plt>
xor    %eax,%eax
ret
lea    0xeb6(%rip),%rdi
jmp    1040 <strdup@plt>

LLVM IR (-O0):
%struct.t_gui_bar_item = type { i32 }
%struct.t_gui_window = type { i32 }
%struct.t_gui_buffer = type { i32 }
%struct.t_hashtable = type { i32 }
@.str = [1 x i8] zeroinitializer
define i8* @gui_bar_item_buffer_plugin_cb(i8* %0, i8* %1, %struct.t_gui_bar_item* %2, %struct.t_gui_window* %3, %struct.t_gui_buffer* %4, %struct.t_hashtable* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca %struct.t_gui_bar_item*
%11 = alloca %struct.t_gui_window*
%12 = alloca %struct.t_gui_buffer*
%13 = alloca %struct.t_hashtable*
%14 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store %struct.t_gui_bar_item* %2, %struct.t_gui_bar_item** %10
store %struct.t_gui_window* %3, %struct.t_gui_window** %11
store %struct.t_gui_buffer* %4, %struct.t_gui_buffer** %12
store %struct.t_hashtable* %5, %struct.t_hashtable** %13
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = load %struct.t_gui_bar_item*, %struct.t_gui_bar_item** %10
%18 = load %struct.t_gui_window*, %struct.t_gui_window** %11
%19 = load %struct.t_hashtable*, %struct.t_hashtable** %13
%20 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %12
%21 = icmp ne %struct.t_gui_buffer* %20, null
br i1 %21, label %23, label %22
22: ; preds = %6
store i8* null, i8** %7
br label %35
23: ; preds = %6
%24 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %12
%25 = call i8* @gui_buffer_get_plugin_name(%struct.t_gui_buffer* %24)
store i8* %25, i8** %14
%26 = load i8*, i8** %14
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i8*, i8** %14
%30 = call i8* @strdup(i8* %29)
br label %33
31: ; preds = %23
%32 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %31, %28
%34 = phi i8* [ %30, %28 ], [ %32, %31 ]
store i8* %34, i8** %7
br label %35
35: ; preds = %33, %22
%36 = load i8*, i8** %7
ret i8* %36
}

LLVM IR (-O2):
%struct.t_gui_bar_item = type { i32 }
%struct.t_gui_window = type { i32 }
%struct.t_gui_buffer = type { i32 }
%struct.t_hashtable = type { i32 }
@.str = [1 x i8] zeroinitializer
define noalias i8* @gui_bar_item_buffer_plugin_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, %struct.t_gui_bar_item* nocapture readnone %2, %struct.t_gui_window* nocapture readnone %3, %struct.t_gui_buffer* %4, %struct.t_hashtable* nocapture readnone %5) {
%7 = icmp eq %struct.t_gui_buffer* %4, null
br i1 %7, label %15, label %8
8: ; preds = %6
%9 = tail call i8* @gui_buffer_get_plugin_name(%struct.t_gui_buffer* %4)
%10 = icmp eq i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i8* @strdup(i8* %9)
br label %15
13: ; preds = %8
%14 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %13, %6
%16 = phi i8* [ null, %6 ], [ %12, %11 ], [ %14, %13 ]
ret i8* %16
}