#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 *, ...);
int replace(char, char, char *);
int /*<<< orphan*/ reverse(char *);
scalar_t__ strcmp(char *, char *);
size_t strlen(char *);
void sysOut(char *s, char *ss) {
  int num;
  printf("First string is %s.\n", s);
  printf("Second string is %s.\n", ss);
  if (strcmp(s, ss) == 0) {
    printf("first string is equal to the second.\n");
  } else {
    printf("the two strings are not equal.\n");
  }
  num = replace(ss[strlen(ss - 1)], 'X', ss);
  printf("Replaced str2 is: %s \n", ss);
  printf("the number of changes is: %d \n ", num);
  reverse(ss);
  printf("New str2 is: %s \n", ss);
}


x86 assembly (clang, -O0):
<sysOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ae <sysOut+0x5e>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11bc <sysOut+0x6c>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rdx
mov    $0x58,%esi
movsbl %al,%edi
call   1070 <replace@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <reverse@plt>
mov    -0x10(%rbp),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysOut>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe8f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
lea    0xef2(%rip),%rax
lea    0xecc(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
lea    -0x1(%rbx),%rdi
call   1050 <strlen@plt>
movsbl (%rbx,%rax,1),%edi
mov    $0x58,%esi
mov    %rbx,%rdx
call   1080 <replace@plt>
mov    %eax,%ebp
lea    0xe57(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"First string is %s.\0A\00"
@.str.1 = [22 x i8] c"Second string is %s.\0A\00"
@.str.2 = [38 x i8] c"first string is equal to the second.\0A\00"
@.str.3 = [32 x i8] c"the two strings are not equal.\0A\00"
@.str.4 = [23 x i8] c"Replaced str2 is: %s \0A\00"
@.str.5 = [32 x i8] c"the number of changes is: %d \0A \00"
@.str.6 = [18 x i8] c"New str2 is: %s \0A\00"
define void @sysOut(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = load i8*, i8** %4
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 -1
%22 = call i64 @strlen(i8* %21)
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %4
%26 = call i32 @replace(i8 signext %24, i8 signext 88, i8* %25)
store i32 %26, i32* %5
%27 = load i8*, i8** %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %29)
%31 = load i8*, i8** %4
%32 = call i32 @reverse(i8* %31)
%33 = load i8*, i8** %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %33)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"First string is %s.\0A\00"
@.str.1 = [22 x i8] c"Second string is %s.\0A\00"
@.str.4 = [23 x i8] c"Replaced str2 is: %s \0A\00"
@.str.5 = [32 x i8] c"the number of changes is: %d \0A \00"
@.str.6 = [18 x i8] c"New str2 is: %s \0A\00"
@str = [31 x i8] c"the two strings are not equal.\00"
@str.7 = [37 x i8] c"first string is equal to the second.\00"
define void @sysOut(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i64 @strcmp(i8* %0, i8* %1)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = getelementptr inbounds i8, i8* %1, i64 -1
%10 = tail call i64 @strlen(i8* %9)
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 @replace(i8 signext %12, i8 signext 88, i8* %1)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%16 = tail call i32 @reverse(i8* %1)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %1)
ret void
}