#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(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[] = "aabbccddeeffgghhiijjkkllmmnn";
  if (argc != 2) {
    fprintf(stderr, "%s <string>\n", argv[0]);
    return EXIT_FAILURE;
  }
  printf("old->%s\n", buf);
  printf("new->%s\n", del_str(buf, argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b0 <main+0x80>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e7 <main+0xb7>
lea    -0x30(%rbp),%rsi
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <del_str@plt>
mov    %rax,%rsi
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movups 0xecc(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
cmp    $0x2,%edi
jne    1187 <main+0x57>
lea    0xecd(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <del_str@plt>
lea    0xeb8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11a8 <main+0x78>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.buf = [29 x i8] c"aabbccddeeffgghhiijjkkllmmnn\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 [29 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [29 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 [29 x i8], [29 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 [29 x i8], [29 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(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 = [29 x i8] c"aabbccddeeffgghhiijjkkllmmnn\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 [29 x i8]
%4 = getelementptr inbounds [29 x i8], [29 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(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
}