#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 */
char *gettext(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *,
                            char *);
int strlen(char *);
void transfer_to_string(char *TLVdescription, char **combinedString,
                        char *TLVcontents) {
  int stringToBeFilled;
  if (507 < (strlen(TLVdescription) + strlen(TLVcontents) + 2)) {
    printf(gettext("String: %s is too long to be included as text and will be "
                   "skipped\n"),
           TLVcontents);
    return;
  }
  for (stringToBeFilled = 0; stringToBeFilled < 5; stringToBeFilled++) {
    if (507 > strlen(combinedString[stringToBeFilled]) +
                  strlen(TLVdescription) + strlen(TLVcontents) + 2)
      break;
  }
  snprintf(&combinedString[stringToBeFilled]
                          [strlen(combinedString[stringToBeFilled])],
           strlen(TLVdescription) + strlen(TLVcontents) + 2 + 2, "%s%s%s%s",
           TLVdescription, " ", TLVcontents, ". ");
}


x86 assembly (clang, -O0):
<transfer_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%ecx
add    %eax,%ecx
add    $0x2,%ecx
mov    $0x1fb,%eax
cmp    %ecx,%eax
jge    119b <transfer_to_string+0x5b>
lea    0xe7b(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1050 <printf@plt>
jmp    1284 <transfer_to_string+0x144>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1209 <transfer_to_string+0xc9>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%ecx
add    %eax,%ecx
add    $0x2,%ecx
mov    $0x1fb,%eax
cmp    %ecx,%eax
jle    11f6 <transfer_to_string+0xb6>
jmp    1209 <transfer_to_string+0xc9>
jmp    11fb <transfer_to_string+0xbb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a2 <transfer_to_string+0x62>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdi
add    %eax,%esi
add    $0x2,%esi
add    $0x2,%esi
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%r9
lea    0xdd6(%rip),%rdx
lea    0xdd9(%rip),%r8
lea    0xdd1(%rip),%rax
mov    %rax,(%rsp)
call   1060 <snprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_to_string>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
cmp    $0x1f9,%eax
jle    1190 <transfer_to_string+0x50>
lea    0xe8c(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
mov    %r12,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    (%r15),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebx,%eax
cmp    $0x1f9,%eax
jge    11be <transfer_to_string+0x7e>
xor    %ecx,%ecx
jmp    1278 <transfer_to_string+0x138>
mov    0x8(%r15),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
mov    $0x1,%ecx
cmp    $0x1f9,%eax
jl     1278 <transfer_to_string+0x138>
mov    0x10(%r15),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
mov    $0x2,%ecx
cmp    $0x1f9,%eax
jl     1278 <transfer_to_string+0x138>
mov    0x18(%r15),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
mov    $0x3,%ecx
cmp    $0x1f9,%eax
jl     1278 <transfer_to_string+0x138>
mov    0x20(%r15),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
xor    %ecx,%ecx
cmp    $0x1f9,%eax
setl   %cl
xor    $0x5,%rcx
mov    (%r15,%rcx,8),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rbp
add    %rbx,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%esi
add    $0x4,%esi
lea    0xda3(%rip),%rax
mov    %rax,(%rsp)
lea    0xd8f(%rip),%rdx
lea    0xd92(%rip),%r8
mov    %rbp,%rdi
mov    %r14,%rcx
mov    %r12,%r9
call   1060 <snprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [67 x i8] c"String: %s is too long to be included as text and will be skipped\0A\00"
@.str.1 = [9 x i8] c"%s%s%s%s\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c". \00"
define void @transfer_to_string(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %9, %11
%13 = add nsw i32 %12, 2
%14 = icmp slt i32 507, %13
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = call i8* @gettext(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %6
%18 = call i32 @printf(i8* %16, i8* %17)
br label %67
19: ; preds = %3
store i32 0, i32* %7
br label %20
20: ; preds = %40, %19
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load i8**, i8*** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strlen(i8* %28)
%30 = load i8*, i8** %4
%31 = call i32 @strlen(i8* %30)
%32 = add nsw i32 %29, %31
%33 = load i8*, i8** %6
%34 = call i32 @strlen(i8* %33)
%35 = add nsw i32 %32, %34
%36 = add nsw i32 %35, 2
%37 = icmp sgt i32 507, %36
br i1 %37, label %38, label %39
38: ; preds = %23
br label %43
39: ; preds = %23
br label %40
40: ; preds = %39
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %20
43: ; preds = %38, %20
%44 = load i8**, i8*** %5
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = load i8**, i8*** %5
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @strlen(i8* %53)
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %48, i64 %55
%57 = load i8*, i8** %4
%58 = call i32 @strlen(i8* %57)
%59 = load i8*, i8** %6
%60 = call i32 @strlen(i8* %59)
%61 = add nsw i32 %58, %60
%62 = add nsw i32 %61, 2
%63 = add nsw i32 %62, 2
%64 = load i8*, i8** %4
%65 = load i8*, i8** %6
%66 = call i32 @snprintf(i8* %56, i32 %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %67
67: ; preds = %43, %15
ret void
}

LLVM IR (-O2):
@.str = [67 x i8] c"String: %s is too long to be included as text and will be skipped\0A\00"
@.str.1 = [9 x i8] c"%s%s%s%s\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c". \00"
define void @transfer_to_string(i8* %0, i8** nocapture %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %2)
%6 = add nsw i32 %5, %4
%7 = icmp sgt i32 %6, 505
br i1 %7, label %16, label %8
8: ; preds = %3
%9 = load i8*, i8** %1
%10 = tail call i32 @strlen(i8* %9)
%11 = tail call i32 @strlen(i8* %0)
%12 = add nsw i32 %11, %10
%13 = tail call i32 @strlen(i8* %2)
%14 = add nsw i32 %12, %13
%15 = icmp slt i32 %14, 505
br i1 %15, label %56, label %19
16: ; preds = %3
%17 = tail call i8* @gettext(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @printf(i8* %17, i8* %2)
br label %68
19: ; preds = %8
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32 @strlen(i8* %21)
%23 = tail call i32 @strlen(i8* %0)
%24 = add nsw i32 %23, %22
%25 = tail call i32 @strlen(i8* %2)
%26 = add nsw i32 %24, %25
%27 = icmp slt i32 %26, 505
br i1 %27, label %56, label %28
28: ; preds = %19
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32 @strlen(i8* %30)
%32 = tail call i32 @strlen(i8* %0)
%33 = add nsw i32 %32, %31
%34 = tail call i32 @strlen(i8* %2)
%35 = add nsw i32 %33, %34
%36 = icmp slt i32 %35, 505
br i1 %36, label %56, label %37
37: ; preds = %28
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = tail call i32 @strlen(i8* %39)
%41 = tail call i32 @strlen(i8* %0)
%42 = add nsw i32 %41, %40
%43 = tail call i32 @strlen(i8* %2)
%44 = add nsw i32 %42, %43
%45 = icmp slt i32 %44, 505
br i1 %45, label %56, label %46
46: ; preds = %37
%47 = getelementptr inbounds i8*, i8** %1, i64 4
%48 = load i8*, i8** %47
%49 = tail call i32 @strlen(i8* %48)
%50 = tail call i32 @strlen(i8* %0)
%51 = add nsw i32 %50, %49
%52 = tail call i32 @strlen(i8* %2)
%53 = add nsw i32 %51, %52
%54 = icmp slt i32 %53, 505
%55 = select i1 %54, i64 4, i64 5
br label %56
56: ; preds = %46, %37, %28, %19, %8
%57 = phi i64 [ 0, %8 ], [ 1, %19 ], [ 2, %28 ], [ 3, %37 ], [ %55, %46 ]
%58 = getelementptr inbounds i8*, i8** %1, i64 %57
%59 = load i8*, i8** %58
%60 = tail call i32 @strlen(i8* %59)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = tail call i32 @strlen(i8* %0)
%64 = tail call i32 @strlen(i8* %2)
%65 = add i32 %63, 4
%66 = add i32 %65, %64
%67 = tail call i32 @snprintf(i8* %62, i32 %66, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %56, %16
ret void
}