#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 *);
int /*<<< orphan*/ replace(char *, char *, char *);
int main() {
  char string1[] = "receive_perceive_conceive_retrieve";
  replace(string1, "ei", "ei");
  char string2[] = "receive_perceive_conceive_retrieve";
  replace(string2, "ve", "1234");
  printf("%s\n", string1);
  printf("%s\n", string2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x23,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
lea    0xec4(%rip),%rdx
mov    %rdx,%rsi
call   1050 <replace@plt>
lea    -0x60(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x23,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xe9f(%rip),%rsi
lea    0xe9b(%rip),%rdx
call   1050 <replace@plt>
lea    -0x30(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
movaps 0xef0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0x657665,0x4f(%rsp)
lea    0xeb0(%rip),%rdx
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rdx,%rsi
call   1040 <replace@plt>
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x657665,0x1f(%rsp)
lea    0xe7d(%rip),%rsi
lea    0xe79(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <replace@plt>
lea    0xe6c(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string1 = [35 x i8] c"receive_perceive_conceive_retrieve\00"
@.str = [3 x i8] c"ei\00"
@__const.main.string2 = [35 x i8] c"receive_perceive_conceive_retrieve\00"
@.str.1 = [3 x i8] c"ve\00"
@.str.2 = [5 x i8] c"1234\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [35 x i8]
%3 = alloca [35 x i8]
store i32 0, i32* %1
%4 = bitcast [35 x i8]* %2 to i8*
%5 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 0
%6 = call i32 @replace(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = bitcast [35 x i8]* %3 to i8*
%8 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%9 = call i32 @replace(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ei\00"
@__const.main.string2 = [35 x i8] c"receive_perceive_conceive_retrieve\00"
@.str.1 = [3 x i8] c"ve\00"
@.str.2 = [5 x i8] c"1234\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [35 x i8]
%2 = alloca [35 x i8]
%3 = getelementptr inbounds [35 x i8], [35 x i8]* %1, i64 0, i64 0
%4 = call i32 @replace(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 0
%6 = call i32 @replace(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %5)
ret i32 0
}