#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);
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ replaceSpaces(char *);
void testReplace() {
  char *test = (char *)malloc(7 * sizeof(char));
  test[0] = 'a';
  test[1] = 'b';
  test[2] = ' ';
  test[3] = ' ';
  test[4] = 'd';
  test[5] = ' ';
  test[6] = '\0';
  replaceSpaces(test);
  assert(test[2] == '_');
  assert(test[3] == '_');
  assert(test[5] == '_');
  print("ReplaceSpaces tests [PASSED]");
  free((void *)test);
}


x86 assembly (clang, -O0):
<testReplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x7,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x62,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x20,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x20,0x3(%rax)
mov    -0x8(%rbp),%rax
movb   $0x64,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0x20,0x5(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x6(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <replaceSpaces@plt>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x5f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x5f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x5f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe0b(%rip),%rdi
call   1050 <print@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testReplace>:
push   %rbx
mov    $0x7,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
movl   $0x20206261,(%rax)
movw   $0x2064,0x4(%rax)
movb   $0x0,0x6(%rax)
mov    %rax,%rdi
call   1040 <replaceSpaces@plt>
xor    %edi,%edi
cmpb   $0x5f,0x2(%rbx)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x5f,0x3(%rbx)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x5f,0x5(%rbx)
sete   %dil
call   1060 <assert@plt>
lea    0xe56(%rip),%rdi
call   1050 <print@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"ReplaceSpaces tests [PASSED]\00"
define void @testReplace() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 7)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 0
store i8 97, i8* %5
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 98, i8* %7
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i64 2
store i8 32, i8* %9
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 3
store i8 32, i8* %11
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i64 4
store i8 100, i8* %13
%14 = load i8*, i8** %1
%15 = getelementptr inbounds i8, i8* %14, i64 5
store i8 32, i8* %15
%16 = load i8*, i8** %1
%17 = getelementptr inbounds i8, i8* %16, i64 6
store i8 0, i8* %17
%18 = load i8*, i8** %1
%19 = call i32 @replaceSpaces(i8* %18)
%20 = load i8*, i8** %1
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 95
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i8*, i8** %1
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 95
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i8*, i8** %1
%35 = getelementptr inbounds i8, i8* %34, i64 5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 95
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @print(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%42 = load i8*, i8** %1
%43 = call i32 @free(i8* %42)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"ReplaceSpaces tests [PASSED]\00"
define void @testReplace() {
%1 = tail call i64 @malloc(i32 7)
%2 = inttoptr i64 %1 to i8*
store i8 97, i8* %2
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 98, i8* %3
%4 = getelementptr inbounds i8, i8* %2, i64 2
store i8 32, i8* %4
%5 = getelementptr inbounds i8, i8* %2, i64 3
store i8 32, i8* %5
%6 = getelementptr inbounds i8, i8* %2, i64 4
store i8 100, i8* %6
%7 = getelementptr inbounds i8, i8* %2, i64 5
store i8 32, i8* %7
%8 = getelementptr inbounds i8, i8* %2, i64 6
store i8 0, i8* %8
%9 = tail call i32 @replaceSpaces(i8* %2)
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 95
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = load i8, i8* %5
%15 = icmp eq i8 %14, 95
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = load i8, i8* %7
%19 = icmp eq i8 %18, 95
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 @print(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @free(i8* %2)
ret void
}