#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 */
unsigned long ntohl(unsigned long);
int IsAddressMulticast(unsigned long address) {
  unsigned long adr = ntohl(address);
  unsigned char A = (unsigned char)((adr & 0xFF000000) >> 24);
  unsigned char B = (unsigned char)((adr & 0xFF0000) >> 16);
  unsigned char C = (unsigned char)((adr & 0xFF00) >> 8);
  if (A == 224 && B == 0 && C == 0) {
    return -1;
  }
  if (A >= 224 && A <= 239)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<IsAddressMulticast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ntohl@plt>
mov    %rax,-0x18(%rbp)
movabs $0xff000000,%rax
and    -0x18(%rbp),%rax
shr    $0x18,%rax
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
and    $0xff0000,%rax
shr    $0x10,%rax
mov    %al,-0x1a(%rbp)
mov    -0x18(%rbp),%rax
and    $0xff00,%rax
shr    $0x8,%rax
mov    %al,-0x1b(%rbp)
movzbl -0x19(%rbp),%eax
cmp    $0xe0,%eax
jne    1195 <IsAddressMulticast+0x85>
movzbl -0x1a(%rbp),%eax
cmp    $0x0,%eax
jne    1195 <IsAddressMulticast+0x85>
movzbl -0x1b(%rbp),%eax
cmp    $0x0,%eax
jne    1195 <IsAddressMulticast+0x85>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c6 <IsAddressMulticast+0xb6>
movzbl -0x19(%rbp),%eax
cmp    $0xe0,%eax
jl     11bf <IsAddressMulticast+0xaf>
movzbl -0x19(%rbp),%eax
cmp    $0xef,%eax
jg     11bf <IsAddressMulticast+0xaf>
movl   $0x1,-0x4(%rbp)
jmp    11c6 <IsAddressMulticast+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsAddressMulticast>:
push   %rax
call   1030 <ntohl@plt>
mov    %eax,%ecx
and    $0xff000000,%ecx
mov    %eax,%edx
and    $0xffff00,%edx
and    $0xf0000000,%eax
xor    %esi,%esi
cmp    $0xe0000000,%eax
sete   %sil
cmp    $0x1,%rdx
sbb    %eax,%eax
or     %esi,%eax
cmp    $0xe0000000,%ecx
cmovne %esi,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @IsAddressMulticast(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i64 %0, i64* %3
%8 = load i64, i64* %3
%9 = call i64 @ntohl(i64 %8)
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = and i64 %10, 4278190080
%12 = lshr i64 %11, 24
%13 = trunc i64 %12 to i8
store i8 %13, i8* %5
%14 = load i64, i64* %4
%15 = and i64 %14, 16711680
%16 = lshr i64 %15, 16
%17 = trunc i64 %16 to i8
store i8 %17, i8* %6
%18 = load i64, i64* %4
%19 = and i64 %18, 65280
%20 = lshr i64 %19, 8
%21 = trunc i64 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %5
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 224
br i1 %24, label %25, label %34
25: ; preds = %1
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 -1, i32* %2
br label %44
34: ; preds = %29, %25, %1
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = icmp sge i32 %36, 224
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = load i8, i8* %5
%40 = zext i8 %39 to i32
%41 = icmp sle i32 %40, 239
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 1, i32* %2
br label %44
43: ; preds = %38, %34
store i32 0, i32* %2
br label %44
44: ; preds = %43, %42, %33
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @IsAddressMulticast(i64 %0) {
%2 = tail call i64 @ntohl(i64 %0)
%3 = trunc i64 %2 to i32
%4 = and i32 %3, -16777216
%5 = icmp eq i32 %4, -536870912
%6 = and i64 %2, 16711680
%7 = icmp eq i64 %6, 0
%8 = select i1 %5, i1 %7, i1 false
%9 = and i64 %2, 65280
%10 = icmp eq i64 %9, 0
%11 = select i1 %8, i1 %10, i1 false
%12 = and i32 %3, -268435456
%13 = icmp eq i32 %12, -536870912
%14 = zext i1 %13 to i32
%15 = select i1 %11, i32 -1, i32 %14
ret i32 %15
}