#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 */
char *bacon_decode(char *);
char *bacon_encode(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char plain_text[] = "this is plain text";
  char message[] = "this is a message";
  char *cipher_text, *hidden_text;
  cipher_text = bacon_encode(plain_text, message);
  printf("Cipher text is\n\n%s\n", cipher_text);
  hidden_text = bacon_decode(cipher_text);
  printf("\nHidden text is\n\n%s\n", hidden_text);
  free(cipher_text);
  free(hidden_text);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea4(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xe9c(%rip),%al
mov    %al,-0xe(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe9a(%rip),%ax
mov    %ax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <bacon_encode@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x48(%rbp),%rdi
call   1060 <bacon_decode@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x747865,0x2f(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x65,0x10(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <bacon_encode@plt>
mov    %rax,%rbx
lea    0xeae(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <bacon_decode@plt>
mov    %rax,%r14
lea    0xea8(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.plain_text = [19 x i8] c"this is plain text\00"
@__const.main.message = [18 x i8] c"this is a message\00"
@.str = [20 x i8] c"Cipher text is\0A\0A%s\0A\00"
@.str.1 = [21 x i8] c"\0AHidden text is\0A\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [19 x i8]
%3 = alloca [18 x i8]
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [19 x i8]* %2 to i8*
%7 = bitcast [18 x i8]* %3 to i8*
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%10 = call i8* @bacon_encode(i8* %8, i8* %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %4
%14 = call i8* @bacon_decode(i8* %13)
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.plain_text = [19 x i8] c"this is plain text\00"
@__const.main.message = [18 x i8] c"this is a message\00"
@.str = [20 x i8] c"Cipher text is\0A\0A%s\0A\00"
@.str.1 = [21 x i8] c"\0AHidden text is\0A\0A%s\0A\00"
define i32 @main() {
%1 = alloca [19 x i8]
%2 = alloca [18 x i8]
%3 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%5 = call i8* @bacon_encode(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i8* @bacon_decode(i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 @free(i8* %5)
%10 = call i32 @free(i8* %7)
ret i32 0
}