#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_ccntlv_prependChunkInterestWithHdr(struct ccnl_prefix_s *, int *,
                                            unsigned char *);
int /*<<< orphan*/ memmove(unsigned char *, unsigned char *, int);
int ccntlv_mkInterest(struct ccnl_prefix_s *name, int *dummy,
                      unsigned char *out, int outlen) {
  (void)dummy;
  int len, offset;
  offset = outlen;
  len = ccnl_ccntlv_prependChunkInterestWithHdr(name, &offset, out);
  if (len > 0)
    memmove(out, out + offset, len);
  return len;
}


x86 assembly (clang, -O0):
<ccntlv_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    -0x18(%rbp),%rdx
lea    -0x24(%rbp),%rsi
call   1030 <ccnl_ccntlv_prependChunkInterestWithHdr@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    1172 <ccntlv_mkInterest+0x52>
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):
<ccntlv_mkInterest>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <ccnl_ccntlv_prependChunkInterestWithHdr@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    114c <ccntlv_mkInterest+0x2c>
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 @ccntlv_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** %6
%12 = load i32, i32* %8
store i32 %12, i32* %10
%13 = load %struct.ccnl_prefix_s*, %struct.ccnl_prefix_s** %5
%14 = load i8*, i8** %7
%15 = call i32 @ccnl_ccntlv_prependChunkInterestWithHdr(%struct.ccnl_prefix_s* %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 @ccntlv_mkInterest(%struct.ccnl_prefix_s* %0, i32* nocapture readnone %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 %3, i32* %5
%7 = call i32 @ccnl_ccntlv_prependChunkInterestWithHdr(%struct.ccnl_prefix_s* %0, 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
}