#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";
  replace(string1, "ei", "99");
  char string2[] = "receive";
  replace(string2, "ive", "12");
  printf("%s\n", string1);
  printf("%s\n", string2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
lea    0xec3(%rip),%rsi
lea    0xebf(%rip),%rdx
call   1040 <replace@plt>
mov    0xea8(%rip),%rax
mov    %rax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    0xea0(%rip),%rdx
call   1040 <replace@plt>
lea    -0xc(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    -0x14(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movabs $0x65766965636572,%rbx
mov    %rbx,0x8(%rsp)
lea    0xec1(%rip),%rsi
lea    0xebd(%rip),%rdx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <replace@plt>
mov    %rbx,(%rsp)
lea    0xea8(%rip),%rsi
lea    0xea5(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <replace@plt>
lea    0xe96(%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    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"ei\00"
@.str.1 = [3 x i8] c"99\00"
@.str.2 = [4 x i8] c"ive\00"
@.str.3 = [3 x i8] c"12\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 28559167692432754, i64* %1
%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.1, i64 0, i64 0))
%5 = bitcast i64* %2 to i8*
store i64 28559167692432754, i64* %2
%6 = call i32 @replace(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %5)
ret i32 0
}