#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 *, char const *,
                           char const *);
void qmi_message_emit_message_prototype(FILE *fp, const char *package,
                                        const char *message) {
  fprintf(fp,
          "/*\n"
          " * %1$s_%2$s message\n"
          " */\n",
          package, message);
  fprintf(fp, "struct %1$s_%2$s *%1$s_%2$s_alloc(unsigned txn);\n", package,
          message);
  fprintf(fp,
          "struct %1$s_%2$s *%1$s_%2$s_parse(void *buf, size_t len, unsigned "
          "*txn);\n",
          package, message);
  fprintf(fp, "void *%1$s_%2$s_encode(struct %1$s_%2$s *%2$s, size_t *len);\n",
          package, message);
  fprintf(fp, "void %1$s_%2$s_free(struct %1$s_%2$s *%2$s);\n\n", package,
          message);
}


x86 assembly (clang, -O0):
<qmi_message_emit_message_prototype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xece(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xee8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xf1a(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xf40(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qmi_message_emit_message_prototype>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xedb(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
lea    0xee6(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
lea    0xf03(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
lea    0xf38(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
lea    0xf61(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"/*\0A * %1$s_%2$s message\0A */\0A\00"
@.str.1 = [50 x i8] c"struct %1$s_%2$s *%1$s_%2$s_alloc(unsigned txn);\0A\00"
@.str.2 = [74 x i8] c"struct %1$s_%2$s *%1$s_%2$s_parse(void *buf, size_t len, unsigned *txn);\0A\00"
@.str.3 = [62 x i8] c"void *%1$s_%2$s_encode(struct %1$s_%2$s *%2$s, size_t *len);\0A\00"
@.str.4 = [47 x i8] c"void %1$s_%2$s_free(struct %1$s_%2$s *%2$s);\0A\0A\00"
define void @qmi_message_emit_message_prototype(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i32*, i32** %4
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i32*, i32** %4
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i32*, i32** %4
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %24, i8* %25)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"/*\0A * %1$s_%2$s message\0A */\0A\00"
@.str.1 = [50 x i8] c"struct %1$s_%2$s *%1$s_%2$s_alloc(unsigned txn);\0A\00"
@.str.2 = [74 x i8] c"struct %1$s_%2$s *%1$s_%2$s_parse(void *buf, size_t len, unsigned *txn);\0A\00"
@.str.3 = [62 x i8] c"void *%1$s_%2$s_encode(struct %1$s_%2$s *%2$s, size_t *len);\0A\00"
@.str.4 = [47 x i8] c"void %1$s_%2$s_free(struct %1$s_%2$s *%2$s);\0A\0A\00"
define void @qmi_message_emit_message_prototype(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%6 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %2)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2)
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
ret void
}