#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 */
char *_is_shortname(char const *);
char *_is_single_terminal(char const *, char);
char const *_is_hostname(char const *peek) {
  char const *tmp_peek;
  if (!(peek = _is_shortname(peek)))
    return NULL;
  tmp_peek = peek;
  while (*peek) {
    if ((tmp_peek = _is_single_terminal(tmp_peek, '.')) &&
        (tmp_peek = _is_shortname(tmp_peek))) {
      peek = tmp_peek;
      continue;
    }
    break;
  }
  return peek;
}


x86 assembly (clang, -O0):
<_is_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_is_shortname@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1150 <_is_hostname+0x30>
movq   $0x0,-0x8(%rbp)
jmp    11b2 <_is_hostname+0x92>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11aa <_is_hostname+0x8a>
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <_is_single_terminal@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11a5 <_is_hostname+0x85>
mov    -0x18(%rbp),%rdi
call   1040 <_is_shortname@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11a5 <_is_hostname+0x85>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1158 <_is_hostname+0x38>
jmp    11aa <_is_hostname+0x8a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_hostname>:
push   %rbx
call   1040 <_is_shortname@plt>
test   %rax,%rax
je     1159 <_is_hostname+0x39>
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbx
cmpb   $0x0,(%rax)
je     115b <_is_hostname+0x3b>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <_is_single_terminal@plt>
test   %rax,%rax
je     115b <_is_hostname+0x3b>
mov    %rax,%rdi
call   1040 <_is_shortname@plt>
test   %rax,%rax
jne    1130 <_is_hostname+0x10>
jmp    115b <_is_hostname+0x3b>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @_is_hostname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @_is_shortname(i8* %5)
store i8* %6, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i8* null, i8** %2
br label %28
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** %4
br label %11
11: ; preds = %23, %9
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i8* @_is_single_terminal(i8* %16, i8 signext 46)
store i8* %17, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = call i8* @_is_shortname(i8* %20)
store i8* %21, i8** %4
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i8*, i8** %4
store i8* %24, i8** %3
br label %11
25: ; preds = %19, %15
br label %26
26: ; preds = %25, %11
%27 = load i8*, i8** %3
store i8* %27, i8** %2
br label %28
28: ; preds = %26, %8
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
define i8* @_is_hostname(i8* %0) {
%2 = tail call i8* @_is_shortname(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %14, label %4
4: ; preds = %1, %11
%5 = phi i8* [ %12, %11 ], [ %2, %1 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %4
%9 = tail call i8* @_is_single_terminal(i8* %5, i8 signext 46)
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i8* @_is_shortname(i8* %9)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %4
14: ; preds = %4, %11, %8, %1
%15 = phi i8* [ null, %1 ], [ %5, %8 ], [ %5, %11 ], [ %5, %4 ]
ret i8* %15
}