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

/* Variables and functions */
int /*<<< orphan*/ gui_window_scroll_free(struct t_gui_window *,
                                          struct t_gui_window_scroll *);
struct t_gui_window_scroll *gui_window_scroll_search(struct t_gui_window *,
                                                     struct t_gui_buffer *);
void gui_window_scroll_remove_buffer(struct t_gui_window *window,
                                     struct t_gui_buffer *buffer) {
  struct t_gui_window_scroll *ptr_scroll;
  if (window && buffer) {
    ptr_scroll = gui_window_scroll_search(window, buffer);
    if (ptr_scroll)
      gui_window_scroll_free(window, ptr_scroll);
  }
}


x86 assembly (clang, -O0):
<gui_window_scroll_remove_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1174 <gui_window_scroll_remove_buffer+0x54>
cmpq   $0x0,-0x10(%rbp)
je     1174 <gui_window_scroll_remove_buffer+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gui_window_scroll_search@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116f <gui_window_scroll_remove_buffer+0x4f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <gui_window_scroll_free@plt>
jmp    1174 <gui_window_scroll_remove_buffer+0x54>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_window_scroll_remove_buffer>:
push   %rbx
test   %rdi,%rdi
je     1144 <gui_window_scroll_remove_buffer+0x24>
test   %rsi,%rsi
je     1144 <gui_window_scroll_remove_buffer+0x24>
mov    %rdi,%rbx
call   1030 <gui_window_scroll_search@plt>
test   %rax,%rax
je     1144 <gui_window_scroll_remove_buffer+0x24>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <gui_window_scroll_free@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.t_gui_window = type { i32 }
%struct.t_gui_buffer = type { i32 }
%struct.t_gui_window_scroll = type { i32 }
define void @gui_window_scroll_remove_buffer(%struct.t_gui_window* %0, %struct.t_gui_buffer* %1) {
%3 = alloca %struct.t_gui_window*
%4 = alloca %struct.t_gui_buffer*
%5 = alloca %struct.t_gui_window_scroll*
store %struct.t_gui_window* %0, %struct.t_gui_window** %3
store %struct.t_gui_buffer* %1, %struct.t_gui_buffer** %4
%6 = load %struct.t_gui_window*, %struct.t_gui_window** %3
%7 = icmp ne %struct.t_gui_window* %6, null
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %4
%10 = icmp ne %struct.t_gui_buffer* %9, null
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load %struct.t_gui_window*, %struct.t_gui_window** %3
%13 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %4
%14 = call %struct.t_gui_window_scroll* @gui_window_scroll_search(%struct.t_gui_window* %12, %struct.t_gui_buffer* %13)
store %struct.t_gui_window_scroll* %14, %struct.t_gui_window_scroll** %5
%15 = load %struct.t_gui_window_scroll*, %struct.t_gui_window_scroll** %5
%16 = icmp ne %struct.t_gui_window_scroll* %15, null
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load %struct.t_gui_window*, %struct.t_gui_window** %3
%19 = load %struct.t_gui_window_scroll*, %struct.t_gui_window_scroll** %5
%20 = call i32 @gui_window_scroll_free(%struct.t_gui_window* %18, %struct.t_gui_window_scroll* %19)
br label %21
21: ; preds = %17, %11
br label %22
22: ; preds = %21, %8, %2
ret void
}

LLVM IR (-O2):
%struct.t_gui_window = type { i32 }
%struct.t_gui_buffer = type { i32 }
%struct.t_gui_window_scroll = type { i32 }
define void @gui_window_scroll_remove_buffer(%struct.t_gui_window* %0, %struct.t_gui_buffer* %1) {
%3 = icmp ne %struct.t_gui_window* %0, null
%4 = icmp ne %struct.t_gui_buffer* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call %struct.t_gui_window_scroll* @gui_window_scroll_search(%struct.t_gui_window* %0, %struct.t_gui_buffer* %1)
%8 = icmp eq %struct.t_gui_window_scroll* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @gui_window_scroll_free(%struct.t_gui_window* %0, %struct.t_gui_window_scroll* %7)
br label %11
11: ; preds = %6, %9, %2
ret void
}