#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*/ isdigit(int);
int host_is_legal_dline(char *host_name) {
  int number_of_dots = 0;
  if (*host_name == '.')
    return (0);
  while (*host_name) {
    if (*host_name == '.')
      number_of_dots++;
    else if (*host_name == '*') {
      if (*(host_name + 1) == '\0') {
        if (number_of_dots == 3)
          return (1);
        else
          return (0);
      } else
        return (0);
    } else if (!isdigit((int)*host_name))
      return (0);
    host_name++;
  }
  if (number_of_dots == 3)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<host_is_legal_dline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    113f <host_is_legal_dline+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
jmp    1144 <host_is_legal_dline+0x34>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11fa <host_is_legal_dline+0xea>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    116f <host_is_legal_dline+0x5f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e9 <host_is_legal_dline+0xd9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    11be <host_is_legal_dline+0xae>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    11b2 <host_is_legal_dline+0xa2>
cmpl   $0x3,-0x14(%rbp)
jne    11a6 <host_is_legal_dline+0x96>
movl   $0x1,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
movl   $0x0,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
movl   $0x0,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11df <host_is_legal_dline+0xcf>
movl   $0x0,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
jmp    11e4 <host_is_legal_dline+0xd4>
jmp    11e9 <host_is_legal_dline+0xd9>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <host_is_legal_dline+0x34>
cmpl   $0x3,-0x14(%rbp)
jne    1210 <host_is_legal_dline+0x100>
movl   $0x1,-0x4(%rbp)
jmp    1217 <host_is_legal_dline+0x107>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_is_legal_dline>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    $0x2e,%cl
jne    1116 <host_is_legal_dline+0x16>
movzbl %al,%eax
ret
nopl   (%rax)
add    $0x1,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
cmp    $0x2e,%cl
je     1110 <host_is_legal_dline+0x10>
test   %cl,%cl
je     1139 <host_is_legal_dline+0x39>
cmp    $0x2a,%cl
je     1143 <host_is_legal_dline+0x43>
movsbl %cl,%ecx
add    $0xffffffd0,%ecx
cmp    $0x9,%ecx
jbe    1113 <host_is_legal_dline+0x13>
xor    %eax,%eax
movzbl %al,%eax
ret
cmp    $0x3,%eax
sete   %al
movzbl %al,%eax
ret
cmpb   $0x0,(%rdi)
sete   %cl
cmp    $0x3,%eax
sete   %al
and    %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @host_is_legal_dline(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 46
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %57
10: ; preds = %1
br label %11
11: ; preds = %49, %10
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %52
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 46
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %49
23: ; preds = %15
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 42
br i1 %27, label %28, label %40
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %28
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 3
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 1, i32* %2
br label %57
38: ; preds = %34
store i32 0, i32* %2
br label %57
39: ; preds = %28
store i32 0, i32* %2
br label %57
40: ; preds = %23
%41 = load i8*, i8** %3
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = call i32 @isdigit(i32 %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %40
store i32 0, i32* %2
br label %57
47: ; preds = %40
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48, %20
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %3
br label %11
52: ; preds = %11
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 3
br i1 %54, label %55, label %56
55: ; preds = %52
store i32 1, i32* %2
br label %57
56: ; preds = %52
store i32 0, i32* %2
br label %57
57: ; preds = %56, %55, %46, %39, %38, %37, %9
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
define i32 @host_is_legal_dline(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 46
br i1 %3, label %26, label %4
4: ; preds = %1, %20
%5 = phi i8 [ %23, %20 ], [ %2, %1 ]
%6 = phi i8* [ %22, %20 ], [ %0, %1 ]
%7 = phi i32 [ %21, %20 ], [ 0, %1 ]
switch i8 %5, label %16 [
i8 0, label %24
i8 46, label %8
i8 42, label %10
]
8: ; preds = %4
%9 = add nsw i32 %7, 1
br label %20
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = icmp eq i32 %7, 3
%15 = select i1 %13, i1 %14, i1 false
br label %26
16: ; preds = %4
%17 = sext i8 %5 to i32
%18 = add nsw i32 %17, -48
%19 = icmp ult i32 %18, 10
br i1 %19, label %20, label %26
20: ; preds = %16, %8
%21 = phi i32 [ %9, %8 ], [ %7, %16 ]
%22 = getelementptr inbounds i8, i8* %6, i64 1
%23 = load i8, i8* %22
br label %4
24: ; preds = %4
%25 = icmp eq i32 %7, 3
br label %26
26: ; preds = %16, %10, %24, %1
%27 = phi i1 [ false, %1 ], [ %25, %24 ], [ %15, %10 ], [ false, %16 ]
%28 = zext i1 %27 to i32
ret i32 %28
}