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

/* Variables and functions */
int ccnl_cistlv_prependContent(struct ccnl_prefix_s *, unsigned char *, int,
                               unsigned int *, int *, int *, unsigned char *);
int /*<<< orphan*/ ccnl_cistlv_prependFixedHdr(int, int, int, unsigned char,
                                               int *, unsigned char *);
int ccnl_cistlv_prependContentWithHdr(struct ccnl_prefix_s *name,
                                      unsigned char *payload, int paylen,
                                      unsigned int *lastchunknum, int *offset,
                                      int *contentpos, unsigned char *buf) {
  int len, oldoffset;
  unsigned char hoplimit = 64;
  oldoffset = *offset;
  len = ccnl_cistlv_prependContent(name, payload, paylen, lastchunknum, offset,
                                   contentpos, buf);
  ccnl_cistlv_prependFixedHdr(1, 2, len, hoplimit, offset, buf);
  return oldoffset - *offset;
}


x86 assembly (clang, -O0):
<ccnl_cistlv_prependContentWithHdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movb   $0x40,-0x39(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <ccnl_cistlv_prependContent@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edx
mov    -0x39(%rbp),%al
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9
mov    $0x1,%edi
mov    $0x2,%esi
movzbl %al,%ecx
call   1040 <ccnl_cistlv_prependFixedHdr@plt>
mov    -0x38(%rbp),%eax
mov    -0x28(%rbp),%rcx
sub    (%rcx),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccnl_cistlv_prependContentWithHdr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
mov    0x30(%rsp),%r14
mov    (%r8),%ebp
mov    %r14,(%rsp)
call   1030 <ccnl_cistlv_prependContent@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x40,%ecx
mov    %rbx,%r8
mov    %r14,%r9
call   1040 <ccnl_cistlv_prependFixedHdr@plt>
sub    (%rbx),%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ccnl_prefix_s = type { i32 }
define i32 @ccnl_cistlv_prependContentWithHdr(%struct.ccnl_prefix_s* %0, i8* %1, i32 %2, i32* %3, i32* %4, i32* %5, i8* %6) {
%8 = alloca %struct.ccnl_prefix_s*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store %struct.ccnl_prefix_s* %0, %struct.ccnl_prefix_s** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i8* %6, i8** %14
store i8 64, i8* %17
%18 = load i32*, i32** %12
%19 = load i32, i32* %18
store i32 %19, i32* %16
%20 = load %struct.ccnl_prefix_s*, %struct.ccnl_prefix_s** %8
%21 = load i8*, i8** %9
%22 = load i32, i32* %10
%23 = load i32*, i32** %11
%24 = load i32*, i32** %12
%25 = load i32*, i32** %13
%26 = load i8*, i8** %14
%27 = call i32 @ccnl_cistlv_prependContent(%struct.ccnl_prefix_s* %20, i8* %21, i32 %22, i32* %23, i32* %24, i32* %25, i8* %26)
store i32 %27, i32* %15
%28 = load i32, i32* %15
%29 = load i8, i8* %17
%30 = load i32*, i32** %12
%31 = load i8*, i8** %14
%32 = call i32 @ccnl_cistlv_prependFixedHdr(i32 1, i32 2, i32 %28, i8 zeroext %29, i32* %30, i8* %31)
%33 = load i32, i32* %16
%34 = load i32*, i32** %12
%35 = load i32, i32* %34
%36 = sub nsw i32 %33, %35
ret i32 %36
}

LLVM IR (-O2):
%struct.ccnl_prefix_s = type { i32 }
define i32 @ccnl_cistlv_prependContentWithHdr(%struct.ccnl_prefix_s* %0, i8* %1, i32 %2, i32* %3, i32* %4, i32* %5, i8* %6) {
%8 = load i32, i32* %4
%9 = tail call i32 @ccnl_cistlv_prependContent(%struct.ccnl_prefix_s* %0, i8* %1, i32 %2, i32* %3, i32* %4, i32* %5, i8* %6)
%10 = tail call i32 @ccnl_cistlv_prependFixedHdr(i32 1, i32 2, i32 %9, i8 zeroext 64, i32* %4, i8* %6)
%11 = load i32, i32* %4
%12 = sub nsw i32 %8, %11
ret i32 %12
}