#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_ndntlv_prependInterest(struct ccnl_prefix_s *, int, int *, int *,
                                unsigned char *);
int /*<<< orphan*/ memmove(unsigned char *, unsigned char *, int);
int ndntlv_mkInterest(struct ccnl_prefix_s *name, int *nonce,
                      unsigned char *out, int outlen) {
  int len, offset;
  offset = outlen;
  len = ccnl_ndntlv_prependInterest(name, -1, nonce, &offset, out);
  if (len > 0)
    memmove(out, out + offset, len);
  return len;
}


x86 assembly (clang, -O0):
<ndntlv_mkInterest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%r8
mov    $0xffffffff,%esi
lea    -0x24(%rbp),%rcx
call   1030 <ccnl_ndntlv_prependInterest@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    117b <ndntlv_mkInterest+0x5b>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%edx
call   1040 <memmove@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndntlv_mkInterest>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0xffffffff,%esi
mov    %rbx,%r8
call   1030 <ccnl_ndntlv_prependInterest@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1157 <ndntlv_mkInterest+0x37>
movslq 0x4(%rsp),%rsi
add    %rbx,%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <memmove@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.ccnl_prefix_s = type { i32 }
define i32 @ndntlv_mkInterest(%struct.ccnl_prefix_s* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca %struct.ccnl_prefix_s*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.ccnl_prefix_s* %0, %struct.ccnl_prefix_s** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
store i32 %11, i32* %10
%12 = load %struct.ccnl_prefix_s*, %struct.ccnl_prefix_s** %5
%13 = load i32*, i32** %6
%14 = load i8*, i8** %7
%15 = call i32 @ccnl_ndntlv_prependInterest(%struct.ccnl_prefix_s* %12, i32 -1, i32* %13, i32* %10, i8* %14)
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %4
%19 = load i8*, i8** %7
%20 = load i8*, i8** %7
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i32, i32* %9
%25 = call i32 @memmove(i8* %19, i8* %23, i32 %24)
br label %26
26: ; preds = %18, %4
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
%struct.ccnl_prefix_s = type { i32 }
define i32 @ndntlv_mkInterest(%struct.ccnl_prefix_s* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 %3, i32* %5
%7 = call i32 @ccnl_ndntlv_prependInterest(%struct.ccnl_prefix_s* %0, i32 -1, i32* %1, i32* %5, i8* %2)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %2, i64 %11
%13 = call i32 @memmove(i8* %2, i8* %12, i32 %7)
br label %14
14: ; preds = %9, %4
ret i32 %7
}