#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_default_buffer_plugin(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)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_default_buffer_plugin>:
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)
jne    1154 <gui_bar_item_default_buffer_plugin+0x34>
movq   $0x0,-0x8(%rbp)
jmp    1196 <gui_bar_item_default_buffer_plugin+0x76>
mov    -0x28(%rbp),%rdi
call   1030 <gui_buffer_get_plugin_name@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     117e <gui_bar_item_default_buffer_plugin+0x5e>
mov    -0x38(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x40(%rbp)
jmp    118e <gui_bar_item_default_buffer_plugin+0x6e>
lea    0xe7b(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_bar_item_default_buffer_plugin>:
test   %rcx,%rcx
je     1140 <gui_bar_item_default_buffer_plugin+0x20>
push   %rax
mov    %rcx,%rdi
call   1030 <gui_buffer_get_plugin_name@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     1143 <gui_bar_item_default_buffer_plugin+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_default_buffer_plugin(i8* %0, %struct.t_gui_bar_item* %1, %struct.t_gui_window* %2, %struct.t_gui_buffer* %3, %struct.t_hashtable* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.t_gui_bar_item*
%9 = alloca %struct.t_gui_window*
%10 = alloca %struct.t_gui_buffer*
%11 = alloca %struct.t_hashtable*
%12 = alloca i8*
store i8* %0, i8** %7
store %struct.t_gui_bar_item* %1, %struct.t_gui_bar_item** %8
store %struct.t_gui_window* %2, %struct.t_gui_window** %9
store %struct.t_gui_buffer* %3, %struct.t_gui_buffer** %10
store %struct.t_hashtable* %4, %struct.t_hashtable** %11
%13 = load i8*, i8** %7
%14 = load %struct.t_gui_bar_item*, %struct.t_gui_bar_item** %8
%15 = load %struct.t_gui_window*, %struct.t_gui_window** %9
%16 = load %struct.t_hashtable*, %struct.t_hashtable** %11
%17 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %10
%18 = icmp ne %struct.t_gui_buffer* %17, null
br i1 %18, label %20, label %19
19: ; preds = %5
store i8* null, i8** %6
br label %32
20: ; preds = %5
%21 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %10
%22 = call i8* @gui_buffer_get_plugin_name(%struct.t_gui_buffer* %21)
store i8* %22, i8** %12
%23 = load i8*, i8** %12
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %12
%27 = call i8* @strdup(i8* %26)
br label %30
28: ; preds = %20
%29 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
%31 = phi i8* [ %27, %25 ], [ %29, %28 ]
store i8* %31, i8** %6
br label %32
32: ; preds = %30, %19
%33 = load i8*, i8** %6
ret i8* %33
}

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_default_buffer_plugin(i8* nocapture readnone %0, %struct.t_gui_bar_item* nocapture readnone %1, %struct.t_gui_window* nocapture readnone %2, %struct.t_gui_buffer* %3, %struct.t_hashtable* nocapture readnone %4) {
%6 = icmp eq %struct.t_gui_buffer* %3, null
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = tail call i8* @gui_buffer_get_plugin_name(%struct.t_gui_buffer* %3)
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i8* @strdup(i8* %8)
br label %14
12: ; preds = %7
%13 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %10, %12, %5
%15 = phi i8* [ null, %5 ], [ %11, %10 ], [ %13, %12 ]
ret i8* %15
}