#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 *piece_delete_quote_comma(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void test_piece_delete_quote_comma(void) {
  char *string;
  char destination[16];
  string = "";
  printf("got string = (%s)\n", string);
  printf("should be (): is (%s)\n",
         piece_delete_quote_comma(destination, string, 0));
  string = "\"zero\"";
  printf("got string = (%s)\n", string);
  printf("should be (): is (%s)\n",
         piece_delete_quote_comma(destination, string, 0));
  string = "\"zero\",\"one\",\"two\"";
  printf("got string = (%s)\n", string);
  printf("should be (\"one\",\"two\"): is (%s)\n",
         piece_delete_quote_comma(destination, string, 0));
  printf("should be (\"zero\",\"two\"): is (%s)\n",
         piece_delete_quote_comma(destination, string, 1));
  printf("should be (\"zero\",\"one\"): is (%s)\n",
         piece_delete_quote_comma(destination, string, 2));
  printf("should be null: is (%s)\n",
         piece_delete_quote_comma(destination, string, 3));
}


x86 assembly (clang, -O0):
<test_piece_delete_quote_comma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x2,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %rax,%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_piece_delete_quote_comma>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%r15
lea    0xed9(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
lea    0xeb8(%rip),%r12
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xebd(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <piece_delete_quote_comma@plt>
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <piece_delete_quote_comma@plt>
lea    0xe91(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <piece_delete_quote_comma@plt>
lea    0xe95(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <piece_delete_quote_comma@plt>
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [19 x i8] c"got string = (%s)\0A\00"
@.str.2 = [23 x i8] c"should be (): is (%s)\0A\00"
@.str.3 = [7 x i8] c"\22zero\22\00"
@.str.4 = [19 x i8] c"\22zero\22,\22one\22,\22two\22\00"
@.str.5 = [34 x i8] c"should be (\22one\22,\22two\22): is (%s)\0A\00"
@.str.6 = [35 x i8] c"should be (\22zero\22,\22two\22): is (%s)\0A\00"
@.str.7 = [35 x i8] c"should be (\22zero\22,\22one\22): is (%s)\0A\00"
@.str.8 = [25 x i8] c"should be null: is (%s)\0A\00"
define void @test_piece_delete_quote_comma() {
%1 = alloca i8*
%2 = alloca [16 x i8]
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = load i8*, i8** %1
%7 = call i8* @piece_delete_quote_comma(i8* %5, i8* %6, i32 0)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %7)
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %1
%9 = load i8*, i8** %1
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = load i8*, i8** %1
%13 = call i8* @piece_delete_quote_comma(i8* %11, i8* %12, i32 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8** %1
%15 = load i8*, i8** %1
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%18 = load i8*, i8** %1
%19 = call i8* @piece_delete_quote_comma(i8* %17, i8* %18, i32 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%22 = load i8*, i8** %1
%23 = call i8* @piece_delete_quote_comma(i8* %21, i8* %22, i32 1)
%24 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%26 = load i8*, i8** %1
%27 = call i8* @piece_delete_quote_comma(i8* %25, i8* %26, i32 2)
%28 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%30 = load i8*, i8** %1
%31 = call i8* @piece_delete_quote_comma(i8* %29, i8* %30, i32 3)
%32 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %31)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [19 x i8] c"got string = (%s)\0A\00"
@.str.2 = [23 x i8] c"should be (): is (%s)\0A\00"
@.str.3 = [7 x i8] c"\22zero\22\00"
@.str.4 = [19 x i8] c"\22zero\22,\22one\22,\22two\22\00"
@.str.5 = [34 x i8] c"should be (\22one\22,\22two\22): is (%s)\0A\00"
@.str.6 = [35 x i8] c"should be (\22zero\22,\22two\22): is (%s)\0A\00"
@.str.7 = [35 x i8] c"should be (\22zero\22,\22one\22): is (%s)\0A\00"
@.str.8 = [25 x i8] c"should be null: is (%s)\0A\00"
define void @test_piece_delete_quote_comma() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%7 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 0)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%10 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%12 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 1)
%13 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%14 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 2)
%15 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %14)
%16 = call i8* @piece_delete_quote_comma(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 3)
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %16)
ret void
}