#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*/ strncmp(char const *, char *, int);
int zip_is_intranet2(const char *ip) {
  if (!ip) {
    return 0;
  }
  if ((!strncmp(ip, "127.", 4)) || (!strncmp(ip, "10.", 3)) ||
      (!strncmp(ip, "192.168.", 8))) {
    return 1;
  }
  if ((!strncmp(ip, "172.", 4)) && ip[4] && ip[5] && (ip[6] == '.')) {
    int a = (ip[4] - '0') * 10 + (ip[5] - '0');
    if ((a > 15) && (a < 32)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<zip_is_intranet2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <zip_is_intranet2+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1234 <zip_is_intranet2+0x124>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     118d <zip_is_intranet2+0x7d>
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     118d <zip_is_intranet2+0x7d>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1199 <zip_is_intranet2+0x89>
movl   $0x1,-0x4(%rbp)
jmp    1234 <zip_is_intranet2+0x124>
mov    -0x10(%rbp),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    122d <zip_is_intranet2+0x11d>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x0,%eax
je     122d <zip_is_intranet2+0x11d>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x0,%eax
je     122d <zip_is_intranet2+0x11d>
mov    -0x10(%rbp),%rax
movsbl 0x6(%rax),%eax
cmp    $0x2e,%eax
jne    122d <zip_is_intranet2+0x11d>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
sub    $0x30,%eax
imul   $0xa,%eax,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x5(%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jle    1228 <zip_is_intranet2+0x118>
cmpl   $0x20,-0x14(%rbp)
jge    1228 <zip_is_intranet2+0x118>
movl   $0x1,-0x4(%rbp)
jmp    1234 <zip_is_intranet2+0x124>
jmp    122d <zip_is_intranet2+0x11d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zip_is_intranet2>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1181 <zip_is_intranet2+0x71>
mov    %rdi,%rbx
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1181 <zip_is_intranet2+0x71>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1181 <zip_is_intranet2+0x71>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1181 <zip_is_intranet2+0x71>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     118a <zip_is_intranet2+0x7a>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movsbl 0x4(%rbx),%eax
test   %eax,%eax
je     117f <zip_is_intranet2+0x6f>
movsbl 0x5(%rbx),%ecx
test   %ecx,%ecx
je     117f <zip_is_intranet2+0x6f>
cmpb   $0x2e,0x6(%rbx)
jne    117f <zip_is_intranet2+0x6f>
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
and    $0xfffffff0,%eax
cmp    $0x220,%eax
jne    117f <zip_is_intranet2+0x6f>
jmp    1181 <zip_is_intranet2+0x71>

LLVM IR (-O0):
@.str = [5 x i8] c"127.\00"
@.str.1 = [4 x i8] c"10.\00"
@.str.2 = [9 x i8] c"192.168.\00"
@.str.3 = [5 x i8] c"172.\00"
define i32 @zip_is_intranet2(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %64
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i32 @strncmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i32 @strncmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16, %12, %8
store i32 1, i32* %2
br label %64
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = call i32 @strncmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%24 = icmp ne i32 %23, 0
br i1 %24, label %63, label %25
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %63
31: ; preds = %25
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 5
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %63
37: ; preds = %31
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 6
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 46
br i1 %42, label %43, label %63
43: ; preds = %37
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i64 4
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = sub nsw i32 %47, 48
%49 = mul nsw i32 %48, 10
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i64 5
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = sub nsw i32 %53, 48
%55 = add nsw i32 %49, %54
store i32 %55, i32* %4
%56 = load i32, i32* %4
%57 = icmp sgt i32 %56, 15
br i1 %57, label %58, label %62
58: ; preds = %43
%59 = load i32, i32* %4
%60 = icmp slt i32 %59, 32
br i1 %60, label %61, label %62
61: ; preds = %58
store i32 1, i32* %2
br label %64
62: ; preds = %58, %43
br label %63
63: ; preds = %62, %37, %31, %25, %21
store i32 0, i32* %2
br label %64
64: ; preds = %63, %61, %20, %7
%65 = load i32, i32* %2
ret i32 %65
}

LLVM IR (-O2):
@.str = [5 x i8] c"127.\00"
@.str.1 = [4 x i8] c"10.\00"
@.str.2 = [9 x i8] c"192.168.\00"
@.str.3 = [5 x i8] c"172.\00"
define i32 @zip_is_intranet2(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %35, label %3
3: ; preds = %1
%4 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = icmp eq i32 %4, 0
br i1 %5, label %35, label %6
6: ; preds = %3
%7 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %35, label %9
9: ; preds = %6
%10 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %35, label %12
12: ; preds = %9
%13 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %0, i64 4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i8 %17, 0
br i1 %19, label %34, label %20
20: ; preds = %15
%21 = getelementptr inbounds i8, i8* %0, i64 5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i8 %22, 0
br i1 %24, label %34, label %25
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %0, i64 6
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 46
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = mul nsw i32 %18, 10
%31 = add nsw i32 %30, %23
%32 = and i32 %31, -16
%33 = icmp eq i32 %32, 544
br i1 %33, label %35, label %34
34: ; preds = %29, %25, %20, %15, %12
br label %35
35: ; preds = %29, %3, %6, %9, %1, %34
%36 = phi i32 [ 0, %34 ], [ 1, %29 ], [ 0, %1 ], [ 1, %9 ], [ 1, %6 ], [ 1, %3 ]
ret i32 %36
}