#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 */
scalar_t__ count_characters(char, char *);
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
int /*<<< orphan*/ piece_delete(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ piece_insert(char *, char, char *, scalar_t__);
char *piece_shift_left(char *source_destination, char delimiter) {
  char data[2048];
  piece(data, delimiter, source_destination, 0);
  piece_insert(source_destination, delimiter, data,
               count_characters(delimiter, source_destination) + 1);
  piece_delete(source_destination, delimiter, 0);
  return source_destination;
}


x86 assembly (clang, -O0):
<piece_shift_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rdx
xor    %ecx,%ecx
movsbl %al,%esi
call   1050 <piece@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x811(%rbp)
lea    -0x810(%rbp),%rax
mov    %rax,-0x820(%rbp)
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1060 <count_characters@plt>
mov    -0x828(%rbp),%rdi
mov    -0x820(%rbp),%rdx
mov    %rax,%rcx
mov    -0x811(%rbp),%al
add    $0x1,%rcx
movsbl %al,%esi
call   1040 <piece_insert@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
movsbl -0x9(%rbp),%esi
call   1030 <piece_delete@plt>
mov    -0x8(%rbp),%rax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<piece_shift_left>:
push   %rbp
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1050 <piece@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <count_characters@plt>
lea    0x1(%rax),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <piece_insert@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1030 <piece_delete@plt>
mov    %rbx,%rax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @piece_shift_left(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [2048 x i8]
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = load i8, i8* %4
%8 = load i8*, i8** %3
%9 = call i32 @piece(i8* %6, i8 signext %7, i8* %8, i32 0)
%10 = load i8*, i8** %3
%11 = load i8, i8* %4
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%13 = load i8, i8* %4
%14 = load i8*, i8** %3
%15 = call i64 @count_characters(i8 signext %13, i8* %14)
%16 = add nsw i64 %15, 1
%17 = call i32 @piece_insert(i8* %10, i8 signext %11, i8* %12, i64 %16)
%18 = load i8*, i8** %3
%19 = load i8, i8* %4
%20 = call i32 @piece_delete(i8* %18, i8 signext %19, i32 0)
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
define i8* @piece_shift_left(i8* returned %0, i8 signext %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = call i32 @piece(i8* %4, i8 signext %1, i8* %0, i32 0)
%6 = call i64 @count_characters(i8 signext %1, i8* %0)
%7 = add nsw i64 %6, 1
%8 = call i32 @piece_insert(i8* %0, i8 signext %1, i8* %4, i64 %7)
%9 = call i32 @piece_delete(i8* %0, i8 signext %1, i32 0)
ret i8* %0
}