#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 */
struct in_addr {
  int dummy;
};
struct hostent {
  scalar_t__ *h_addr_list;
};

/* Variables and functions */
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ inet_ntoa(struct in_addr);
int rand();
int /*<<< orphan*/ sprintf(char *, char *, unsigned short);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
unsigned short int isValidDomain(char *d) {
  unsigned int i = 0, j = 0;
  char *tld;
  size_t len;
  char strTmp[30] = {'\0'}, s[200] = {'\0'};
  unsigned short int n = 0, max = 0;
  struct hostent *h;
  if (strlen(d) < 4)
    return 0;
  if (!strstr(d, "."))
    return 0;
  tld = strstr(d, ".");
  tld = tld + 1;
  while (strstr(tld, ".")) {
    tld = strstr(tld, ".");
    tld = tld + 1;
  }
  if ((strlen(tld) < 2) || (strlen(tld) > 6))
    return 0;
  len = strlen(d);
  for (i = 0; i < len; ++i) {
    if (!(d[i] >= '0' && d[i] <= '9') && !(d[i] >= 'a' && d[i] <= 'z') &&
        !(d[i] >= 'A' && d[i] <= 'Z') && !(d[i] >= '-' && d[i] <= '.'))
      return 0;
  }
  srand(time(NULL));
  max = rand() % 20;
  if (max < 10)
    max = max + (10 - max);
  for (i = 0; i < max; ++i) {
    n = rand() % 10;
    sprintf(strTmp, "%d", n);
    if (i == 0)
      strncpy(s, strTmp, 200 - strlen(s) - 1);
    else
      strncat(s, strTmp, 200 - strlen(s) - 1);
  }
  strncat(s, ".", 200 - strlen(s) - 1);
  strncat(s, d, 200 - strlen(s) - 1);
  h = gethostbyname(s);
  if (h) {
    for (j = 0; h->h_addr_list[j]; ++j)
      inet_ntoa(*((struct in_addr *)h->h_addr_list[j]));
    if (j > 1) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isValidDomain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1060 <memset@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
movw   $0x0,-0x122(%rbp)
movw   $0x0,-0x124(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jge    121f <isValidDomain+0x6f>
movw   $0x0,-0x2(%rbp)
jmp    15f8 <isValidDomain+0x448>
mov    -0x10(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
jne    1244 <isValidDomain+0x94>
movw   $0x0,-0x2(%rbp)
jmp    15f8 <isValidDomain+0x448>
mov    -0x10(%rbp),%rdi
lea    0xdb1(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     12a3 <isValidDomain+0xf3>
mov    -0x20(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1264 <isValidDomain+0xb4>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jl     12c7 <isValidDomain+0x117>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x6,%eax
jle    12d2 <isValidDomain+0x122>
movw   $0x0,-0x2(%rbp)
jmp    15f8 <isValidDomain+0x448>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cltq
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x28(%rbp),%rax
jae    13b3 <isValidDomain+0x203>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     131d <isValidDomain+0x16d>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    13a0 <isValidDomain+0x1f0>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     1345 <isValidDomain+0x195>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    13a0 <isValidDomain+0x1f0>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     136d <isValidDomain+0x1bd>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    13a0 <isValidDomain+0x1f0>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jl     1395 <isValidDomain+0x1e5>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jle    13a0 <isValidDomain+0x1f0>
movw   $0x0,-0x2(%rbp)
jmp    15f8 <isValidDomain+0x448>
jmp    13a5 <isValidDomain+0x1f5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12e8 <isValidDomain+0x138>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x124(%rbp)
movzwl -0x124(%rbp),%eax
cmp    $0xa,%eax
jge    140a <isValidDomain+0x25a>
movzwl -0x124(%rbp),%eax
movzwl -0x124(%rbp),%edx
mov    $0xa,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    %ax,-0x124(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movzwl -0x124(%rbp),%ecx
cmp    %ecx,%eax
jae    14f9 <isValidDomain+0x349>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x122(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xbbb(%rip),%rsi
movzwl -0x122(%rbp),%edx
call   10b0 <sprintf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    14a4 <isValidDomain+0x2f4>
lea    -0x120(%rbp),%rax
mov    %rax,-0x140(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x138(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x140(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    $0xc8,%edx
sub    %eax,%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
jmp    14e6 <isValidDomain+0x336>
lea    -0x120(%rbp),%rax
mov    %rax,-0x150(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x148(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x150(%rbp),%rdi
mov    -0x148(%rbp),%rsi
mov    $0xc8,%edx
sub    %eax,%edx
sub    $0x1,%edx
call   1070 <strncat@plt>
jmp    14eb <isValidDomain+0x33b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1411 <isValidDomain+0x261>
lea    -0x120(%rbp),%rax
mov    %rax,-0x168(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x168(%rbp),%rdi
mov    $0xc8,%edx
sub    %eax,%edx
sub    $0x1,%edx
lea    0xad5(%rip),%rsi
call   1070 <strncat@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x158(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x160(%rbp),%rdi
mov    -0x158(%rbp),%rsi
mov    $0xc8,%edx
sub    %eax,%edx
sub    $0x1,%edx
call   1070 <strncat@plt>
lea    -0x120(%rbp),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x130(%rbp)
cmpq   $0x0,-0x130(%rbp)
je     15f2 <isValidDomain+0x442>
movl   $0x0,-0x18(%rbp)
mov    -0x130(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     15d8 <isValidDomain+0x428>
mov    -0x130(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%edi
call   1040 <inet_ntoa@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    159a <isValidDomain+0x3ea>
cmpl   $0x1,-0x18(%rbp)
jbe    15ed <isValidDomain+0x43d>
movw   $0x0,-0x2(%rbp)
jmp    15f8 <isValidDomain+0x448>
jmp    15f2 <isValidDomain+0x442>
movw   $0x1,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidDomain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdi,%r13
pxor   %xmm0,%xmm0
movdqu %xmm0,0xe(%rsp)
movdqa %xmm0,(%rsp)
movdqa %xmm0,0xd0(%rsp)
movdqa %xmm0,0xc0(%rsp)
movdqa %xmm0,0xb0(%rsp)
movdqa %xmm0,0xa0(%rsp)
movdqa %xmm0,0x90(%rsp)
movdqa %xmm0,0x80(%rsp)
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
movq   $0x0,0xe0(%rsp)
call   1050 <strlen@plt>
cmp    $0x4,%eax
jl     1283 <isValidDomain+0xe3>
mov    %r13,%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1283 <isValidDomain+0xe3>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    1250 <isValidDomain+0xb0>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jl     1283 <isValidDomain+0xe3>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x6,%eax
jle    1297 <isValidDomain+0xf7>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     12fe <isValidDomain+0x15e>
cltq
xor    %ecx,%ecx
movdqa 0xd51(%rip),%xmm0
movdqa 0xd59(%rip),%xmm1
pcmpeqd %xmm2,%xmm2
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%r13,%rcx,1),%edx
movd   %edx,%xmm3
punpcklbw %xmm3,%xmm3
pshuflw $0x0,%xmm3,%xmm3
paddb  %xmm0,%xmm3
movdqa %xmm3,%xmm4
pmaxub %xmm1,%xmm4
pcmpeqb %xmm3,%xmm4
pxor   %xmm2,%xmm4
punpcklbw %xmm4,%xmm3
punpcklwd %xmm3,%xmm3
movmskps %xmm3,%edx
test   %edx,%edx
je     1283 <isValidDomain+0xe3>
add    $0x1,%ecx
cmp    %rax,%rcx
jb     12c0 <isValidDomain+0x120>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movzwl %ax,%ecx
and    $0xfffe,%eax
cmp    $0xa,%eax
mov    $0xa,%ebp
cmovae %ecx,%ebp
test   %ebp,%ebp
je     1411 <isValidDomain+0x271>
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movzwl %ax,%edx
lea    0xca8(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   10b0 <sprintf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0xc7,%edx
sub    %eax,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncpy@plt>
cmp    $0x1,%ebp
je     1411 <isValidDomain+0x271>
add    $0xffffffff,%ebp
lea    0xc6f(%rip),%r14
mov    %rsp,%r15
lea    0x20(%rsp),%r12
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movzwl %ax,%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   10b0 <sprintf@plt>
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    $0xc7,%edx
sub    %eax,%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <strncat@plt>
add    $0xffffffff,%ebp
jne    13c0 <isValidDomain+0x220>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0xc7,%ebp
mov    $0xc7,%edx
sub    %eax,%edx
lea    0xbef(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strncat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
sub    %eax,%ebp
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1070 <strncat@plt>
mov    %rbx,%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     148f <isValidDomain+0x2ef>
mov    %rax,%rbx
mov    (%rax),%rax
mov    (%rax),%rax
test   %rax,%rax
je     148f <isValidDomain+0x2ef>
xor    %ebp,%ebp
nopl   (%rax)
mov    (%rax),%edi
call   1040 <inet_ntoa@plt>
add    $0x1,%ebp
mov    (%rbx),%rax
mov    (%rax,%rbp,8),%rax
test   %rax,%rax
jne    1470 <isValidDomain+0x2d0>
cmp    $0x1,%ebp
ja     1283 <isValidDomain+0xe3>
mov    $0x1,%ax
jmp    1285 <isValidDomain+0xe5>

LLVM IR (-O0):
%struct.hostent = type { i64* }
%struct.in_addr = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%d\00"
define zeroext i16 @isValidDomain(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [30 x i8]
%9 = alloca [200 x i8]
%10 = alloca i16
%11 = alloca i16
%12 = alloca %struct.hostent*
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
%13 = bitcast [30 x i8]* %8 to i8*
%14 = bitcast [200 x i8]* %9 to i8*
store i16 0, i16* %10
store i16 0, i16* %11
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %19
18: ; preds = %1
store i16 0, i16* %2
br label %226
19: ; preds = %1
%20 = load i8*, i8** %3
%21 = call i8* @strstr(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %19
store i16 0, i16* %2
br label %226
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = call i8* @strstr(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8* %28, i8** %6
br label %29
29: ; preds = %33, %24
%30 = load i8*, i8** %6
%31 = call i8* @strstr(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = load i8*, i8** %6
%35 = call i8* @strstr(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8* %37, i8** %6
br label %29
38: ; preds = %29
%39 = load i8*, i8** %6
%40 = call i32 @strlen(i8* %39)
%41 = icmp slt i32 %40, 2
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = load i8*, i8** %6
%44 = call i32 @strlen(i8* %43)
%45 = icmp sgt i32 %44, 6
br i1 %45, label %46, label %47
46: ; preds = %42, %38
store i16 0, i16* %2
br label %226
47: ; preds = %42
%48 = load i8*, i8** %3
%49 = call i32 @strlen(i8* %48)
%50 = sext i32 %49 to i64
store i64 %50, i64* %7
store i32 0, i32* %4
br label %51
51: ; preds = %122, %47
%52 = load i32, i32* %4
%53 = zext i32 %52 to i64
%54 = load i64, i64* %7
%55 = icmp ult i64 %53, %54
br i1 %55, label %56, label %125
56: ; preds = %51
%57 = load i8*, i8** %3
%58 = load i32, i32* %4
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %57, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp sge i32 %62, 48
br i1 %63, label %64, label %72
64: ; preds = %56
%65 = load i8*, i8** %3
%66 = load i32, i32* %4
%67 = zext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp sle i32 %70, 57
br i1 %71, label %121, label %72
72: ; preds = %64, %56
%73 = load i8*, i8** %3
%74 = load i32, i32* %4
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp sge i32 %78, 97
br i1 %79, label %80, label %88
80: ; preds = %72
%81 = load i8*, i8** %3
%82 = load i32, i32* %4
%83 = zext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp sle i32 %86, 122
br i1 %87, label %121, label %88
88: ; preds = %80, %72
%89 = load i8*, i8** %3
%90 = load i32, i32* %4
%91 = zext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp sge i32 %94, 65
br i1 %95, label %96, label %104
96: ; preds = %88
%97 = load i8*, i8** %3
%98 = load i32, i32* %4
%99 = zext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp sle i32 %102, 90
br i1 %103, label %121, label %104
104: ; preds = %96, %88
%105 = load i8*, i8** %3
%106 = load i32, i32* %4
%107 = zext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp sge i32 %110, 45
br i1 %111, label %112, label %120
112: ; preds = %104
%113 = load i8*, i8** %3
%114 = load i32, i32* %4
%115 = zext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %113, i64 %115
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp sle i32 %118, 46
br i1 %119, label %121, label %120
120: ; preds = %112, %104
store i16 0, i16* %2
br label %226
121: ; preds = %112, %96, %80, %64
br label %122
122: ; preds = %121
%123 = load i32, i32* %4
%124 = add i32 %123, 1
store i32 %124, i32* %4
br label %51
125: ; preds = %51
%126 = call i32 @time(i32* null)
%127 = call i32 @srand(i32 %126)
%128 = call i32 (...) @rand()
%129 = srem i32 %128, 20
%130 = trunc i32 %129 to i16
store i16 %130, i16* %11
%131 = load i16, i16* %11
%132 = zext i16 %131 to i32
%133 = icmp slt i32 %132, 10
br i1 %133, label %134, label %142
134: ; preds = %125
%135 = load i16, i16* %11
%136 = zext i16 %135 to i32
%137 = load i16, i16* %11
%138 = zext i16 %137 to i32
%139 = sub nsw i32 10, %138
%140 = add nsw i32 %136, %139
%141 = trunc i32 %140 to i16
store i16 %141, i16* %11
br label %142
142: ; preds = %134, %125
store i32 0, i32* %4
br label %143
143: ; preds = %174, %142
%144 = load i32, i32* %4
%145 = load i16, i16* %11
%146 = zext i16 %145 to i32
%147 = icmp ult i32 %144, %146
br i1 %147, label %148, label %177
148: ; preds = %143
%149 = call i32 (...) @rand()
%150 = srem i32 %149, 10
%151 = trunc i32 %150 to i16
store i16 %151, i16* %10
%152 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%153 = load i16, i16* %10
%154 = call i32 @sprintf(i8* %152, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %153)
%155 = load i32, i32* %4
%156 = icmp eq i32 %155, 0
br i1 %156, label %157, label %165
157: ; preds = %148
%158 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%159 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%160 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%161 = call i32 @strlen(i8* %160)
%162 = sub nsw i32 200, %161
%163 = sub nsw i32 %162, 1
%164 = call i32 @strncpy(i8* %158, i8* %159, i32 %163)
br label %173
165: ; preds = %148
%166 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%167 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%168 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%169 = call i32 @strlen(i8* %168)
%170 = sub nsw i32 200, %169
%171 = sub nsw i32 %170, 1
%172 = call i32 @strncat(i8* %166, i8* %167, i32 %171)
br label %173
173: ; preds = %165, %157
br label %174
174: ; preds = %173
%175 = load i32, i32* %4
%176 = add i32 %175, 1
store i32 %176, i32* %4
br label %143
177: ; preds = %143
%178 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%179 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%180 = call i32 @strlen(i8* %179)
%181 = sub nsw i32 200, %180
%182 = sub nsw i32 %181, 1
%183 = call i32 @strncat(i8* %178, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %182)
%184 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%185 = load i8*, i8** %3
%186 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%187 = call i32 @strlen(i8* %186)
%188 = sub nsw i32 200, %187
%189 = sub nsw i32 %188, 1
%190 = call i32 @strncat(i8* %184, i8* %185, i32 %189)
%191 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%192 = call %struct.hostent* @gethostbyname(i8* %191)
store %struct.hostent* %192, %struct.hostent** %12
%193 = load %struct.hostent*, %struct.hostent** %12
%194 = icmp ne %struct.hostent* %193, null
br i1 %194, label %195, label %225
195: ; preds = %177
store i32 0, i32* %5
br label %196
196: ; preds = %217, %195
%197 = load %struct.hostent*, %struct.hostent** %12
%198 = getelementptr inbounds %struct.hostent, %struct.hostent* %197, i32 0, i32 0
%199 = load i64*, i64** %198
%200 = load i32, i32* %5
%201 = zext i32 %200 to i64
%202 = getelementptr inbounds i64, i64* %199, i64 %201
%203 = load i64, i64* %202
%204 = icmp ne i64 %203, 0
br i1 %204, label %205, label %220
205: ; preds = %196
%206 = load %struct.hostent*, %struct.hostent** %12
%207 = getelementptr inbounds %struct.hostent, %struct.hostent* %206, i32 0, i32 0
%208 = load i64*, i64** %207
%209 = load i32, i32* %5
%210 = zext i32 %209 to i64
%211 = getelementptr inbounds i64, i64* %208, i64 %210
%212 = load i64, i64* %211
%213 = inttoptr i64 %212 to %struct.in_addr*
%214 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %213, i32 0, i32 0
%215 = load i32, i32* %214
%216 = call i32 @inet_ntoa(i32 %215)
br label %217
217: ; preds = %205
%218 = load i32, i32* %5
%219 = add i32 %218, 1
store i32 %219, i32* %5
br label %196
220: ; preds = %196
%221 = load i32, i32* %5
%222 = icmp ugt i32 %221, 1
br i1 %222, label %223, label %224
223: ; preds = %220
store i16 0, i16* %2
br label %226
224: ; preds = %220
br label %225
225: ; preds = %224, %177
store i16 1, i16* %2
br label %226
226: ; preds = %225, %223, %120, %46, %23, %18
%227 = load i16, i16* %2
ret i16 %227
}

LLVM IR (-O2):
%struct.hostent = type { i64* }
%struct.in_addr = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%d\00"
define zeroext i16 @isValidDomain(i8* %0) {
%2 = alloca [30 x i8]
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp slt i32 %6, 4
br i1 %7, label %101, label %8
8: ; preds = %1
%9 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 46)
%10 = icmp eq i8* %9, null
br i1 %10, label %101, label %11
11: ; preds = %8, %11
%12 = phi i8* [ %14, %11 ], [ %9, %8 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = tail call i8* @strchr(i8* %13, i32 46)
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 @strlen(i8* %13)
%18 = icmp slt i32 %17, 2
br i1 %18, label %101, label %19
19: ; preds = %16
%20 = tail call i32 @strlen(i8* %13)
%21 = icmp sgt i32 %20, 6
br i1 %21, label %101, label %22
22: ; preds = %19
%23 = tail call i32 @strlen(i8* %0)
%24 = sext i32 %23 to i64
%25 = icmp eq i32 %23, 0
br i1 %25, label %41, label %30
26: ; preds = %30
%27 = add nuw nsw i64 %31, 1
%28 = and i64 %27, 4294967295
%29 = icmp ult i64 %28, %24
br i1 %29, label %30, label %41
30: ; preds = %22, %26
%31 = phi i64 [ %28, %26 ], [ 0, %22 ]
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = insertelement <4 x i8> poison, i8 %33, i64 0
%35 = shufflevector <4 x i8> %34, <4 x i8> poison, <4 x i32> zeroinitializer
%36 = freeze <4 x i8> %35
%37 = add <4 x i8> %36, <i8 -48, i8 -97, i8 -65, i8 -45>
%38 = icmp ult <4 x i8> %37, <i8 10, i8 26, i8 26, i8 2>
%39 = bitcast <4 x i1> %38 to i4
%40 = icmp eq i4 %39, 0
br i1 %40, label %101, label %26
41: ; preds = %26, %22
%42 = tail call i32 @time(i32* null)
%43 = tail call i32 @srand(i32 %42)
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 20
%46 = and i32 %45, 65534
%47 = icmp ult i32 %46, 10
%48 = and i32 %45, 65535
%49 = select i1 %47, i32 10, i32 %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %71, label %51
51: ; preds = %41
%52 = call i32 (...) @rand()
%53 = srem i32 %52, 10
%54 = trunc i32 %53 to i16
%55 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %54)
%56 = call i32 @strlen(i8* %5)
%57 = sub i32 199, %56
%58 = call i32 @strncpy(i8* %5, i8* %4, i32 %57)
%59 = icmp eq i32 %49, 1
br i1 %59, label %71, label %60
60: ; preds = %51, %60
%61 = phi i32 [ %69, %60 ], [ 1, %51 ]
%62 = call i32 (...) @rand()
%63 = srem i32 %62, 10
%64 = trunc i32 %63 to i16
%65 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %64)
%66 = call i32 @strlen(i8* %5)
%67 = sub i32 199, %66
%68 = call i32 @strncat(i8* %5, i8* %4, i32 %67)
%69 = add nuw nsw i32 %61, 1
%70 = icmp eq i32 %69, %49
br i1 %70, label %71, label %60
71: ; preds = %60, %51, %41
%72 = call i32 @strlen(i8* %5)
%73 = sub i32 199, %72
%74 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %73)
%75 = call i32 @strlen(i8* %5)
%76 = sub i32 199, %75
%77 = call i32 @strncat(i8* %5, i8* %0, i32 %76)
%78 = call %struct.hostent* @gethostbyname(i8* %5)
%79 = icmp eq %struct.hostent* %78, null
br i1 %79, label %100, label %80
80: ; preds = %71
%81 = getelementptr inbounds %struct.hostent, %struct.hostent* %78, i64 0, i32 0
%82 = load i64*, i64** %81
%83 = load i64, i64* %82
%84 = icmp eq i64 %83, 0
br i1 %84, label %100, label %85
85: ; preds = %80, %85
%86 = phi i64 [ %96, %85 ], [ %83, %80 ]
%87 = phi i32 [ %92, %85 ], [ 0, %80 ]
%88 = inttoptr i64 %86 to %struct.in_addr*
%89 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %88, i64 0, i32 0
%90 = load i32, i32* %89
%91 = call i32 @inet_ntoa(i32 %90)
%92 = add i32 %87, 1
%93 = load i64*, i64** %81
%94 = zext i32 %92 to i64
%95 = getelementptr inbounds i64, i64* %93, i64 %94
%96 = load i64, i64* %95
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %85
98: ; preds = %85
%99 = icmp ugt i32 %92, 1
br i1 %99, label %101, label %100
100: ; preds = %80, %98, %71
br label %101
101: ; preds = %30, %98, %16, %19, %8, %1, %100
%102 = phi i16 [ 1, %100 ], [ 0, %1 ], [ 0, %8 ], [ 0, %19 ], [ 0, %16 ], [ 0, %98 ], [ 0, %30 ]
ret i16 %102
}