#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 EXIT_FAILURE;
char *del_str_all(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char buf[] = "aabbaaccbbddeeffgghhiijjkkllmmnn";
  if (argc != 2) {
    fprintf(stderr, "%s <string>\n", argv[0]);
    return EXIT_FAILURE;
  }
  printf("old->%s\n", buf);
  printf("new->%s\n", del_str_all(buf, argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x21,%edx
call   1050 <memcpy@plt>
cmpl   $0x2,-0x8(%rbp)
je     11a2 <main+0x62>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe95(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d9 <main+0x99>
lea    -0x40(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1060 <del_str_all@plt>
mov    %rax,%rsi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x20(%rsp)
cmp    $0x2,%edi
jne    118c <main+0x5c>
lea    0xecc(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1030 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1050 <del_str_all@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    11ad <main+0x7d>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe82(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.buf = [33 x i8] c"aabbaaccbbddeeffgghhiijjkkllmmnn\00"
@stderr = global i32 0
@.str = [13 x i8] c"%s <string>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"old->%s\0A\00"
@.str.2 = [9 x i8] c"new->%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [33 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [33 x i8]* %6 to i8*
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
store i32 %16, i32* %3
br label %26
17: ; preds = %2
%18 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i8* @del_str_all(i8* %20, i8* %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %24)
store i32 0, i32* %3
br label %26
26: ; preds = %17, %10
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@__const.main.buf = [33 x i8] c"aabbaaccbbddeeffgghhiijjkkllmmnn\00"
@stderr = global i32 0
@.str = [13 x i8] c"%s <string>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"old->%s\0A\00"
@.str.2 = [9 x i8] c"new->%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [33 x i8]
%4 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
br label %17
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i8* @del_str_all(i8* %4, i8* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %11, %6
%18 = phi i32 [ %10, %6 ], [ 0, %11 ]
ret i32 %18
}