#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, TYPE_1__ *);
int ntohl(int /*<<< orphan*/);
int isrfc1918addr(char *ip4Addr) {
  static struct sockaddr_in sockaddrtemp;
  inet_pton(AF_INET, ip4Addr, &sockaddrtemp.sin_addr);
  if ((ntohl(sockaddrtemp.sin_addr.s_addr) & 0xff000000) >> 24 == 10 ||
      (ntohl(sockaddrtemp.sin_addr.s_addr) & 0xfff00000) >> 16 ==
          172 * 256 + 16 ||
      (ntohl(sockaddrtemp.sin_addr.s_addr) & 0xffff0000) >> 16 ==
          192 * 256 + 168)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isrfc1918addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
lea    0x2ef4(%rip),%rdx
call   1030 <inet_pton@plt>
mov    0x2ee9(%rip),%edi
call   1040 <ntohl@plt>
and    $0xff000000,%eax
shr    $0x18,%eax
cmp    $0xa,%eax
je     119d <isrfc1918addr+0x7d>
mov    0x2ecd(%rip),%edi
call   1040 <ntohl@plt>
and    $0xfff00000,%eax
shr    $0x10,%eax
cmp    $0xac10,%eax
je     119d <isrfc1918addr+0x7d>
mov    0x2eaf(%rip),%edi
call   1040 <ntohl@plt>
and    $0xffff0000,%eax
shr    $0x10,%eax
cmp    $0xc0a8,%eax
jne    11a9 <isrfc1918addr+0x89>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <isrfc1918addr+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrfc1918addr>:
push   %rax
mov    %rdi,%rsi
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0x2f00(%rip),%rdx
call   1030 <inet_pton@plt>
mov    0x2ef5(%rip),%edi
call   1040 <ntohl@plt>
mov    %eax,%ecx
and    $0xff000000,%ecx
cmp    $0xa000000,%ecx
sete   %cl
mov    %eax,%edx
and    $0xfff00000,%edx
cmp    $0xac100000,%edx
sete   %dl
or     %cl,%dl
and    $0xffff0000,%eax
cmp    $0xc0a80000,%eax
sete   %al
or     %dl,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@isrfc1918addr.sockaddrtemp = internal global %struct.sockaddr_in zeroinitializer
@AF_INET = global i32 0
define i32 @isrfc1918addr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @AF_INET
%5 = load i8*, i8** %3
%6 = call i32 @inet_pton(i32 %4, i8* %5, %struct.TYPE_2__* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i32 0, i32 0))
%7 = load i32, i32* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i32 0, i32 0, i32 0)
%8 = call i32 @ntohl(i32 %7)
%9 = and i32 %8, -16777216
%10 = lshr i32 %9, 24
%11 = icmp eq i32 %10, 10
br i1 %11, label %24, label %12
12: ; preds = %1
%13 = load i32, i32* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i32 0, i32 0, i32 0)
%14 = call i32 @ntohl(i32 %13)
%15 = and i32 %14, -1048576
%16 = lshr i32 %15, 16
%17 = icmp eq i32 %16, 44048
br i1 %17, label %24, label %18
18: ; preds = %12
%19 = load i32, i32* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i32 0, i32 0, i32 0)
%20 = call i32 @ntohl(i32 %19)
%21 = and i32 %20, -65536
%22 = lshr i32 %21, 16
%23 = icmp eq i32 %22, 49320
br i1 %23, label %24, label %25
24: ; preds = %18, %12, %1
store i32 1, i32* %2
br label %26
25: ; preds = %18
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@isrfc1918addr.sockaddrtemp = internal global %struct.sockaddr_in zeroinitializer
@AF_INET = global i32 0
define i32 @isrfc1918addr(i8* %0) {
%2 = load i32, i32* @AF_INET
%3 = tail call i32 @inet_pton(i32 %2, i8* %0, %struct.TYPE_2__* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i64 0, i32 0))
%4 = load i32, i32* getelementptr inbounds (%struct.sockaddr_in, %struct.sockaddr_in* @isrfc1918addr.sockaddrtemp, i64 0, i32 0, i32 0)
%5 = tail call i32 @ntohl(i32 %4)
%6 = and i32 %5, -16777216
%7 = icmp eq i32 %6, 167772160
%8 = and i32 %5, -1048576
%9 = icmp eq i32 %8, -1408237568
%10 = or i1 %7, %9
%11 = and i32 %5, -65536
%12 = icmp eq i32 %11, -1062731776
%13 = select i1 %10, i1 true, i1 %12
%14 = zext i1 %13 to i32
ret i32 %14
}