#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*/ printf(char *, char);
void print_word(const char *w, const char *alphabet) {
  while (*w) {
    printf("%c", (*w >= 'a') && (*w <= 'z') && !alphabet[*w - 'a'] ? '_' : *w);
    ++w;
  }
}


x86 assembly (clang, -O0):
<print_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a2 <print_word+0x92>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1175 <print_word+0x65>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1175 <print_word+0x65>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    $0x61,%ecx
movslq %ecx,%rcx
cmpb   $0x0,(%rax,%rcx,1)
jne    1175 <print_word+0x65>
mov    $0x5f,%eax
mov    %eax,-0x14(%rbp)
jmp    117f <print_word+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
lea    0xe77(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <print_word+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_word>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     115f <print_word+0x4f>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xed4(%rip),%r15
jmp    1146 <print_word+0x36>
xchg   %ax,%ax
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     115f <print_word+0x4f>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1130 <print_word+0x20>
movzbl %al,%ecx
add    $0xffffff9f,%ecx
cmpb   $0x0,(%r14,%rcx,1)
jne    1130 <print_word+0x20>
mov    $0x5f,%al
jmp    1130 <print_word+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @print_word(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %34, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %40
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %30
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %19, label %30
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %23, 97
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %20, i64 %25
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %19
br label %34
30: ; preds = %19, %14, %9
%31 = load i8*, i8** %3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
br label %34
34: ; preds = %30, %29
%35 = phi i32 [ 95, %29 ], [ %33, %30 ]
%36 = trunc i32 %35 to i8
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %36)
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %3
br label %5
40: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print_word(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %24, label %5
5: ; preds = %2, %18
%6 = phi i8 [ %22, %18 ], [ %3, %2 ]
%7 = phi i8* [ %21, %18 ], [ %0, %2 ]
%8 = add i8 %6, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = zext i8 %6 to i64
%12 = add nuw nsw i64 %11, 4294967199
%13 = and i64 %12, 4294967295
%14 = getelementptr inbounds i8, i8* %1, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %10, %5
br label %18
18: ; preds = %10, %17
%19 = phi i8 [ %6, %17 ], [ 95, %10 ]
%20 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %19)
%21 = getelementptr inbounds i8, i8* %7, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %5
24: ; preds = %18, %2
ret void
}