#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 msg_byte();
int /*<<< orphan*/ msg_open(int);
int vowel(int msg) {
  int ch, r;
  msg_open(msg);
  ch = msg_byte();
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    r = -1;
  else
    r = 0;
  while (ch)
    ch = msg_byte();
  return (r);
}


x86 assembly (clang, -O0):
<vowel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <msg_open@plt>
mov    $0x0,%al
call   1040 <msg_byte@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
je     116f <vowel+0x4f>
cmpl   $0x65,-0x8(%rbp)
je     116f <vowel+0x4f>
cmpl   $0x69,-0x8(%rbp)
je     116f <vowel+0x4f>
cmpl   $0x6f,-0x8(%rbp)
je     116f <vowel+0x4f>
cmpl   $0x75,-0x8(%rbp)
jne    117b <vowel+0x5b>
movl   $0xffffffff,-0xc(%rbp)
jmp    1182 <vowel+0x62>
movl   $0x0,-0xc(%rbp)
jmp    1187 <vowel+0x67>
cmpl   $0x0,-0x8(%rbp)
je     11a0 <vowel+0x80>
mov    $0x0,%al
call   1040 <msg_byte@plt>
mov    %eax,-0x8(%rbp)
jmp    1187 <vowel+0x67>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vowel>:
push   %rbx
call   1030 <msg_open@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <msg_byte@plt>
lea    -0x61(%rax),%ecx
ror    %ecx
cmp    $0xa,%ecx
ja     1146 <vowel+0x26>
movslq %ecx,%rcx
lea    0xebd(%rip),%rdx
mov    (%rdx,%rcx,4),%ebx
test   %eax,%eax
je     115b <vowel+0x3b>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <msg_byte@plt>
test   %eax,%eax
jne    1150 <vowel+0x30>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vowel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @msg_open(i32 %5)
%7 = call i32 (...) @msg_byte()
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 97
br i1 %9, label %22, label %10
10: ; preds = %1
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 101
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 105
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 111
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 117
br i1 %21, label %22, label %23
22: ; preds = %19, %16, %13, %10, %1
store i32 -1, i32* %4
br label %24
23: ; preds = %19
store i32 0, i32* %4
br label %24
24: ; preds = %23, %22
br label %25
25: ; preds = %28, %24
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @msg_byte()
store i32 %29, i32* %3
br label %25
30: ; preds = %25
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@switch.table.vowel = [11 x i32] [i32 -1, i32 0, i32 -1, i32 0, i32 -1, i32 0, i32 0, i32 -1, i32 0, i32 0, i32 -1]
define i32 @vowel(i32 %0) {
%2 = tail call i32 @msg_open(i32 %0)
%3 = tail call i32 (...) @msg_byte()
%4 = add i32 %3, -97
%5 = tail call i32 @llvm.fshl.i32(i32 %4, i32 %4, i32 31)
%6 = icmp ult i32 %5, 11
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = sext i32 %5 to i64
%9 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.vowel, i64 0, i64 %8
%10 = load i32, i32* %9
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 0, %1 ]
%13 = icmp eq i32 %3, 0
br i1 %13, label %17, label %14
14: ; preds = %11, %14
%15 = tail call i32 (...) @msg_byte()
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %14
17: ; preds = %14, %11
ret i32 %12
}