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

/* Variables and functions */
int /*<<< orphan*/ gui_buffer_visited_remove(struct t_gui_buffer_visited *);
struct t_gui_buffer_visited *gui_buffer_visited_search(struct t_gui_buffer *);
void gui_buffer_visited_remove_by_buffer(struct t_gui_buffer *buffer) {
  struct t_gui_buffer_visited *buffer_visited;
  if (!buffer)
    return;
  buffer_visited = gui_buffer_visited_search(buffer);
  if (buffer_visited)
    gui_buffer_visited_remove(buffer_visited);
}


x86 assembly (clang, -O0):
<gui_buffer_visited_remove_by_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <gui_buffer_visited_remove_by_buffer+0x1c>
jmp    115d <gui_buffer_visited_remove_by_buffer+0x3d>
mov    -0x8(%rbp),%rdi
call   1030 <gui_buffer_visited_search@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <gui_buffer_visited_remove_by_buffer+0x3d>
mov    -0x10(%rbp),%rdi
call   1040 <gui_buffer_visited_remove@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_buffer_visited_remove_by_buffer>:
test   %rdi,%rdi
je     113d <gui_buffer_visited_remove_by_buffer+0x1d>
push   %rax
call   1030 <gui_buffer_visited_search@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     113d <gui_buffer_visited_remove_by_buffer+0x1d>
mov    %rax,%rdi
jmp    1040 <gui_buffer_visited_remove@plt>
ret

LLVM IR (-O0):
%struct.t_gui_buffer = type { i32 }
%struct.t_gui_buffer_visited = type { i32 }
define void @gui_buffer_visited_remove_by_buffer(%struct.t_gui_buffer* %0) {
%2 = alloca %struct.t_gui_buffer*
%3 = alloca %struct.t_gui_buffer_visited*
store %struct.t_gui_buffer* %0, %struct.t_gui_buffer** %2
%4 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %2
%5 = icmp ne %struct.t_gui_buffer* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
br label %15
7: ; preds = %1
%8 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %2
%9 = call %struct.t_gui_buffer_visited* @gui_buffer_visited_search(%struct.t_gui_buffer* %8)
store %struct.t_gui_buffer_visited* %9, %struct.t_gui_buffer_visited** %3
%10 = load %struct.t_gui_buffer_visited*, %struct.t_gui_buffer_visited** %3
%11 = icmp ne %struct.t_gui_buffer_visited* %10, null
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load %struct.t_gui_buffer_visited*, %struct.t_gui_buffer_visited** %3
%14 = call i32 @gui_buffer_visited_remove(%struct.t_gui_buffer_visited* %13)
br label %15
15: ; preds = %6, %12, %7
ret void
}

LLVM IR (-O2):
%struct.t_gui_buffer = type { i32 }
%struct.t_gui_buffer_visited = type { i32 }
define void @gui_buffer_visited_remove_by_buffer(%struct.t_gui_buffer* %0) {
%2 = icmp eq %struct.t_gui_buffer* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call %struct.t_gui_buffer_visited* @gui_buffer_visited_search(%struct.t_gui_buffer* %0)
%5 = icmp eq %struct.t_gui_buffer_visited* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @gui_buffer_visited_remove(%struct.t_gui_buffer_visited* %4)
br label %8
8: ; preds = %3, %6, %1
ret void
}