#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_dispatch {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ append_string_katcp(struct katcp_dispatch *, int, char *);
int basic_inform_katcp(struct katcp_dispatch *d, char *name, char *arg) {
  if (arg) {
    append_string_katcp(d, 0x10 | 0x01, name);
    append_string_katcp(d, 0x10 | 0x02, arg);
  } else {
    append_string_katcp(d, 0x10 | 0x01 | 0x02, name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<basic_inform_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1158 <basic_inform_katcp+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x11,%esi
call   1030 <append_string_katcp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x12,%esi
call   1030 <append_string_katcp@plt>
jmp    116a <basic_inform_katcp+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x13,%esi
call   1030 <append_string_katcp@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_inform_katcp>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%rbx
test   %r14,%r14
je     113c <basic_inform_katcp+0x2c>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <append_string_katcp@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
mov    %r14,%rdx
jmp    1144 <basic_inform_katcp+0x34>
mov    %rbx,%rdi
mov    $0x13,%esi
call   1030 <append_string_katcp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @basic_inform_katcp(%struct.katcp_dispatch* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @append_string_katcp(%struct.katcp_dispatch* %0, i32 17, i8* %1)
%7 = tail call i32 @append_string_katcp(%struct.katcp_dispatch* %0, i32 18, i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 @append_string_katcp(%struct.katcp_dispatch* %0, i32 19, i8* %1)
br label %10
10: ; preds = %8, %5
ret i32 0
}