#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 /*<<< orphan*/ sprintf(char *, char *, char *);
char *element_delimit_drop_down_data(char *destination, char *source,
                                     int date_piece_offset) {
  char *anchor = destination;
  int piece_count;
  piece_count = 0;
  while (*source) {
    if (*source == '^') {
      destination += sprintf(destination, "%s", "---");
      source++;
      piece_count++;
      date_piece_offset = 0;
    } else {
      *destination++ = *source++;
    }
  }
  *destination = '\0';
  return anchor;
}


x86 assembly (clang, -O0):
<element_delimit_drop_down_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11be <element_delimit_drop_down_data+0xae>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5e,%eax
jne    1197 <element_delimit_drop_down_data+0x87>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    0xea2(%rip),%rdx
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    11b9 <element_delimit_drop_down_data+0xa9>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1132 <element_delimit_drop_down_data+0x22>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_delimit_drop_down_data>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    111e <element_delimit_drop_down_data+0x1e>
nopl   0x0(%rax,%rax,1)
movl   $0x2d2d2d,(%rcx)
add    $0x3,%rcx
add    $0x1,%rsi
movzbl (%rsi),%edx
cmp    $0x5e,%dl
je     1110 <element_delimit_drop_down_data+0x10>
test   %dl,%dl
je     1136 <element_delimit_drop_down_data+0x36>
mov    %dl,(%rcx)
add    $0x1,%rcx
add    $0x1,%rsi
jmp    111e <element_delimit_drop_down_data+0x1e>
movb   $0x0,(%rcx)
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"---\00"
define i8* @element_delimit_drop_down_data(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
store i8* %9, i8** %7
store i32 0, i32* %8
br label %10
10: ; preds = %35, %3
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %36
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 94
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8*, i8** %4
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds i8, i8* %22, i64 %23
store i8* %24, i8** %4
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
store i32 0, i32* %6
br label %35
29: ; preds = %14
%30 = load i8*, i8** %5
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %5
%32 = load i8, i8* %30
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %4
store i8 %32, i8* %33
br label %35
35: ; preds = %29, %19
br label %10
36: ; preds = %10
%37 = load i8*, i8** %4
store i8 0, i8* %37
%38 = load i8*, i8** %7
ret i8* %38
}

LLVM IR (-O2):
define i8* @element_delimit_drop_down_data(i8* returned writeonly %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %13, %3
%5 = phi i8* [ %1, %3 ], [ %15, %13 ]
%6 = phi i8* [ %0, %3 ], [ %14, %13 ]
%7 = load i8, i8* %5
switch i8 %7, label %11 [
i8 0, label %16
i8 94, label %8
]
8: ; preds = %4
%9 = bitcast i8* %6 to i32*
store i32 2960685, i32* %9
%10 = getelementptr inbounds i8, i8* %6, i64 3
br label %13
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %7, i8* %6
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
%15 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
16: ; preds = %4
store i8 0, i8* %6
ret i8* %0
}