#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void gen_proto_handoff(FILE *f, const char *proto_name) {
  do {
    if (f)
      fprintf(f,
              "void\n"
              "proto_reg_handoff_%s(void)\n"
              "{\n",
              proto_name);
  } while (0);
  do {
    if (f)
      fprintf(f,
              "\tdissector_handle_t %s_handle = "
              "create_dissector_handle(dissect_%s, proto_%s);\n",
              proto_name, proto_name, proto_name);
  } while (0);
  do {
    if (f)
      fprintf(f, "}\n\n");
  } while (0);
}


x86 assembly (clang, -O0):
<gen_proto_handoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1141 <gen_proto_handoff+0x31>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1146 <gen_proto_handoff+0x36>
jmp    114b <gen_proto_handoff+0x3b>
cmpq   $0x0,-0x8(%rbp)
je     1174 <gen_proto_handoff+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1179 <gen_proto_handoff+0x69>
jmp    117e <gen_proto_handoff+0x6e>
cmpq   $0x0,-0x8(%rbp)
je     119b <gen_proto_handoff+0x8b>
mov    -0x8(%rbp),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a0 <gen_proto_handoff+0x90>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_proto_handoff>:
test   %rdi,%rdi
je     117a <gen_proto_handoff+0x5a>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeca(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xedc(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf12(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>
ret

LLVM IR (-O0):
@.str = [35 x i8] c"void\0Aproto_reg_handoff_%s(void)\0A{\0A\00"
@.str.1 = [80 x i8] c"\09dissector_handle_t %s_handle = create_dissector_handle(dissect_%s, proto_%s);\0A\00"
@.str.2 = [4 x i8] c"}\0A\0A\00"
define void @gen_proto_handoff(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32*, i32** %3
%10 = load i8*, i8** %4
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %5
br label %13
13: ; preds = %12
br label %14
14: ; preds = %13
%15 = load i32*, i32** %3
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32*, i32** %3
%19 = load i8*, i8** %4
%20 = load i8*, i8** %4
%21 = load i8*, i8** %4
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20, i8* %21)
br label %23
23: ; preds = %17, %14
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = load i32*, i32** %3
%27 = icmp ne i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32*, i32** %3
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %28, %25
br label %32
32: ; preds = %31
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"void\0Aproto_reg_handoff_%s(void)\0A{\0A\00"
@.str.1 = [80 x i8] c"\09dissector_handle_t %s_handle = create_dissector_handle(dissect_%s, proto_%s);\0A\00"
@.str.2 = [4 x i8] c"}\0A\0A\00"
define void @gen_proto_handoff(i32* %0, i8* %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %1, i8* %1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 3, i64 1, i32* %0)
br label %8
8: ; preds = %2, %4
ret void
}