#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 */
typedef int /*<<< orphan*/ palabra;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
char tolower(char);
void morse(char palabra[]) {
  char M[28][6] = {
      {'a', '.', '-', ' ', ' ', ' '}, {'b', '-', '.', '.', '.', ' '},
      {'c', '-', '.', '-', '.', ' '}, {'d', '-', '.', '.', ' ', ' '},
      {'e', '.', ' ', ' ', ' ', ' '}, {'f', '.', '.', '-', '.', ' '},
      {'g', '-', '-', '.', ' ', ' '}, {'h', '.', '.', '.', '.', ' '},
      {'i', '.', '.', ' ', ' ', ' '}, {'j', '.', '-', '-', '-', ' '},
      {'k', '-', '.', '-', ' ', ' '}, {'m', '-', '-', ' ', ' ', ' '},
      {'n', '-', '.', ' ', ' ', ' '}, {'o', '-', '-', '-', ' ', ' '},
      {'p', '.', '-', '-', '.', ' '}, {'q', '-', '-', '.', '-', ' '},
      {'r', '.', '-', '.', ' ', ' '}, {'s', '.', '.', '.', ' ', ' '},
      {'t', '-', ' ', ' ', ' ', ' '}, {'u', '.', '-', '.', ' ', ' '},
      {'v', '.', '.', '.', '-', ' '}, {'w', '.', '-', '-', ' ', ' '},
      {'x', '-', '.', '.', '-', ' '}, {'y', '-', '.', '-', '-', ' '},
      {'z', '-', '-', '.', '.', ' '}, {'1', '.', '-', '-', '-', '-'},
      {'2', '.', '.', '-', '-', '-'}, {' ', ' ', ' ', ' ', ' ', ' '}};
  int i, j, k;
  printf("La frase escrita en codigo morse es: ");
  for (k = 0; k < (sizeof(palabra) / sizeof(palabra[0])); k++) {
    for (i = 0; i < 28; i++) {
      for (j = 1; j < 6; j++) {
        if (tolower(palabra[k]) == M[i][0]) {
          printf("%c", M[i][j]);
        }
      }
    }
    printf(" ");
  }
}


x86 assembly (clang, -O0):
<morse>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0xa8,%edx
call   1040 <memcpy@plt>
lea    0xf4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xbc(%rbp)
movslq -0xbc(%rbp),%rax
cmp    $0x8,%rax
jae    1267 <morse+0x137>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x1c,-0xb4(%rbp)
jge    1245 <morse+0x115>
movl   $0x1,-0xb8(%rbp)
cmpl   $0x6,-0xb8(%rbp)
jge    122c <morse+0xfc>
mov    -0x8(%rbp),%rax
movslq -0xbc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
movsbl %al,%eax
movslq -0xb4(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
imul   $0x6,%rdx,%rdx
add    %rdx,%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1213 <morse+0xe3>
movslq -0xb4(%rbp),%rcx
lea    -0xb0(%rbp),%rax
imul   $0x6,%rcx,%rcx
add    %rcx,%rax
movslq -0xb8(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1218 <morse+0xe8>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    11a1 <morse+0x71>
jmp    1231 <morse+0x101>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    118a <morse+0x5a>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    116f <morse+0x3f>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<morse>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
lea    0xf66(%rip),%rdi
xor    %r12d,%r12d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xead(%rip),%r15
jmp    1178 <morse+0x48>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
cmp    $0x8,%r12
je     121d <morse+0xed>
mov    $0x5,%ebx
jmp    118d <morse+0x5d>
nop
add    $0x6,%rbx
cmp    $0xad,%rbx
je     1160 <morse+0x30>
movsbl (%r14,%r12,1),%edi
call   1050 <tolower@plt>
movzbl -0x5(%rbx,%r15,1),%ebp
cmp    %bpl,%al
jne    11ad <morse+0x7d>
movsbl -0x4(%rbx,%r15,1),%edi
call   1030 <putchar@plt>
movsbl (%r14,%r12,1),%edi
call   1050 <tolower@plt>
cmp    %bpl,%al
jne    11c7 <morse+0x97>
movsbl -0x3(%rbx,%r15,1),%edi
call   1030 <putchar@plt>
movsbl (%r14,%r12,1),%edi
call   1050 <tolower@plt>
cmp    %bpl,%al
jne    11e1 <morse+0xb1>
movsbl -0x2(%rbx,%r15,1),%edi
call   1030 <putchar@plt>
movsbl (%r14,%r12,1),%edi
call   1050 <tolower@plt>
cmp    %bpl,%al
jne    11fb <morse+0xcb>
movsbl -0x1(%rbx,%r15,1),%edi
call   1030 <putchar@plt>
movsbl (%r14,%r12,1),%edi
call   1050 <tolower@plt>
cmp    %bpl,%al
jne    1180 <morse+0x50>
movsbl (%rbx,%r15,1),%edi
call   1030 <putchar@plt>
jmp    1180 <morse+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.morse.M = [28 x [6 x i8]] [[6 x i8] c"a.- ", [6 x i8] c"b-... ", [6 x i8] c"c-.-. ", [6 x i8] c"d-.. ", [6 x i8] c"e. ", [6 x i8] c"f..-. ", [6 x i8] c"g--. ", [6 x i8] c"h.... ", [6 x i8] c"i.. ", [6 x i8] c"j.--- ", [6 x i8] c"k-.- ", [6 x i8] c"m-- ", [6 x i8] c"n-. ", [6 x i8] c"o--- ", [6 x i8] c"p.--. ", [6 x i8] c"q--.- ", [6 x i8] c"r.-. ", [6 x i8] c"s... ", [6 x i8] c"t- ", [6 x i8] c"u.-. ", [6 x i8] c"v...- ", [6 x i8] c"w.-- ", [6 x i8] c"x-..- ", [6 x i8] c"y-.-- ", [6 x i8] c"z--.. ", [6 x i8] c"1.----", [6 x i8] c"2..---", [6 x i8] c" "]
@.str = [38 x i8] c"La frase escrita en codigo morse es: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c" \00"
define void @morse(i8* %0) {
%2 = alloca i8*
%3 = alloca [28 x [6 x i8]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = bitcast [28 x [6 x i8]]* %3 to i8*
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %9
9: ; preds = %56, %1
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 8
br i1 %12, label %13, label %59
13: ; preds = %9
store i32 0, i32* %4
br label %14
14: ; preds = %51, %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 28
br i1 %16, label %17, label %54
17: ; preds = %14
store i32 1, i32* %5
br label %18
18: ; preds = %47, %17
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 6
br i1 %20, label %21, label %50
21: ; preds = %18
%22 = load i8*, i8** %2
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = call signext i8 @tolower(i8 signext %26)
%28 = sext i8 %27 to i32
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* %3, i64 0, i64 %30
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %31, i64 0, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %28, %34
br i1 %35, label %36, label %46
36: ; preds = %21
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* %3, i64 0, i64 %38
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %39, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %36, %21
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %18
50: ; preds = %18
br label %51
51: ; preds = %50
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %14
54: ; preds = %14
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %9
59: ; preds = %9
ret void
}

LLVM IR (-O2):
@__const.morse.M = [28 x [6 x i8]] [[6 x i8] c"a.- ", [6 x i8] c"b-... ", [6 x i8] c"c-.-. ", [6 x i8] c"d-.. ", [6 x i8] c"e. ", [6 x i8] c"f..-. ", [6 x i8] c"g--. ", [6 x i8] c"h.... ", [6 x i8] c"i.. ", [6 x i8] c"j.--- ", [6 x i8] c"k-.- ", [6 x i8] c"m-- ", [6 x i8] c"n-. ", [6 x i8] c"o--- ", [6 x i8] c"p.--. ", [6 x i8] c"q--.- ", [6 x i8] c"r.-. ", [6 x i8] c"s... ", [6 x i8] c"t- ", [6 x i8] c"u.-. ", [6 x i8] c"v...- ", [6 x i8] c"w.-- ", [6 x i8] c"x-..- ", [6 x i8] c"y-.-- ", [6 x i8] c"z--.. ", [6 x i8] c"1.----", [6 x i8] c"2..---", [6 x i8] c" "]
@.str = [38 x i8] c"La frase escrita en codigo morse es: \00"
define void @morse(i8* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %57
%4 = phi i64 [ 0, %1 ], [ %59, %57 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
br label %6
6: ; preds = %3, %54
%7 = phi i64 [ 0, %3 ], [ %55, %54 ]
%8 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 0
%9 = load i8, i8* %5
%10 = tail call signext i8 @tolower(i8 signext %9)
%11 = load i8, i8* %8
%12 = icmp eq i8 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %6
%14 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @putchar(i32 %16)
br label %18
18: ; preds = %6, %13
%19 = load i8, i8* %5
%20 = tail call signext i8 @tolower(i8 signext %19)
%21 = icmp eq i8 %20, %11
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = tail call i32 @putchar(i32 %25)
br label %27
27: ; preds = %22, %18
%28 = load i8, i8* %5
%29 = tail call signext i8 @tolower(i8 signext %28)
%30 = icmp eq i8 %29, %11
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = tail call i32 @putchar(i32 %34)
br label %36
36: ; preds = %31, %27
%37 = load i8, i8* %5
%38 = tail call signext i8 @tolower(i8 signext %37)
%39 = icmp eq i8 %38, %11
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 4
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = tail call i32 @putchar(i32 %43)
br label %45
45: ; preds = %40, %36
%46 = load i8, i8* %5
%47 = tail call signext i8 @tolower(i8 signext %46)
%48 = icmp eq i8 %47, %11
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = getelementptr inbounds [28 x [6 x i8]], [28 x [6 x i8]]* @__const.morse.M, i64 0, i64 %7, i64 5
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = tail call i32 @putchar(i32 %52)
br label %54
54: ; preds = %49, %45
%55 = add nuw nsw i64 %7, 1
%56 = icmp eq i64 %55, 28
br i1 %56, label %57, label %6
57: ; preds = %54
%58 = tail call i32 @putchar(i32 32)
%59 = add nuw nsw i64 %4, 1
%60 = icmp eq i64 %59, 8
br i1 %60, label %61, label %3
61: ; preds = %57
ret void
}