#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*/ assert(int);
char *replace(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char line[] = "Hello, how are you, how is life ? Is everything ok ?";
  char *nline;
  char *expected;
  nline = replace(line, "how", "who");
  expected = "Hello, who are you, who is life ? Is everything ok ?";
  assert(strcmp(nline, expected) == 0);
  nline = replace(nline, "h", "w");
  expected = "Hello, wwo are you, wwo is life ? Is everytwing ok ?";
  assert(strcmp(nline, expected) == 0);
  nline = replace(nline, "f", "iww");
  expected = "Hello, wwo are you, wwo is liiwwe ? Is everytwing ok ?";
  assert(strcmp(nline, expected) == 0);
  nline = replace(nline, "w", "tiss");
  assert(strcmp(nline, "Hello, tisstisso are you, tisstisso is liitisstisse ? "
                       "Is everyttissing ok ?") == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x35,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    0xec6(%rip),%rsi
lea    0xec3(%rip),%rdx
call   1060 <replace@plt>
mov    %rax,-0x58(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x58(%rbp),%rdi
lea    0xebf(%rip),%rsi
lea    0xe7d(%rip),%rdx
call   1060 <replace@plt>
mov    %rax,-0x58(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x58(%rbp),%rdi
lea    0xeb2(%rip),%rsi
lea    0xead(%rip),%rdx
call   1060 <replace@plt>
mov    %rax,-0x58(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x58(%rbp),%rdi
lea    0xdfc(%rip),%rsi
lea    0xea4(%rip),%rdx
call   1060 <replace@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3f206b6f20676e,%rax
mov    %rax,0x2d(%rsp)
lea    0xec5(%rip),%rsi
lea    0xec2(%rip),%rdx
mov    %rsp,%rdi
call   1050 <replace@plt>
mov    %rax,%rbx
lea    0xeb4(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xecc(%rip),%rsi
lea    0xe8a(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <replace@plt>
mov    %rax,%rbx
lea    0xeb2(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xeca(%rip),%rsi
lea    0xec5(%rip),%rdx
mov    %rbx,%rdi
call   1050 <replace@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xed1(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <replace@plt>
lea    0xec4(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.line = [53 x i8] c"Hello, how are you, how is life ? Is everything ok ?\00"
@.str = [4 x i8] c"how\00"
@.str.1 = [4 x i8] c"who\00"
@.str.2 = [53 x i8] c"Hello, who are you, who is life ? Is everything ok ?\00"
@.str.3 = [2 x i8] c"h\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [53 x i8] c"Hello, wwo are you, wwo is life ? Is everytwing ok ?\00"
@.str.6 = [2 x i8] c"f\00"
@.str.7 = [4 x i8] c"iww\00"
@.str.8 = [55 x i8] c"Hello, wwo are you, wwo is liiwwe ? Is everytwing ok ?\00"
@.str.9 = [5 x i8] c"tiss\00"
@.str.10 = [76 x i8] c"Hello, tisstisso are you, tisstisso is liitisstisse ? Is everyttissing ok ?\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [53 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = bitcast [53 x i8]* %5 to i8*
%9 = getelementptr inbounds [53 x i8], [53 x i8]* %5, i64 0, i64 0
%10 = call i8* @replace(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %10, i8** %6
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8** %7
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i8*, i8** %6
%18 = call i8* @replace(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* %18, i8** %6
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i8** %7
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = call i64 @strcmp(i8* %19, i8* %20)
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load i8*, i8** %6
%26 = call i8* @replace(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
store i8* %26, i8** %6
store i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i8** %7
%27 = load i8*, i8** %6
%28 = load i8*, i8** %7
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i8*, i8** %6
%34 = call i8* @replace(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
store i8* %34, i8** %6
%35 = load i8*, i8** %6
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.10, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
ret i32 0
}

LLVM IR (-O2):
@__const.main.line = [53 x i8] c"Hello, how are you, how is life ? Is everything ok ?\00"
@.str = [4 x i8] c"how\00"
@.str.1 = [4 x i8] c"who\00"
@.str.2 = [53 x i8] c"Hello, who are you, who is life ? Is everything ok ?\00"
@.str.3 = [2 x i8] c"h\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [53 x i8] c"Hello, wwo are you, wwo is life ? Is everytwing ok ?\00"
@.str.6 = [2 x i8] c"f\00"
@.str.7 = [4 x i8] c"iww\00"
@.str.8 = [55 x i8] c"Hello, wwo are you, wwo is liiwwe ? Is everytwing ok ?\00"
@.str.9 = [5 x i8] c"tiss\00"
@.str.10 = [76 x i8] c"Hello, tisstisso are you, tisstisso is liitisstisse ? Is everyttissing ok ?\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [53 x i8]
%4 = getelementptr inbounds [53 x i8], [53 x i8]* %3, i64 0, i64 0
%5 = call i8* @replace(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i8* @replace(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i8* @replace(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i8* @replace(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.10, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
ret i32 0
}