#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*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ cspace(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ genMorse(int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ tolower(int);
int /*<<< orphan*/ wspace(int /*<<< orphan*/ *);
void translate(FILE *in, FILE *out) {
  int prosign = 0;
  int ch;
  while ((ch = fgetc(in)) != EOF) {
    if (ch == '*') {
      prosign = !prosign;
      if (!prosign)
        cspace(out);
    } else {
      if (isspace(ch))
        wspace(out);
      else {
        genMorse(tolower(ch), out);
        if (!prosign)
          cspace(out);
      }
    }
  }
}


x86 assembly (clang, -O0):
<translate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e5e(%rip),%rcx
cmp    (%rcx),%eax
je     121a <translate+0xba>
cmpl   $0x2a,-0x18(%rbp)
jne    11c5 <translate+0x65>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11c0 <translate+0x60>
mov    -0x10(%rbp),%rdi
call   1070 <cspace@plt>
jmp    1215 <translate+0xb5>
mov    -0x18(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11e5 <translate+0x85>
mov    -0x10(%rbp),%rdi
call   1080 <wspace@plt>
jmp    1210 <translate+0xb0>
mov    -0x18(%rbp),%edi
call   1060 <tolower@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <genMorse@plt>
cmpl   $0x0,-0x14(%rbp)
jne    120b <translate+0xab>
mov    -0x10(%rbp),%rdi
call   1070 <cspace@plt>
jmp    1210 <translate+0xb0>
jmp    1215 <translate+0xb5>
jmp    1177 <translate+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <fgetc@plt>
mov    0x2e6e(%rip),%r15
cmp    (%r15),%eax
jne    1188 <translate+0x28>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    11b3 <translate+0x53>
xchg   %ax,%ax
mov    %ebp,%edi
call   1050 <isspace@plt>
test   %rax,%rax
je     11c3 <translate+0x63>
mov    %r14,%rdi
call   1080 <wspace@plt>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
cmp    (%r15),%eax
je     117f <translate+0x1f>
cmp    $0x2a,%ebp
jne    1190 <translate+0x30>
test   %ebx,%ebx
mov    $0x1,%ebx
je     11a4 <translate+0x44>
jmp    11dd <translate+0x7d>
mov    %ebp,%edi
call   1060 <tolower@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <genMorse@plt>
test   %ebx,%ebx
mov    $0x1,%ebx
jne    11a4 <translate+0x44>
mov    %r14,%rdi
call   1070 <cspace@plt>
xor    %ebx,%ebx
jmp    11a4 <translate+0x44>

LLVM IR (-O0):
@EOF = global i32 0
define void @translate(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %45, %2
%8 = load i32*, i32** %3
%9 = call i32 @fgetc(i32* %8)
store i32 %9, i32* %6
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %46
12: ; preds = %7
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 42
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %15
%23 = load i32*, i32** %4
%24 = call i32 @cspace(i32* %23)
br label %25
25: ; preds = %22, %15
br label %45
26: ; preds = %12
%27 = load i32, i32* %6
%28 = call i64 @isspace(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32*, i32** %4
%32 = call i32 @wspace(i32* %31)
br label %44
33: ; preds = %26
%34 = load i32, i32* %6
%35 = call i32 @tolower(i32 %34)
%36 = load i32*, i32** %4
%37 = call i32 @genMorse(i32 %35, i32* %36)
%38 = load i32, i32* %5
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %33
%41 = load i32*, i32** %4
%42 = call i32 @cspace(i32* %41)
br label %43
43: ; preds = %40, %33
br label %44
44: ; preds = %43, %30
br label %45
45: ; preds = %44, %25
br label %7
46: ; preds = %7
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @translate(i32* nocapture %0, i32* %1) {
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %30, label %6
6: ; preds = %2, %25
%7 = phi i32 [ %27, %25 ], [ %3, %2 ]
%8 = phi i32 [ %26, %25 ], [ 0, %2 ]
%9 = icmp eq i32 %7, 42
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = icmp eq i32 %8, 0
br i1 %11, label %25, label %12
12: ; preds = %10
%13 = tail call i32 @cspace(i32* %1)
br label %25
14: ; preds = %6
%15 = tail call i64 @isspace(i32 %7)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @wspace(i32* %1)
br label %25
19: ; preds = %14
%20 = tail call i32 @tolower(i32 %7)
%21 = tail call i32 @genMorse(i32 %20, i32* %1)
%22 = icmp eq i32 %8, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 @cspace(i32* %1)
br label %25
25: ; preds = %17, %23, %19, %10, %12
%26 = phi i32 [ 1, %10 ], [ 0, %12 ], [ %8, %17 ], [ 1, %19 ], [ 0, %23 ]
%27 = tail call i32 @fgetc(i32* %0)
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %6
30: ; preds = %25, %2
ret void
}