#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ morse_str_to_str(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ str2lowcase(char *, char *, int);
int /*<<< orphan*/ str_to_morse_str(char *, char *, int);
int main() {
  char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:123,;?='/!-_\"()$&@";
  char mor[300];
  char str[300];
  char out[300];
  memset(out, 0, 300);
  memset(mor, 0, 300);
  memset(str, 0, 300);
  printf("base string:\n%s\n", mystr);
  str2lowcase(mystr, out, 300);
  str_to_morse_str(out, mor, 300);
  printf("\nget morse code string:\n%s\n", mor);
  morse_str_to_str(mor, str, 300);
  printf("\nget decode string:\n%s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x3a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    -0x270(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
mov    $0x12c,%edx
call   1070 <str2lowcase@plt>
lea    -0x3a0(%rbp),%rdi
lea    -0x140(%rbp),%rsi
mov    $0x12c,%edx
call   1030 <str_to_morse_str@plt>
lea    -0x140(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
lea    -0x140(%rbp),%rdi
lea    -0x270(%rbp),%rsi
mov    $0x12c,%edx
call   1040 <morse_str_to_str@plt>
lea    -0x270(%rbp),%rsi
lea    0xe4a(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x3a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x398,%rsp
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    0x260(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    0x130(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    0xe94(%rip),%rdi
lea    0xe54(%rip),%rbx
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x12c,%edx
call   1070 <str2lowcase@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x12c,%edx
call   1030 <str_to_morse_str@plt>
lea    0xe6f(%rip),%rdi
mov    %r12,%rsi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x12c,%edx
call   1040 <morse_str_to_str@plt>
lea    0xe6c(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x398,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [57 x i8] c"abcdefghijklmnopqrstuvwxyz0123456789.:123,;?='/!-_\22()$&@\00"
@.str.1 = [17 x i8] c"base string:\0A%s\0A\00"
@.str.2 = [28 x i8] c"\0Aget morse code string:\0A%s\0A\00"
@.str.3 = [24 x i8] c"\0Aget decode string:\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [300 x i8]
%4 = alloca [300 x i8]
%5 = alloca [300 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 300)
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 300)
%10 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 300)
%12 = load i8*, i8** %2
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %2
%15 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%16 = call i32 @str2lowcase(i8* %14, i8* %15, i32 300)
%17 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%19 = call i32 @str_to_morse_str(i8* %17, i8* %18, i32 300)
%20 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%24 = call i32 @morse_str_to_str(i8* %22, i8* %23, i32 300)
%25 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%26 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"abcdefghijklmnopqrstuvwxyz0123456789.:123,;?='/!-_\22()$&@\00"
@.str.1 = [17 x i8] c"base string:\0A%s\0A\00"
@.str.2 = [28 x i8] c"\0Aget morse code string:\0A%s\0A\00"
@.str.3 = [24 x i8] c"\0Aget decode string:\0A%s\0A\00"
define i32 @main() {
%1 = alloca [300 x i8]
%2 = alloca [300 x i8]
%3 = alloca [300 x i8]
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 300)
%8 = call i32 @memset(i8* %4, i32 0, i32 300)
%9 = call i32 @memset(i8* %5, i32 0, i32 300)
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @str2lowcase(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %6, i32 300)
%12 = call i32 @str_to_morse_str(i8* %6, i8* %4, i32 300)
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%14 = call i32 @morse_str_to_str(i8* %4, i8* %5, i32 300)
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %5)
ret i32 0
}