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

/* Variables and functions */
struct t_gui_key *gui_key_new(struct t_gui_buffer *, int, char const *,
                              char const *);
int /*<<< orphan*/ gui_key_unbind(struct t_gui_buffer *, int, char const *);
scalar_t__ string_strcasecmp(char const *, char *);
struct t_gui_key *gui_key_bind(struct t_gui_buffer *buffer, int context,
                               const char *key, const char *command) {
  if (!key || !command || (string_strcasecmp(key, "meta-") == 0))
    return NULL;
  gui_key_unbind(buffer, context, key);
  return gui_key_new(buffer, context, key, command);
}


x86 assembly (clang, -O0):
<gui_key_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1177 <gui_key_bind+0x47>
cmpq   $0x0,-0x28(%rbp)
je     1177 <gui_key_bind+0x47>
mov    -0x20(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    1184 <gui_key_bind+0x54>
movq   $0x0,-0x8(%rbp)
jmp    11ac <gui_key_bind+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <gui_key_unbind@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1050 <gui_key_new@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_key_bind>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdx,%rdx
je     118a <gui_key_bind+0x5a>
mov    %rcx,%r14
test   %rcx,%rcx
je     118a <gui_key_bind+0x5a>
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%rbp
lea    0xeac(%rip),%rsi
mov    %rdx,%rdi
call   1040 <string_strcasecmp@plt>
test   %rax,%rax
je     118a <gui_key_bind+0x5a>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1030 <gui_key_unbind@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <gui_key_new@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.t_gui_key = type { i32 }
%struct.t_gui_buffer = type { i32 }
@.str = [6 x i8] c"meta-\00"
define %struct.t_gui_key* @gui_key_bind(%struct.t_gui_buffer* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca %struct.t_gui_key*
%6 = alloca %struct.t_gui_buffer*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store %struct.t_gui_buffer* %0, %struct.t_gui_buffer** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load i8*, i8** %8
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load i8*, i8** %9
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %8
%17 = call i64 @string_strcasecmp(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15, %12, %4
store %struct.t_gui_key* null, %struct.t_gui_key** %5
br label %30
20: ; preds = %15
%21 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %6
%22 = load i32, i32* %7
%23 = load i8*, i8** %8
%24 = call i32 @gui_key_unbind(%struct.t_gui_buffer* %21, i32 %22, i8* %23)
%25 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %6
%26 = load i32, i32* %7
%27 = load i8*, i8** %8
%28 = load i8*, i8** %9
%29 = call %struct.t_gui_key* @gui_key_new(%struct.t_gui_buffer* %25, i32 %26, i8* %27, i8* %28)
store %struct.t_gui_key* %29, %struct.t_gui_key** %5
br label %30
30: ; preds = %20, %19
%31 = load %struct.t_gui_key*, %struct.t_gui_key** %5
ret %struct.t_gui_key* %31
}

LLVM IR (-O2):
%struct.t_gui_key = type { i32 }
%struct.t_gui_buffer = type { i32 }
@.str = [6 x i8] c"meta-\00"
define %struct.t_gui_key* @gui_key_bind(%struct.t_gui_buffer* %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp ne i8* %2, null
%6 = icmp ne i8* %3, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = tail call i64 @string_strcasecmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 @gui_key_unbind(%struct.t_gui_buffer* %0, i32 %1, i8* %2)
%13 = tail call %struct.t_gui_key* @gui_key_new(%struct.t_gui_buffer* %0, i32 %1, i8* %2, i8* %3)
br label %14
14: ; preds = %4, %8, %11
%15 = phi %struct.t_gui_key* [ %13, %11 ], [ null, %8 ], [ null, %4 ]
ret %struct.t_gui_key* %15
}