#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*/ isalnum(char const);
int /*<<< orphan*/ strchr(char *, char const);
int invalid_host(const char *p) {
  while (*p) {
    if (!isalnum(*p) || !strchr(".-?*", *p))
      return 1;
    p++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<invalid_host>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1187 <invalid_host+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%eax
je     116a <invalid_host+0x4a>
mov    -0x10(%rbp),%rax
lea    0xea7(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%eax
jne    1176 <invalid_host+0x56>
movl   $0x1,-0x4(%rbp)
jmp    118e <invalid_host+0x6e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <invalid_host+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalid_host>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1167 <invalid_host+0x47>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xec8(%rip),%r14
mov    $0x1,%ebp
nopl   (%rax)
movsbl %al,%edi
call   1040 <isalnum@plt>
test   %eax,%eax
je     1169 <invalid_host+0x49>
movsbl -0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %eax,%eax
je     1169 <invalid_host+0x49>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <invalid_host+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".-?*\00"
define i32 @invalid_host(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %19, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @isalnum(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = call i32 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %13, %8
store i32 1, i32* %2
br label %23
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %4
22: ; preds = %4
store i32 0, i32* %2
br label %23
23: ; preds = %22, %18
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@.str = [5 x i8] c".-?*\00"
define i32 @invalid_host(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %7
4: ; preds = %12
%5 = load i8, i8* %16
%6 = icmp eq i8 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %16, %4 ], [ %0, %1 ]
%10 = tail call i32 @isalnum(i8 signext %8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %7
%13 = load i8, i8* %9
%14 = tail call i32 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %13)
%15 = icmp eq i32 %14, 0
%16 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %15, label %17, label %4
17: ; preds = %12, %7, %4, %1
%18 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %7 ], [ 1, %12 ]
ret i32 %18
}