#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 res_hnok(char const *);
int res_mailok(const char *dn) {
  int ch, escaped = 0;
  if (*dn == '\0')
    return (1);
  while ((ch = *dn++) != '\0') {
    if (!((ch) > 0x20 && (ch) < 0x7f))
      return (0);
    if (!escaped && ((ch) == 0x2e))
      break;
    if (escaped)
      escaped = 0;
    else if (((ch) == 0x5c))
      escaped = 1;
  }
  if (((ch) == 0x2e))
    return (res_hnok(dn));
  return (0);
}


x86 assembly (clang, -O0):
<res_mailok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113f <res_mailok+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    11ee <res_mailok+0xde>
jmp    1144 <res_mailok+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11cc <res_mailok+0xbc>
cmpl   $0x20,-0x14(%rbp)
jle    1176 <res_mailok+0x66>
cmpl   $0x7f,-0x14(%rbp)
jl     1182 <res_mailok+0x72>
movl   $0x0,-0x4(%rbp)
jmp    11ee <res_mailok+0xde>
cmpl   $0x0,-0x18(%rbp)
jne    119b <res_mailok+0x8b>
cmpl   $0x2e,-0x14(%rbp)
jne    119b <res_mailok+0x8b>
jmp    11cc <res_mailok+0xbc>
cmpl   $0x0,-0x18(%rbp)
je     11b1 <res_mailok+0xa1>
movl   $0x0,-0x18(%rbp)
jmp    11c7 <res_mailok+0xb7>
cmpl   $0x5c,-0x14(%rbp)
jne    11c2 <res_mailok+0xb2>
movl   $0x1,-0x18(%rbp)
jmp    11c7 <res_mailok+0xb7>
jmp    1144 <res_mailok+0x34>
cmpl   $0x2e,-0x14(%rbp)
jne    11e7 <res_mailok+0xd7>
mov    -0x10(%rbp),%rdi
call   1030 <res_hnok@plt>
mov    %eax,-0x4(%rbp)
jmp    11ee <res_mailok+0xde>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<res_mailok>:
mov    (%rdi),%cl
test   %cl,%cl
je     115d <res_mailok+0x4d>
lea    -0x21(%rcx),%edx
xor    %eax,%eax
cmp    $0x5d,%dl
ja     1165 <res_mailok+0x55>
add    $0x1,%rdi
xor    %eax,%eax
jmp    114f <res_mailok+0x3f>
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
sete   %al
cmp    $0x5c,%cl
sete   %cl
and    %al,%cl
movzbl %cl,%eax
movzbl (%rdi),%ecx
lea    -0x21(%rcx),%edx
add    $0x1,%rdi
cmp    $0x5e,%dl
jae    1163 <res_mailok+0x53>
test   %eax,%eax
jne    1130 <res_mailok+0x20>
cmp    $0x2e,%cl
jne    1130 <res_mailok+0x20>
jmp    1030 <res_hnok@plt>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @res_mailok(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %1
%5 = add i8 %2, -33
%6 = icmp ult i8 %5, 94
br i1 %6, label %7, label %24
7: ; preds = %4, %15
%8 = phi i8 [ %19, %15 ], [ %2, %4 ]
%9 = phi i8* [ %11, %15 ], [ %0, %4 ]
%10 = phi i32 [ %18, %15 ], [ 0, %4 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = icmp eq i32 %10, 0
%13 = icmp eq i8 %8, 46
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %22, label %15
15: ; preds = %7
%16 = icmp eq i8 %8, 92
%17 = select i1 %12, i1 %16, i1 false
%18 = zext i1 %17 to i32
%19 = load i8, i8* %11
%20 = add i8 %19, -33
%21 = icmp ult i8 %20, 94
br i1 %21, label %7, label %24
22: ; preds = %7
%23 = tail call i32 @res_hnok(i8* %11)
br label %24
24: ; preds = %15, %4, %1, %22
%25 = phi i32 [ %23, %22 ], [ 1, %1 ], [ 0, %4 ], [ 0, %15 ]
ret i32 %25
}