#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 int sscanf(char const *, char *, unsigned int *, unsigned int *,
                    unsigned int *, unsigned int *, unsigned int *);
unsigned uInCIDR4Format(const char *cCIDR4, unsigned *uIPv4,
                        unsigned *uCIDR4Mask) {
  unsigned a = 0, b = 0, c = 0, d = 0, e = 0, uCount = 0;
  uCount = sscanf(cCIDR4, "%u.%u.%u.%u/%u", &a, &b, &c, &d, &e);
  if (uCount != 5)
    return (0);
  if (!a || !e)
    return (0);
  if (b > 254)
    return (0);
  if (c > 254)
    return (0);
  if (d > 254)
    return (0);
  if (e > 32 || e < 8)
    return (0);
  *uIPv4 = d + (c << 8) + (b << 16) + (a << 24);
  *uCIDR4Mask = (0xffffffff) << (32 - e);
  return (1);
}


x86 assembly (clang, -O0):
<uInCIDR4Format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
lea    -0x30(%rbp),%r9
lea    -0x34(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <sscanf@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
je     118f <uInCIDR4Format+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
cmpl   $0x0,-0x24(%rbp)
je     11a3 <uInCIDR4Format+0x93>
cmpl   $0x0,-0x34(%rbp)
jne    11af <uInCIDR4Format+0x9f>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
cmpl   $0xfe,-0x28(%rbp)
jbe    11c8 <uInCIDR4Format+0xb8>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
cmpl   $0xfe,-0x2c(%rbp)
jbe    11e1 <uInCIDR4Format+0xd1>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
cmpl   $0xfe,-0x30(%rbp)
jbe    11fa <uInCIDR4Format+0xea>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
cmpl   $0x20,-0x34(%rbp)
ja     120e <uInCIDR4Format+0xfe>
cmpl   $0x8,-0x34(%rbp)
jae    121a <uInCIDR4Format+0x10a>
movl   $0x0,-0x4(%rbp)
jmp    1259 <uInCIDR4Format+0x149>
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%eax
shl    $0x8,%eax
add    %eax,%ecx
mov    -0x28(%rbp),%eax
shl    $0x10,%eax
add    %eax,%ecx
mov    -0x24(%rbp),%eax
shl    $0x18,%eax
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x20,%ecx
sub    -0x34(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uInCIDR4Format>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movl   $0x0,0x24(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
lea    0xeab(%rip),%rsi
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
jne    11dc <uInCIDR4Format+0xcc>
mov    0x24(%rsp),%edx
test   %edx,%edx
je     11dc <uInCIDR4Format+0xcc>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
je     11dc <uInCIDR4Format+0xcc>
mov    0x20(%rsp),%edi
cmp    $0xfe,%edi
ja     11dc <uInCIDR4Format+0xcc>
mov    0x1c(%rsp),%r9d
cmp    $0xfe,%r9d
ja     11dc <uInCIDR4Format+0xcc>
mov    0x18(%rsp),%r8d
cmp    $0xfe,%r8d
ja     11dc <uInCIDR4Format+0xcc>
lea    -0x21(%rcx),%esi
cmp    $0xffffffe7,%esi
jb     11dc <uInCIDR4Format+0xcc>
shl    $0x8,%r9d
shl    $0x10,%edi
shl    $0x18,%edx
add    %edi,%edx
add    %r9d,%edx
neg    %cl
mov    $0xffffffff,%eax
shl    %cl,%eax
add    %r8d,%edx
mov    %edx,(%rbx)
mov    %eax,(%r14)
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"%u.%u.%u.%u/%u\00"
define i32 @uInCIDR4Format(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%12 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%13 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%14 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%15 = icmp eq i32 %14, 5
br i1 %15, label %16, label %43
16: ; preds = %3
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
br i1 %21, label %22, label %43
22: ; preds = %16
%23 = load i32, i32* %5
%24 = icmp ugt i32 %23, 254
br i1 %24, label %43, label %25
25: ; preds = %22
%26 = load i32, i32* %6
%27 = icmp ugt i32 %26, 254
br i1 %27, label %43, label %28
28: ; preds = %25
%29 = load i32, i32* %7
%30 = icmp ugt i32 %29, 254
%31 = add i32 %19, -33
%32 = icmp ult i32 %31, -25
%33 = select i1 %30, i1 true, i1 %32
br i1 %33, label %43, label %34
34: ; preds = %28
%35 = shl nuw nsw i32 %26, 8
%36 = shl nuw nsw i32 %23, 16
%37 = shl i32 %17, 24
%38 = add nuw i32 %36, %37
%39 = add nuw i32 %38, %35
%40 = add nuw i32 %39, %29
store i32 %40, i32* %1
%41 = sub nuw nsw i32 32, %19
%42 = shl nsw i32 -1, %41
store i32 %42, i32* %2
br label %43
43: ; preds = %28, %25, %22, %16, %3, %34
%44 = phi i32 [ 1, %34 ], [ 0, %3 ], [ 0, %16 ], [ 0, %22 ], [ 0, %25 ], [ 0, %28 ]
ret i32 %44
}