#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*/ printf(char *, char *);
char *str_del_all(char *, char *);
int main(int argc, char **argv) {
  char buf[] = "hello 
world 
 ni hao 
";
  printf("%s\n", str_del_all(buf, "
"));
  char buf2[] = "1212123456";
  printf("%s\n", str_del_all(buf2, "12"));
  char buf3[] = "1a31231b3";
  printf("%s\n", str_del_all(buf3, "1b3"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x21,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1050 <str_del_all@plt>
mov    %rax,%rsi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    0xea9(%rip),%rax
mov    %rax,-0x4b(%rbp)
mov    0xea6(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xe9e(%rip),%al
mov    %al,-0x41(%rbp)
lea    -0x4b(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1050 <str_del_all@plt>
mov    %rax,%rsi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    0xe79(%rip),%rax
mov    %rax,-0x55(%rbp)
mov    0xe76(%rip),%ax
mov    %ax,-0x4d(%rbp)
lea    -0x55(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1050 <str_del_all@plt>
mov    %rax,%rsi
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x40(%rsp)
lea    0xedc(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1040 <str_del_all@plt>
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
movabs $0x3433323132313231,%rax
32 33 34
mov    %rax,0x10(%rsp)
movl   $0x363534,0x17(%rsp)
lea    0xeb2(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1040 <str_del_all@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
movabs $0x6231333231336131,%rax
33 31 62
mov    %rax,(%rsp)
movw   $0x33,0x8(%rsp)
lea    0xe8a(%rip),%rsi
mov    %rsp,%rdi
call   1040 <str_del_all@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.buf = [33 x i8] c"hello 
world 
 ni hao 
\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"
\00"
@__const.main.buf2 = [11 x i8] c"1212123456\00"
@.str.2 = [3 x i8] c"12\00"
@__const.main.buf3 = [10 x i8] c"1a31231b3\00"
@.str.3 = [4 x i8] c"1b3\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [33 x i8]
%7 = alloca [11 x i8]
%8 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [33 x i8]* %6 to i8*
%10 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%11 = call i8* @str_del_all(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = bitcast [11 x i8]* %7 to i8*
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%15 = call i8* @str_del_all(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = bitcast [10 x i8]* %8 to i8*
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%19 = call i8* @str_del_all(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.buf = [33 x i8] c"hello 
world 
 ni hao 
\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"
\00"
@__const.main.buf2 = [11 x i8] c"1212123456\00"
@.str.2 = [3 x i8] c"12\00"
@__const.main.buf3 = [10 x i8] c"1a31231b3\00"
@.str.3 = [4 x i8] c"1b3\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [33 x i8]
%4 = alloca [11 x i8]
%5 = alloca [10 x i8]
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%7 = call i8* @str_del_all(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%10 = call i8* @str_del_all(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%13 = call i8* @str_del_all(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
ret i32 0
}