#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_equal_str(char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *pl_translate(char *, unsigned char *, char *);
void test_translate() {
  char *ret_val;
  ret_val = pl_translate("read this short text", NULL, "aeiou");
  assert_equal_str("rd ths shrt txt", ret_val, "test_translate",
                   "Test 1: Strings are not equal.");
  free(ret_val);
  ret_val =
      pl_translate("read this short text", (unsigned char *)"aeiou", "xxxxx");
  assert_equal_str("rxxd thxs shxrt txxt", ret_val, "test_translate",
                   "Test 2: Strings are not equal.");
  free(ret_val);
  ret_val =
      pl_translate("read this short text", (unsigned char *)"zzzzz", "aeiou");
  assert_equal_str("read this short text", ret_val, "test_translate",
                   "Test 3: Strings are not equal");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_translate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    0xecb(%rip),%rdx
call   1050 <pl_translate@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebd(%rip),%rdi
lea    0xec6(%rip),%rdx
lea    0xece(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xe7f(%rip),%rdi
lea    0xe8d(%rip),%rsi
lea    0xeca(%rip),%rdx
call   1050 <pl_translate@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebc(%rip),%rdi
lea    0xe81(%rip),%rdx
lea    0xec3(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xe3a(%rip),%rdi
lea    0xec6(%rip),%rsi
lea    0xe41(%rip),%rdx
call   1050 <pl_translate@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe18(%rip),%rdi
lea    0xe3c(%rip),%rdx
lea    0xea3(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_translate>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r12
lea    0xecf(%rip),%r14
mov    %r12,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <pl_translate@plt>
mov    %rax,%rbx
lea    0xebe(%rip),%rdi
lea    0xec7(%rip),%r15
lea    0xecf(%rip),%rcx
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xed4(%rip),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <pl_translate@plt>
mov    %rax,%rbx
lea    0xec5(%rip),%rdi
lea    0xed3(%rip),%rcx
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xed8(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <pl_translate@plt>
mov    %rax,%rbx
lea    0xec9(%rip),%rcx
mov    %r12,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"read this short text\00"
@.str.1 = [6 x i8] c"aeiou\00"
@.str.2 = [16 x i8] c"rd ths shrt txt\00"
@.str.3 = [15 x i8] c"test_translate\00"
@.str.4 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.5 = [6 x i8] c"xxxxx\00"
@.str.6 = [21 x i8] c"rxxd thxs shxrt txxt\00"
@.str.7 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.8 = [6 x i8] c"zzzzz\00"
@.str.9 = [30 x i8] c"Test 3: Strings are not equal\00"
define void @test_translate() {
%1 = alloca i8*
%2 = call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @assert_equal_str(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
%7 = call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i8* %7, i8** %1
%8 = load i8*, i8** %1
%9 = call i32 @assert_equal_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%10 = load i8*, i8** %1
%11 = call i32 @free(i8* %10)
%12 = call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i8* %12, i8** %1
%13 = load i8*, i8** %1
%14 = call i32 @assert_equal_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%15 = load i8*, i8** %1
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"read this short text\00"
@.str.1 = [6 x i8] c"aeiou\00"
@.str.2 = [16 x i8] c"rd ths shrt txt\00"
@.str.3 = [15 x i8] c"test_translate\00"
@.str.4 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.5 = [6 x i8] c"xxxxx\00"
@.str.6 = [21 x i8] c"rxxd thxs shxrt txxt\00"
@.str.7 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.8 = [6 x i8] c"zzzzz\00"
@.str.9 = [30 x i8] c"Test 3: Strings are not equal\00"
define void @test_translate() {
%1 = tail call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%3 = tail call i32 @free(i8* %1)
%4 = tail call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%6 = tail call i32 @free(i8* %4)
%7 = tail call i8* @pl_translate(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%9 = tail call i32 @free(i8* %7)
ret void
}