#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__ strcasecmp(char const *, char *);
char *strchr(char const *, char);
int strlen(char const *);
int checkdots(register const char *name) {
  register const char *cp, *cp2;
  if ((cp = strchr(name, '.')) == NULL)
    return (0);
  cp2 = name + strlen(name) - 1;
  if (cp2 >= name && *cp2 == '.')
    return (0);
  ++cp;
  if (strchr(cp, '.') != NULL)
    return (1);
  if (strlen(cp) == 2 || strcasecmp(cp, "gov") == 0 ||
      strcasecmp(cp, "edu") == 0 || strcasecmp(cp, "com") == 0 ||
      strcasecmp(cp, "net") == 0 || strcasecmp(cp, "org") == 0 ||
      strcasecmp(cp, "mil") == 0 || strcasecmp(cp, "int") == 0 ||
      strcasecmp(cp, "nato") == 0 || strcasecmp(cp, "arpa") == 0)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<checkdots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1164 <checkdots+0x34>
movl   $0x0,-0x4(%rbp)
jmp    12f2 <checkdots+0x1c2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     11b3 <checkdots+0x83>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11b3 <checkdots+0x83>
movl   $0x0,-0x4(%rbp)
jmp    12f2 <checkdots+0x1c2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     11e3 <checkdots+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    12f2 <checkdots+0x1c2>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xd7c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xd66(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12df <checkdots+0x1af>
mov    -0x18(%rbp),%rdi
lea    0xd51(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12eb <checkdots+0x1bb>
movl   $0x1,-0x4(%rbp)
jmp    12f2 <checkdots+0x1c2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkdots>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
mov    $0x2e,%esi
call   1050 <strchr@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1261 <checkdots+0x131>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1040 <strlen@plt>
cltq
add    %rbp,%rax
add    $0xffffffffffffffff,%rax
cmp    %rbp,%rax
jb     116f <checkdots+0x3f>
cmpb   $0x2e,(%rax)
je     1261 <checkdots+0x131>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    1261 <checkdots+0x131>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
je     1261 <checkdots+0x131>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xe45(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xe31(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xe21(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xe11(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xe01(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xdf1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xde1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1261 <checkdots+0x131>
lea    0xdd2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
sete   %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"gov\00"
@.str.1 = [4 x i8] c"edu\00"
@.str.2 = [4 x i8] c"com\00"
@.str.3 = [4 x i8] c"net\00"
@.str.4 = [4 x i8] c"org\00"
@.str.5 = [4 x i8] c"mil\00"
@.str.6 = [4 x i8] c"int\00"
@.str.7 = [5 x i8] c"nato\00"
@.str.8 = [5 x i8] c"arpa\00"
define i32 @checkdots(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strchr(i8* %6, i8 signext 46)
store i8* %7, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %75
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = getelementptr inbounds i8, i8* %15, i64 -1
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i8*, i8** %3
%19 = icmp uge i8* %17, %18
br i1 %19, label %20, label %26
20: ; preds = %10
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 46
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %2
br label %75
26: ; preds = %20, %10
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
%29 = load i8*, i8** %4
%30 = call i8* @strchr(i8* %29, i8 signext 46)
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %33
32: ; preds = %26
store i32 1, i32* %2
br label %75
33: ; preds = %26
%34 = load i8*, i8** %4
%35 = call i32 @strlen(i8* %34)
%36 = icmp eq i32 %35, 2
br i1 %36, label %73, label %37
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = call i64 @strcasecmp(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %73, label %41
41: ; preds = %37
%42 = load i8*, i8** %4
%43 = call i64 @strcasecmp(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %73, label %45
45: ; preds = %41
%46 = load i8*, i8** %4
%47 = call i64 @strcasecmp(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %73, label %49
49: ; preds = %45
%50 = load i8*, i8** %4
%51 = call i64 @strcasecmp(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %73, label %53
53: ; preds = %49
%54 = load i8*, i8** %4
%55 = call i64 @strcasecmp(i8* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %73, label %57
57: ; preds = %53
%58 = load i8*, i8** %4
%59 = call i64 @strcasecmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %73, label %61
61: ; preds = %57
%62 = load i8*, i8** %4
%63 = call i64 @strcasecmp(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %73, label %65
65: ; preds = %61
%66 = load i8*, i8** %4
%67 = call i64 @strcasecmp(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %65
%70 = load i8*, i8** %4
%71 = call i64 @strcasecmp(i8* %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %69, %65, %61, %57, %53, %49, %45, %41, %37, %33
store i32 1, i32* %2
br label %75
74: ; preds = %69
store i32 0, i32* %2
br label %75
75: ; preds = %74, %73, %32, %25, %9
%76 = load i32, i32* %2
ret i32 %76
}

LLVM IR (-O2):
@.str = [4 x i8] c"gov\00"
@.str.1 = [4 x i8] c"edu\00"
@.str.2 = [4 x i8] c"com\00"
@.str.3 = [4 x i8] c"net\00"
@.str.4 = [4 x i8] c"org\00"
@.str.5 = [4 x i8] c"mil\00"
@.str.6 = [4 x i8] c"int\00"
@.str.7 = [5 x i8] c"nato\00"
@.str.8 = [5 x i8] c"arpa\00"
define i32 @checkdots(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %48, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = icmp ult i8* %8, %0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 46
br i1 %12, label %48, label %13
13: ; preds = %10, %4
%14 = getelementptr inbounds i8, i8* %2, i64 1
%15 = tail call i8* @strchr(i8* %14, i8 signext 46)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %48
17: ; preds = %13
%18 = tail call i32 @strlen(i8* %14)
%19 = icmp eq i32 %18, 2
br i1 %19, label %48, label %20
20: ; preds = %17
%21 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %48, label %23
23: ; preds = %20
%24 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %48, label %26
26: ; preds = %23
%27 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %48, label %29
29: ; preds = %26
%30 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %29
%33 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %48, label %35
35: ; preds = %32
%36 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %48, label %38
38: ; preds = %35
%39 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %38
%42 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = tail call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
%47 = zext i1 %46 to i32
br label %48
48: ; preds = %44, %17, %20, %23, %26, %29, %32, %35, %38, %41, %13, %10, %1
%49 = phi i32 [ 0, %1 ], [ 0, %10 ], [ 1, %13 ], [ 1, %41 ], [ 1, %38 ], [ 1, %35 ], [ 1, %32 ], [ 1, %29 ], [ 1, %26 ], [ 1, %23 ], [ 1, %20 ], [ 1, %17 ], [ %47, %44 ]
ret i32 %49
}