#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 wint_t;

/* Variables and functions */
int WEOF;
scalar_t__ iswalnum(int);
int utf8_wide_char(char const *);
int string_is_word_char(const char *string) {
  wint_t c = utf8_wide_char(string);
  if (c == WEOF)
    return 0;
  if (iswalnum(c))
    return 1;
  switch (c) {
  case '-':
  case '_':
  case '|':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<string_is_word_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <utf8_wide_char@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
jne    1156 <string_is_word_char+0x36>
movl   $0x0,-0x4(%rbp)
jmp    11bd <string_is_word_char+0x9d>
mov    -0x14(%rbp),%edi
call   1030 <iswalnum@plt>
cmp    $0x0,%rax
je     1174 <string_is_word_char+0x54>
movl   $0x1,-0x4(%rbp)
jmp    11bd <string_is_word_char+0x9d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2d,%eax
je     11aa <string_is_word_char+0x8a>
jmp    1188 <string_is_word_char+0x68>
mov    -0x18(%rbp),%eax
sub    $0x5f,%eax
je     11aa <string_is_word_char+0x8a>
jmp    1199 <string_is_word_char+0x79>
mov    -0x18(%rbp),%eax
sub    $0x7c,%eax
jne    11b6 <string_is_word_char+0x96>
jmp    11aa <string_is_word_char+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    11bd <string_is_word_char+0x9d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_is_word_char>:
push   %rbx
call   1040 <utf8_wide_char@plt>
mov    %eax,%ebx
mov    0x2eb1(%rip),%rcx
xor    %eax,%eax
cmp    (%rcx),%ebx
je     1149 <string_is_word_char+0x29>
mov    %ebx,%edi
call   1030 <iswalnum@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     114b <string_is_word_char+0x2b>
pop    %rbx
ret
cmp    $0x2d,%ebx
je     1149 <string_is_word_char+0x29>
cmp    $0x5f,%ebx
je     1149 <string_is_word_char+0x29>
cmp    $0x7c,%ebx
je     1149 <string_is_word_char+0x29>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@WEOF = global i32 0
define i32 @string_is_word_char(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @utf8_wide_char(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* @WEOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %20
11: ; preds = %1
%12 = load i32, i32* %4
%13 = call i64 @iswalnum(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %20
16: ; preds = %11
%17 = load i32, i32* %4
switch i32 %17, label %19 [
i32 45, label %18
i32 95, label %18
i32 124, label %18
]
18: ; preds = %16, %16, %16
store i32 1, i32* %2
br label %20
19: ; preds = %16
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %15, %10
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@WEOF = global i32 0
define i32 @string_is_word_char(i8* %0) {
%2 = tail call i32 @utf8_wide_char(i8* %0)
%3 = load i32, i32* @WEOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i64 @iswalnum(i32 %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
switch i32 %2, label %9 [
i32 45, label %10
i32 95, label %10
i32 124, label %10
]
9: ; preds = %8
br label %10
10: ; preds = %8, %8, %8, %5, %1, %9
%11 = phi i32 [ 0, %9 ], [ 0, %1 ], [ 1, %5 ], [ 1, %8 ], [ 1, %8 ], [ 1, %8 ]
ret i32 %11
}