#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*/ free(char *);
char *pl_translate(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int main() {
  char the_string[] = "read this short text";
  char *ret_val = NULL;
  ret_val = pl_translate(the_string, NULL, "aeiou");
  if (ret_val != NULL) {
    printf("the_string: %s\nno table:%s\n", the_string, ret_val);
    free(ret_val);
  }
  ret_val = pl_translate(the_string, "aeiou", "xxxxx");
  if (ret_val != NULL) {
    printf("with table: %s\n", ret_val);
    free(ret_val);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeb0(%rip),%al
mov    %al,-0xc(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    0xe97(%rip),%rdx
call   1040 <pl_translate@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11b1 <main+0x81>
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
lea    -0x20(%rbp),%rdi
lea    0xe59(%rip),%rsi
lea    0xe74(%rip),%rdx
call   1040 <pl_translate@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11f2 <main+0xc2>
mov    -0x28(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x74786574207472,%rax
mov    %rax,0xd(%rsp)
lea    0xebf(%rip),%rdx
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <pl_translate@plt>
test   %rax,%rax
je     1184 <main+0x54>
mov    %rax,%rbx
lea    0xeac(%rip),%rdi
mov    %rsp,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe8a(%rip),%rsi
lea    0xea5(%rip),%rdx
mov    %rsp,%rdi
call   1040 <pl_translate@plt>
test   %rax,%rax
je     11bb <main+0x8b>
mov    %rax,%rbx
lea    0xe94(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.the_string = [21 x i8] c"read this short text\00"
@.str = [6 x i8] c"aeiou\00"
@.str.1 = [28 x i8] c"the_string: %s\0Ano table:%s\0A\00"
@.str.2 = [6 x i8] c"xxxxx\00"
@.str.3 = [16 x i8] c"with table: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [21 x i8]* %2 to i8*
store i8* null, i8** %3
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%6 = call i8* @pl_translate(i8* %5, i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %0
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @free(i8* %13)
br label %15
15: ; preds = %9, %0
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%17 = call i8* @pl_translate(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %3
%24 = call i32 @free(i8* %23)
br label %25
25: ; preds = %20, %15
ret i32 0
}

LLVM IR (-O2):
@__const.main.the_string = [21 x i8] c"read this short text\00"
@.str = [6 x i8] c"aeiou\00"
@.str.1 = [28 x i8] c"the_string: %s\0Ano table:%s\0A\00"
@.str.2 = [6 x i8] c"xxxxx\00"
@.str.3 = [16 x i8] c"with table: %s\0A\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = call i8* @pl_translate(i8* %2, i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3)
%7 = call i32 @free(i8* %3)
br label %8
8: ; preds = %5, %0
%9 = call i8* @pl_translate(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%13 = call i32 @free(i8* %9)
br label %14
14: ; preds = %11, %8
ret i32 0
}