#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 */

/* Variables and functions */
char *plugin_get_name(int /*<<< orphan*/ *);
scalar_t__ strcmp(char const *, char *);
int gui_buffer_is_main(const char *plugin_name, const char *name) {
  if (plugin_name && (strcmp(plugin_name, plugin_get_name(NULL)) != 0))
    return 0;
  if (name && (strcmp(name, "weechat") != 0))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<gui_buffer_is_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <gui_buffer_is_main+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <plugin_get_name@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     116e <gui_buffer_is_main+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <gui_buffer_is_main+0x86>
cmpq   $0x0,-0x18(%rbp)
je     119f <gui_buffer_is_main+0x7f>
mov    -0x18(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     119f <gui_buffer_is_main+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <gui_buffer_is_main+0x86>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_buffer_is_main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %rdi,%rdi
je     114a <gui_buffer_is_main+0x2a>
mov    %rdi,%rbx
xor    %r15d,%r15d
xor    %edi,%edi
call   1030 <plugin_get_name@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    116c <gui_buffer_is_main+0x4c>
test   %r14,%r14
je     1166 <gui_buffer_is_main+0x46>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
xor    %r15d,%r15d
test   %rax,%rax
jne    116c <gui_buffer_is_main+0x4c>
mov    $0x1,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"weechat\00"
define i32 @gui_buffer_is_main(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i8* @plugin_get_name(i32* null)
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 0, i32* %3
br label %23
14: ; preds = %8, %2
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i8*, i8** %5
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %3
br label %23
22: ; preds = %17, %14
store i32 1, i32* %3
br label %23
23: ; preds = %22, %21, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [8 x i8] c"weechat\00"
define i32 @gui_buffer_is_main(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i8* @plugin_get_name(i32* null)
%6 = tail call i64 @strcmp(i8* %0, i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4, %2
%9 = icmp eq i8* %1, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %8
br label %14
14: ; preds = %10, %4, %13
%15 = phi i32 [ 1, %13 ], [ 0, %4 ], [ 0, %10 ]
ret i32 %15
}