#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 */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
bool IsPrivateAddress(uint32_t ip) {
  uint8_t b1, b2, b3, b4;
  b1 = (uint8_t)(ip >> 24);
  b2 = (uint8_t)((ip >> 16) & 0x0ff);
  b3 = (uint8_t)((ip >> 8) & 0x0ff);
  b3 = (uint8_t)(ip & 0x0ff);
  if (b1 == 10)
    return true;
  if ((b1 == 172) && (b2 >= 16) && (b2 <= 31))
    return true;
  if ((b1 == 192) && (b2 == 168))
    return true;
  return false;
}


x86 assembly (clang, -O0):
<IsPrivateAddress>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    114d <IsPrivateAddress+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <IsPrivateAddress+0xa7>
cmpl   $0xac,-0xc(%rbp)
jne    117a <IsPrivateAddress+0x7a>
cmpl   $0x10,-0x10(%rbp)
jl     117a <IsPrivateAddress+0x7a>
cmpl   $0x1f,-0x10(%rbp)
jg     117a <IsPrivateAddress+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <IsPrivateAddress+0xa7>
cmpl   $0xc0,-0xc(%rbp)
jne    11a0 <IsPrivateAddress+0xa0>
cmpl   $0xa8,-0x10(%rbp)
jne    11a0 <IsPrivateAddress+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <IsPrivateAddress+0xa7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsPrivateAddress>:
and    $0xff000000,%edi
xor    %eax,%eax
cmp    $0xa000000,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @IsPrivateAddress(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
%8 = load i32, i32* %3
%9 = ashr i32 %8, 24
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = ashr i32 %10, 16
%12 = and i32 %11, 255
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
store i32 %15, i32* %6
%16 = load i32, i32* %3
%17 = and i32 %16, 255
store i32 %17, i32* %6
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %21
20: ; preds = %1
store i32 1, i32* %2
br label %39
21: ; preds = %1
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 172
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp sge i32 %25, 16
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp sle i32 %28, 31
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 1, i32* %2
br label %39
31: ; preds = %27, %24, %21
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 192
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 168
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 1, i32* %2
br label %39
38: ; preds = %34, %31
store i32 0, i32* %2
br label %39
39: ; preds = %38, %37, %30, %20
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @IsPrivateAddress(i32 %0) {
%2 = and i32 %0, -16777216
%3 = icmp eq i32 %2, 167772160
%4 = zext i1 %3 to i32
ret i32 %4
}