#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*/ blink_long();
int /*<<< orphan*/ blink_short();
char *convert(char);
int /*<<< orphan*/ printf(char *, ...);
void perform_blink(char *text) {
  while (*text) {
    if (*text == ' ') {
      printf("\n");
      text++;
      continue;
    }
    printf("%c: ", *text);
    char *morseified = convert(*text);
    while (*morseified) {
      if (*morseified == '.') {
        blink_short();
      } else {
        blink_long();
      }
      morseified++;
    }
    printf("\n");
    text++;
  }
}


x86 assembly (clang, -O0):
<perform_blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     120d <perform_blink+0xcd>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1188 <perform_blink+0x48>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114c <perform_blink+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <convert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ee <perform_blink+0xae>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d6 <perform_blink+0x96>
mov    $0x0,%al
call   1060 <blink_short@plt>
jmp    11dd <perform_blink+0x9d>
mov    $0x0,%al
call   1050 <blink_long@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11ad <perform_blink+0x6d>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114c <perform_blink+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perform_blink>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xea1(%rip),%r14
jmp    117e <perform_blink+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movsbl (%r15),%esi
cmp    $0x20,%esi
je     1170 <perform_blink+0x20>
test   %sil,%sil
je     11d3 <perform_blink+0x83>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl (%r15),%edi
call   1040 <convert@plt>
mov    %rax,%rbx
jmp    11bb <perform_blink+0x6b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <blink_short@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2e,%al
je     11b0 <perform_blink+0x60>
test   %al,%al
je     1170 <perform_blink+0x20>
xor    %eax,%eax
call   1060 <blink_long@plt>
add    $0x1,%rbx
jmp    11bb <perform_blink+0x6b>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"%c: \00"
define void @perform_blink(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %41, %13, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %45
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %4
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i8*, i8** %2
%23 = load i8, i8* %22
%24 = call i8* @convert(i8 signext %23)
store i8* %24, i8** %3
br label %25
25: ; preds = %38, %17
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 46
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 (...) @blink_short()
br label %38
36: ; preds = %29
%37 = call i32 (...) @blink_long()
br label %38
38: ; preds = %36, %34
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %3
br label %25
41: ; preds = %25
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %2
br label %4
45: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%c: \00"
define void @perform_blink(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %7, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %8 [
i8 0, label %22
i8 32, label %5
]
5: ; preds = %13, %2
%6 = tail call i32 @putchar(i32 10)
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
%9 = sext i8 %4 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i8, i8* %3
%12 = tail call i8* @convert(i8 signext %11)
br label %13
13: ; preds = %20, %8
%14 = phi i8* [ %12, %8 ], [ %21, %20 ]
%15 = load i8, i8* %14
switch i8 %15, label %18 [
i8 0, label %5
i8 46, label %16
]
16: ; preds = %13
%17 = tail call i32 (...) @blink_short()
br label %20
18: ; preds = %13
%19 = tail call i32 (...) @blink_long()
br label %20
20: ; preds = %18, %16
%21 = getelementptr inbounds i8, i8* %14, i64 1
br label %13
22: ; preds = %2
ret void
}