#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 */

/* Variables and functions */
int ccnl_ccnb_mkHeader(unsigned char *, int, int);
scalar_t__ ccnl_ccnb_mkStrBlob(unsigned char *, int, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int make_next_seg_debug_interest(int num, char *out) {
  int len = 0;
  unsigned char cp[100];
  sprintf((char *)cp, "seqnum-%d", num);
  len = ccnl_ccnb_mkHeader((unsigned char *)out, 26, 2);
  len += ccnl_ccnb_mkHeader((unsigned char *)out + len, 14, 2);
  len += ccnl_ccnb_mkStrBlob((unsigned char *)out + len, 15, 2, "mgmt");
  len += ccnl_ccnb_mkStrBlob((unsigned char *)out + len, 15, 2, (char *)cp);
  out[len++] = 0;
  out[len++] = 0;
  return len;
}


x86 assembly (clang, -O0):
<make_next_seg_debug_interest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea9(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1a,%esi
mov    $0x2,%edx
call   1050 <ccnl_ccnb_mkHeader@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    $0xe,%esi
mov    $0x2,%edx
call   1050 <ccnl_ccnb_mkHeader@plt>
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    $0xf,%esi
mov    $0x2,%edx
lea    0xe5c(%rip),%rcx
call   1030 <ccnl_ccnb_mkStrBlob@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    -0x80(%rbp),%rcx
mov    $0xf,%esi
mov    $0x2,%edx
call   1030 <ccnl_ccnb_mkStrBlob@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_next_seg_debug_interest>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r15
mov    %edi,%edx
lea    0xebb(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r15,%rdi
mov    $0x1a,%esi
mov    $0x2,%edx
call   1050 <ccnl_ccnb_mkHeader@plt>
movslq %eax,%rbx
lea    (%r15,%rbx,1),%rdi
mov    $0xe,%esi
mov    $0x2,%edx
call   1050 <ccnl_ccnb_mkHeader@plt>
add    %eax,%ebx
movslq %ebx,%rbx
lea    (%r15,%rbx,1),%rdi
lea    0xe82(%rip),%rcx
mov    $0xf,%esi
mov    $0x2,%edx
call   1030 <ccnl_ccnb_mkStrBlob@plt>
add    %eax,%ebx
movslq %ebx,%rbx
lea    (%r15,%rbx,1),%rdi
mov    $0xf,%esi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <ccnl_ccnb_mkStrBlob@plt>
lea    (%rbx,%rax,1),%ecx
movslq %ecx,%rcx
movw   $0x0,(%r15,%rcx,1)
add    %ebx,%eax
add    $0x2,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"seqnum-%d\00"
@.str.1 = [5 x i8] c"mgmt\00"
define i32 @make_next_seg_debug_interest(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [100 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %4
%11 = call i32 @ccnl_ccnb_mkHeader(i8* %10, i32 26, i32 2)
store i32 %11, i32* %5
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = call i32 @ccnl_ccnb_mkHeader(i8* %15, i32 14, i32 2)
%17 = load i32, i32* %5
%18 = add nsw i32 %17, %16
store i32 %18, i32* %5
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = call i64 @ccnl_ccnb_mkStrBlob(i8* %22, i32 15, i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = add nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %5
%28 = load i8*, i8** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i64 @ccnl_ccnb_mkStrBlob(i8* %31, i32 15, i32 2, i8* %32)
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %5
%38 = load i8*, i8** %4
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8 0, i8* %42
%43 = load i8*, i8** %4
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
store i8 0, i8* %47
%48 = load i32, i32* %5
ret i32 %48
}

LLVM IR (-O2):
@.str = [10 x i8] c"seqnum-%d\00"
@.str.1 = [5 x i8] c"mgmt\00"
define i32 @make_next_seg_debug_interest(i32 %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @ccnl_ccnb_mkHeader(i8* %1, i32 26, i32 2)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = tail call i32 @ccnl_ccnb_mkHeader(i8* %8, i32 14, i32 2)
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = tail call i64 @ccnl_ccnb_mkStrBlob(i8* %12, i32 15, i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%14 = trunc i64 %13 to i32
%15 = add i32 %10, %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
%18 = call i64 @ccnl_ccnb_mkStrBlob(i8* %17, i32 15, i32 2, i8* %4)
%19 = trunc i64 %18 to i32
%20 = add i32 %15, %19
%21 = add nsw i32 %20, 1
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8, i8* %1, i64 %22
store i8 0, i8* %23
%24 = add nsw i32 %20, 2
%25 = sext i32 %21 to i64
%26 = getelementptr inbounds i8, i8* %1, i64 %25
store i8 0, i8* %26
ret i32 %24
}