#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 */
scalar_t__ isalnum(char const);
int is_lang_id(const char *s) {
  while (isalnum(*s) || '-' == *s)
    ++s;
  if (*s == '.')
    ++s;
  return 'x' == *s;
}


x86 assembly (clang, -O0):
<is_lang_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    114e <is_lang_id+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115e <is_lang_id+0x4e>
jmp    116f <is_lang_id+0x5f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <is_lang_id+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    118b <is_lang_id+0x7b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x78,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_lang_id>:
push   %rbx
mov    %rdi,%rbx
jmp    1124 <is_lang_id+0x14>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movsbl (%rbx),%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1120 <is_lang_id+0x10>
movzbl (%rbx),%ecx
cmp    $0x2d,%cl
je     1120 <is_lang_id+0x10>
cmp    $0x2e,%cl
jne    1141 <is_lang_id+0x31>
mov    0x1(%rbx),%cl
xor    %eax,%eax
cmp    $0x78,%cl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_lang_id(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isalnum(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 45, %11
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ true, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 46
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
br label %26
26: ; preds = %23, %18
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 120, %29
%31 = zext i1 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
define i32 @is_lang_id(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i8* [ %0, %1 ], [ %10, %9 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isalnum(i8 signext %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8, i8* %3
switch i8 %8, label %14 [
i8 45, label %9
i8 46, label %11
]
9: ; preds = %7, %2
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %3, i64 1
%13 = load i8, i8* %12
br label %14
14: ; preds = %7, %11
%15 = phi i8 [ %13, %11 ], [ %8, %7 ]
%16 = icmp eq i8 %15, 120
%17 = zext i1 %16 to i32
ret i32 %17
}