#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void encrypt(char *msg) {
  int size = strlen(msg);
  char *morse_code = (char *)malloc(size * 5);
  char *num[] = {"-----", ".----", "..---", "...--", "....-",
                 ".....", "-....", "--...", "---..", "----."};
  char *letters[] = {".-",   "-...", "-.-.", "-..",  ".",    "..-.", "--.",
                     "....", "..",   ".---", "-.-",  ".-..", "--",   "-.",
                     "---",  ".--.", "--.-", ".-.",  "...",  "-",    "..-",
                     "...-", ".--",  "-..-", "-.--", "--.."};
  int i;
  for (i = 0; i < size; i++)
    if (msg[i] != ' ')
      if (msg[i] >= '0' && msg[i] <= '9')
        strcat(morse_code, num[msg[i] - 48]);
      else
        strcat(morse_code, letters[msg[i] - 65]);
    else
      strcat(morse_code, " ");
  printf("%s\n", morse_code);
  free(morse_code);
}


x86 assembly (clang, -O0):
<encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
imul   $0x5,-0xc(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2b6d(%rip),%rsi
mov    $0x50,%edx
call   1060 <memcpy@plt>
lea    -0x140(%rbp),%rdi
lea    0x2ba5(%rip),%rsi
mov    $0xd0,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x144(%rbp)
mov    -0x144(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1290 <encrypt+0x130>
mov    -0x8(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1267 <encrypt+0x107>
mov    -0x8(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     123d <encrypt+0xdd>
mov    -0x8(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     123d <encrypt+0xdd>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
cltq
mov    -0x70(%rbp,%rax,8),%rsi
call   1080 <strcat@plt>
jmp    1262 <encrypt+0x102>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
cltq
mov    -0x140(%rbp,%rax,8),%rsi
ff
call   1080 <strcat@plt>
jmp    1277 <encrypt+0x117>
mov    -0x18(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1080 <strcat@plt>
jmp    127c <encrypt+0x11c>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    11bf <encrypt+0x5f>
mov    -0x18(%rbp),%rsi
lea    0xdc6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    (%r15,%r15,4),%edi
call   1060 <malloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    11d5 <encrypt+0x85>
mov    %r15d,%r15d
xor    %ebx,%ebx
lea    0xedc(%rip),%r13
lea    0x2bc6(%rip),%rbp
jmp    11af <encrypt+0x5f>
nopl   0x0(%rax)
lea    -0x208(,%rax,8),%rax
ff
add    %rbp,%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     11d5 <encrypt+0x85>
movsbq (%r14,%rbx,1),%rax
mov    %r13,%rsi
cmp    $0x20,%rax
je     119e <encrypt+0x4e>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1190 <encrypt+0x40>
add    $0xffffffd0,%eax
lea    0x2b31(%rip),%rcx
lea    (%rcx,%rax,8),%rax
jmp    119b <encrypt+0x4b>
lea    0xe85(%rip),%rdi
mov    %r12,%rsi
call   1050 <printf@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-----\00"
@.str.1 = [6 x i8] c".----\00"
@.str.2 = [6 x i8] c"..---\00"
@.str.3 = [6 x i8] c"...--\00"
@.str.4 = [6 x i8] c"....-\00"
@.str.5 = [6 x i8] c".....\00"
@.str.6 = [6 x i8] c"-....\00"
@.str.7 = [6 x i8] c"--...\00"
@.str.8 = [6 x i8] c"---..\00"
@.str.9 = [6 x i8] c"----.\00"
@__const.encrypt.num = [10 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [3 x i8] c".-\00"
@.str.11 = [5 x i8] c"-...\00"
@.str.12 = [5 x i8] c"-.-.\00"
@.str.13 = [4 x i8] c"-..\00"
@.str.14 = [2 x i8] c".\00"
@.str.15 = [5 x i8] c"..-.\00"
@.str.16 = [4 x i8] c"--.\00"
@.str.17 = [5 x i8] c"....\00"
@.str.18 = [3 x i8] c"..\00"
@.str.19 = [5 x i8] c".---\00"
@.str.20 = [4 x i8] c"-.-\00"
@.str.21 = [5 x i8] c".-..\00"
@.str.22 = [3 x i8] c"--\00"
@.str.23 = [3 x i8] c"-.\00"
@.str.24 = [4 x i8] c"---\00"
@.str.25 = [5 x i8] c".--.\00"
@.str.26 = [5 x i8] c"--.-\00"
@.str.27 = [4 x i8] c".-.\00"
@.str.28 = [4 x i8] c"...\00"
@.str.29 = [2 x i8] c"-\00"
@.str.30 = [4 x i8] c"..-\00"
@.str.31 = [5 x i8] c"...-\00"
@.str.32 = [4 x i8] c".--\00"
@.str.33 = [5 x i8] c"-..-\00"
@.str.34 = [5 x i8] c"-.--\00"
@.str.35 = [5 x i8] c"--..\00"
@__const.encrypt.letters = [26 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.35, i32 0, i32 0)]
@.str.36 = [2 x i8] c" \00"
@.str.37 = [4 x i8] c"%s\0A\00"
define void @encrypt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [10 x i8*]
%6 = alloca [26 x i8*]
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 5
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = bitcast [10 x i8*]* %5 to i8*
%15 = bitcast [26 x i8*]* %6 to i8*
store i32 0, i32* %7
br label %16
16: ; preds = %75, %1
%17 = load i32, i32* %7
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %78
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 32
br i1 %27, label %28, label %71
28: ; preds = %20
%29 = load i8*, i8** %2
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp sge i32 %34, 48
br i1 %35, label %36, label %57
36: ; preds = %28
%37 = load i8*, i8** %2
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp sle i32 %42, 57
br i1 %43, label %44, label %57
44: ; preds = %36
%45 = load i8*, i8** %4
%46 = load i8*, i8** %2
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = sub nsw i32 %51, 48
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strcat(i8* %45, i8* %55)
br label %70
57: ; preds = %36, %28
%58 = load i8*, i8** %4
%59 = load i8*, i8** %2
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = sub nsw i32 %64, 65
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [26 x i8*], [26 x i8*]* %6, i64 0, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @strcat(i8* %58, i8* %68)
br label %70
70: ; preds = %57, %44
br label %74
71: ; preds = %20
%72 = load i8*, i8** %4
%73 = call i32 @strcat(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.36, i64 0, i64 0))
br label %74
74: ; preds = %71, %70
br label %75
75: ; preds = %74
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %16
78: ; preds = %16
%79 = load i8*, i8** %4
%80 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.37, i64 0, i64 0), i8* %79)
%81 = load i8*, i8** %4
%82 = call i32 @free(i8* %81)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"-----\00"
@.str.1 = [6 x i8] c".----\00"
@.str.2 = [6 x i8] c"..---\00"
@.str.3 = [6 x i8] c"...--\00"
@.str.4 = [6 x i8] c"....-\00"
@.str.5 = [6 x i8] c".....\00"
@.str.6 = [6 x i8] c"-....\00"
@.str.7 = [6 x i8] c"--...\00"
@.str.8 = [6 x i8] c"---..\00"
@.str.9 = [6 x i8] c"----.\00"
@__const.encrypt.num = [10 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [3 x i8] c".-\00"
@.str.11 = [5 x i8] c"-...\00"
@.str.12 = [5 x i8] c"-.-.\00"
@.str.13 = [4 x i8] c"-..\00"
@.str.14 = [2 x i8] c".\00"
@.str.15 = [5 x i8] c"..-.\00"
@.str.16 = [4 x i8] c"--.\00"
@.str.17 = [5 x i8] c"....\00"
@.str.18 = [3 x i8] c"..\00"
@.str.19 = [5 x i8] c".---\00"
@.str.20 = [4 x i8] c"-.-\00"
@.str.21 = [5 x i8] c".-..\00"
@.str.22 = [3 x i8] c"--\00"
@.str.23 = [3 x i8] c"-.\00"
@.str.24 = [4 x i8] c"---\00"
@.str.25 = [5 x i8] c".--.\00"
@.str.26 = [5 x i8] c"--.-\00"
@.str.27 = [4 x i8] c".-.\00"
@.str.28 = [4 x i8] c"...\00"
@.str.29 = [2 x i8] c"-\00"
@.str.30 = [4 x i8] c"..-\00"
@.str.31 = [5 x i8] c"...-\00"
@.str.32 = [4 x i8] c".--\00"
@.str.33 = [5 x i8] c"-..-\00"
@.str.34 = [5 x i8] c"-.--\00"
@.str.35 = [5 x i8] c"--..\00"
@__const.encrypt.letters = [26 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.35, i32 0, i32 0)]
@.str.36 = [2 x i8] c" \00"
@.str.37 = [4 x i8] c"%s\0A\00"
define void @encrypt(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = mul nsw i32 %2, 5
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %33
7: ; preds = %1
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %28
%10 = phi i64 [ 0, %7 ], [ %31, %28 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i64
%14 = icmp eq i8 %12, 32
br i1 %14, label %28, label %15
15: ; preds = %9
%16 = add i8 %12, -48
%17 = icmp ult i8 %16, 10
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = add nsw i64 %13, 4294967248
%20 = and i64 %19, 4294967295
%21 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.encrypt.num, i64 0, i64 %20
br label %25
22: ; preds = %15
%23 = add nsw i64 %13, -65
%24 = getelementptr inbounds [26 x i8*], [26 x i8*]* @__const.encrypt.letters, i64 0, i64 %23
br label %25
25: ; preds = %18, %22
%26 = phi i8** [ %24, %22 ], [ %21, %18 ]
%27 = load i8*, i8** %26
br label %28
28: ; preds = %25, %9
%29 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.36, i64 0, i64 0), %9 ], [ %27, %25 ]
%30 = tail call i32 @strcat(i8* %5, i8* %29)
%31 = add nuw nsw i64 %10, 1
%32 = icmp eq i64 %31, %8
br i1 %32, label %33, label %9
33: ; preds = %28, %1
%34 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.37, i64 0, i64 0), i8* %5)
%35 = tail call i32 @free(i8* %5)
ret void
}