#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 katcp_notice {
  int dummy;
};
struct katcp_dispatch {
  int dummy;
};
struct katcl_parse {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ configure_notice_katcp(struct katcp_dispatch *,
                                          struct katcp_notice *, int,
                                          int /*<<< orphan*/ *);
struct katcp_notice *find_notice_katcp(struct katcp_dispatch *, char *);
int /*<<< orphan*/ set_parse_notice_katcp(struct katcp_dispatch *,
                                          struct katcp_notice *,
                                          struct katcl_parse *);
int wake_name_notice_katcp(struct katcp_dispatch *d, char *name,
                           struct katcl_parse *p) {
  struct katcp_notice *n;
  n = find_notice_katcp(d, name);
  if (n == NULL) {
    return -1;
  }
  set_parse_notice_katcp(d, n, p);
  configure_notice_katcp(d, n, 1, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<wake_name_notice_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <find_notice_katcp@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116c <wake_name_notice_katcp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    119a <wake_name_notice_katcp+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <set_parse_notice_katcp@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <configure_notice_katcp@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wake_name_notice_katcp>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%r15
call   1040 <find_notice_katcp@plt>
test   %rax,%rax
je     116d <wake_name_notice_katcp+0x3d>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1030 <set_parse_notice_katcp@plt>
xor    %r14d,%r14d
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1050 <configure_notice_katcp@plt>
jmp    1173 <wake_name_notice_katcp+0x43>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
%struct.katcl_parse = type { i32 }
%struct.katcp_notice = type { i32 }
define i32 @wake_name_notice_katcp(%struct.katcp_dispatch* %0, i8* %1, %struct.katcl_parse* %2) {
%4 = alloca i32
%5 = alloca %struct.katcp_dispatch*
%6 = alloca i8*
%7 = alloca %struct.katcl_parse*
%8 = alloca %struct.katcp_notice*
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %5
store i8* %1, i8** %6
store %struct.katcl_parse* %2, %struct.katcl_parse** %7
%9 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %5
%10 = load i8*, i8** %6
%11 = call %struct.katcp_notice* @find_notice_katcp(%struct.katcp_dispatch* %9, i8* %10)
store %struct.katcp_notice* %11, %struct.katcp_notice** %8
%12 = load %struct.katcp_notice*, %struct.katcp_notice** %8
%13 = icmp eq %struct.katcp_notice* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 -1, i32* %4
br label %23
15: ; preds = %3
%16 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %5
%17 = load %struct.katcp_notice*, %struct.katcp_notice** %8
%18 = load %struct.katcl_parse*, %struct.katcl_parse** %7
%19 = call i32 @set_parse_notice_katcp(%struct.katcp_dispatch* %16, %struct.katcp_notice* %17, %struct.katcl_parse* %18)
%20 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %5
%21 = load %struct.katcp_notice*, %struct.katcp_notice** %8
%22 = call i32 @configure_notice_katcp(%struct.katcp_dispatch* %20, %struct.katcp_notice* %21, i32 1, i32* null)
store i32 0, i32* %4
br label %23
23: ; preds = %15, %14
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
%struct.katcl_parse = type { i32 }
%struct.katcp_notice = type { i32 }
define i32 @wake_name_notice_katcp(%struct.katcp_dispatch* %0, i8* %1, %struct.katcl_parse* %2) {
%4 = tail call %struct.katcp_notice* @find_notice_katcp(%struct.katcp_dispatch* %0, i8* %1)
%5 = icmp eq %struct.katcp_notice* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @set_parse_notice_katcp(%struct.katcp_dispatch* %0, %struct.katcp_notice* %4, %struct.katcl_parse* %2)
%8 = tail call i32 @configure_notice_katcp(%struct.katcp_dispatch* %0, %struct.katcp_notice* %4, i32 1, i32* null)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %10
}