#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*/ format_initial_capital(char *, char *);
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
int /*<<< orphan*/ piece_delete(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
int strlen(char *);
char *element_shift_first_label(char *data, char delimiter) {
  char piece_data[1024];
  char shifted_data[1024];
  char data_buffer[1024];
  strcpy(shifted_data, data);
  piece(piece_data, delimiter, data, 0);
  piece_delete(shifted_data, delimiter, 0);
  sprintf(shifted_data + strlen(shifted_data), "%c%s", delimiter, piece_data);
  format_initial_capital(data_buffer, shifted_data);
  return strdup(data_buffer);
}


x86 assembly (clang, -O0):
<element_shift_first_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rdx
xor    %ecx,%ecx
movsbl %al,%esi
call   1080 <piece@plt>
lea    -0x810(%rbp),%rdi
xor    %edx,%edx
movsbl -0x9(%rbp),%esi
call   1060 <piece_delete@plt>
lea    -0x810(%rbp),%rax
mov    %rax,-0xc18(%rbp)
lea    -0x810(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xc18(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x9(%rbp),%al
lea    -0x410(%rbp),%rcx
lea    0xe0a(%rip),%rsi
movsbl %al,%edx
call   1070 <sprintf@plt>
lea    -0xc10(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1050 <format_initial_capital@plt>
lea    -0xc10(%rbp),%rdi
call   1090 <strdup@plt>
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_shift_first_label>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc08,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x800(%rsp),%r15
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1080 <piece@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1060 <piece_delete@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
lea    0xe38(%rip),%rsi
mov    %ebp,%edx
mov    %r15,%rcx
call   1070 <sprintf@plt>
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <format_initial_capital@plt>
mov    %rbx,%rdi
call   1090 <strdup@plt>
add    $0xc08,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%s\00"
define i8* @element_shift_first_label(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8 %1, i8* %4
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = load i8, i8* %4
%13 = load i8*, i8** %3
%14 = call i32 @piece(i8* %11, i8 signext %12, i8* %13, i32 0)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = load i8, i8* %4
%17 = call i32 @piece_delete(i8* %15, i8 signext %16, i32 0)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %4
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%25 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %23, i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%28 = call i32 @format_initial_capital(i8* %26, i8* %27)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%30 = call i8* @strdup(i8* %29)
ret i8* %30
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%s\00"
define noalias i8* @element_shift_first_label(i8* %0, i8 signext %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = call i32 @strcpy(i8* %7, i8* %0)
%10 = call i32 @piece(i8* %6, i8 signext %1, i8* %0, i32 0)
%11 = call i32 @piece_delete(i8* %7, i8 signext %1, i32 0)
%12 = call i32 @strlen(i8* %7)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %13
%15 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %1, i8* %6)
%16 = call i32 @format_initial_capital(i8* %8, i8* %7)
%17 = call i8* @strdup(i8* %8)
ret i8* %17
}