#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 emit_header_file_header(FILE *fp) {
  fprintf(fp, "#include <stdint.h>\n"
              "#include <stdlib.h>\n\n");
  fprintf(fp,
          "struct qmi_tlv;\n"
          "\n"
          "struct qmi_tlv *qmi_tlv_init(unsigned txn, unsigned msg_id, "
          "unsigned type);\n"
          "struct qmi_tlv *qmi_tlv_decode(void *buf, size_t len, unsigned "
          "*txn, unsigned type);\n"
          "void *qmi_tlv_encode(struct qmi_tlv *tlv, size_t *len);\n"
          "void qmi_tlv_free(struct qmi_tlv *tlv);\n"
          "\n"
          "void *qmi_tlv_get(struct qmi_tlv *tlv, unsigned id, size_t *len);\n"
          "void *qmi_tlv_get_array(struct qmi_tlv *tlv, unsigned id, unsigned "
          "len_size, size_t *len, size_t *size);\n"
          "int qmi_tlv_set(struct qmi_tlv *tlv, unsigned id, void *buf, size_t "
          "len);\n"
          "int qmi_tlv_set_array(struct qmi_tlv *tlv, unsigned id, unsigned "
          "len_size, void *buf, size_t len, size_t size);\n"
          "\n");
}


x86 assembly (clang, -O0):
<emit_header_file_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xef3(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_header_file_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xef6(%rip),%rdi
mov    $0x279,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"#include <stdint.h>\0A#include <stdlib.h>\0A\0A\00"
@.str.1 = [634 x i8] c"struct qmi_tlv;\0A\0Astruct qmi_tlv *qmi_tlv_init(unsigned txn, unsigned msg_id, unsigned type);\0Astruct qmi_tlv *qmi_tlv_decode(void *buf, size_t len, unsigned *txn, unsigned type);\0Avoid *qmi_tlv_encode(struct qmi_tlv *tlv, size_t *len);\0Avoid qmi_tlv_free(struct qmi_tlv *tlv);\0A\0Avoid *qmi_tlv_get(struct qmi_tlv *tlv, unsigned id, size_t *len);\0Avoid *qmi_tlv_get_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, size_t *len, size_t *size);\0Aint qmi_tlv_set(struct qmi_tlv *tlv, unsigned id, void *buf, size_t len);\0Aint qmi_tlv_set_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, void *buf, size_t len, size_t size);\0A\0A\00"
define void @emit_header_file_header(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([634 x i8], [634 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"#include <stdint.h>\0A#include <stdlib.h>\0A\0A\00"
@.str.1 = [634 x i8] c"struct qmi_tlv;\0A\0Astruct qmi_tlv *qmi_tlv_init(unsigned txn, unsigned msg_id, unsigned type);\0Astruct qmi_tlv *qmi_tlv_decode(void *buf, size_t len, unsigned *txn, unsigned type);\0Avoid *qmi_tlv_encode(struct qmi_tlv *tlv, size_t *len);\0Avoid qmi_tlv_free(struct qmi_tlv *tlv);\0A\0Avoid *qmi_tlv_get(struct qmi_tlv *tlv, unsigned id, size_t *len);\0Avoid *qmi_tlv_get_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, size_t *len, size_t *size);\0Aint qmi_tlv_set(struct qmi_tlv *tlv, unsigned id, void *buf, size_t len);\0Aint qmi_tlv_set_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, void *buf, size_t len, size_t size);\0A\0A\00"
define void @emit_header_file_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 41, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([634 x i8], [634 x i8]* @.str.1, i64 0, i64 0), i64 633, i64 1, i32* %0)
ret void
}