#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 _submask_isnum(char *);
int _submask_isone(char *);
scalar_t__ _submask_testadd(char *);
scalar_t__ _submask_testmaskc(int);
int _submask_unmask(char *, char *);
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int submask_iserror(char ip[16], char mask[16]) {
  if (_submask_isnum(ip) == 1 || _submask_isnum(mask) == 1) {
    printf("²ÎÊýÖÐ´æÔÚ·Ç·¨×Ö·û!\n");
    return 1;
  }
  if (strlen(mask) > 2) {
    if (_submask_testadd(ip) == 0) {
      printf("ipµØÖ·¸ñÊ½´íÎó!\n");
      return 1;
    } else if (_submask_testadd(mask) == 0) {
      printf("×ÓÍøÑÚÂë¸ñÊ½´íÎó!\n");
      return 1;
    } else if (_submask_unmask(ip, mask) == 1) {
      printf("×ÓÍøÑÚÂë²»Á¬Ðø!\n");
      return 1;
    } else if (_submask_isone(mask) == 1) {
      printf("Î¨Ò»µÄipµØÖ·:%s\n", ip);
      return 1;
    }
  } else {
    if (_submask_testadd(ip) == 0) {
      printf("ipµØÖ·¸ñÊ½´íÎó!\n");
      return 1;
    } else if (_submask_testmaskc(atoi(mask)) == 0) {
      printf("×ÓÍøÑÚÂë´óÐ¡´íÎó!\n");
      return 1;
    } else if (_submask_unmask(ip, mask) == 1) {
      printf("×ÓÍøÑÚÂëÎ»Êý¹ýÉÙ!\n");
      return 1;
    } else if ((atoi(mask) == 32) || (atoi(mask) == 0)) {
      printf("Î¨Ò»µÄipµØÖ·:%s\n", ip);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<submask_iserror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <_submask_isnum@plt>
cmp    $0x1,%eax
je     11b4 <submask_iserror+0x34>
mov    -0x18(%rbp),%rdi
call   10a0 <_submask_isnum@plt>
cmp    $0x1,%eax
jne    11ce <submask_iserror+0x4e>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jle    12ae <submask_iserror+0x12e>
mov    -0x10(%rbp),%rdi
call   1030 <_submask_testadd@plt>
cmp    $0x0,%rax
jne    120d <submask_iserror+0x8d>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x18(%rbp),%rdi
call   1030 <_submask_testadd@plt>
cmp    $0x0,%rax
jne    123a <submask_iserror+0xba>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <_submask_unmask@plt>
cmp    $0x1,%eax
jne    126a <submask_iserror+0xea>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x18(%rbp),%rdi
call   1060 <_submask_isone@plt>
cmp    $0x1,%eax
jne    129a <submask_iserror+0x11a>
mov    -0x10(%rbp),%rsi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
jmp    129f <submask_iserror+0x11f>
jmp    12a4 <submask_iserror+0x124>
jmp    12a9 <submask_iserror+0x129>
jmp    1395 <submask_iserror+0x215>
mov    -0x10(%rbp),%rdi
call   1030 <_submask_testadd@plt>
cmp    $0x0,%rax
jne    12db <submask_iserror+0x15b>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1080 <_submask_testmaskc@plt>
cmp    $0x0,%rax
jne    130f <submask_iserror+0x18f>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <_submask_unmask@plt>
cmp    $0x1,%eax
jne    133f <submask_iserror+0x1bf>
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
cmp    $0x20,%eax
je     1363 <submask_iserror+0x1e3>
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
cmp    $0x0,%eax
jne    1381 <submask_iserror+0x201>
mov    -0x10(%rbp),%rsi
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    139c <submask_iserror+0x21c>
jmp    1386 <submask_iserror+0x206>
jmp    138b <submask_iserror+0x20b>
jmp    1390 <submask_iserror+0x210>
jmp    1395 <submask_iserror+0x215>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<submask_iserror>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   10b0 <_submask_isnum@plt>
cmp    $0x1,%eax
je     11b1 <submask_iserror+0x21>
mov    %rbx,%rdi
call   10b0 <_submask_isnum@plt>
cmp    $0x1,%eax
jne    11c7 <submask_iserror+0x37>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <_submask_testadd@plt>
cmp    $0x3,%ebp
jl     1209 <submask_iserror+0x79>
test   %rax,%rax
je     123e <submask_iserror+0xae>
mov    %rbx,%rdi
call   1040 <_submask_testadd@plt>
test   %rax,%rax
je     124a <submask_iserror+0xba>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <_submask_unmask@plt>
cmp    $0x1,%eax
jne    1262 <submask_iserror+0xd2>
lea    0xe58(%rip),%rdi
jmp    11b8 <submask_iserror+0x28>
test   %rax,%rax
je     123e <submask_iserror+0xae>
mov    %rbx,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1090 <_submask_testmaskc@plt>
test   %rax,%rax
je     1256 <submask_iserror+0xc6>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <_submask_unmask@plt>
cmp    $0x1,%eax
jne    1279 <submask_iserror+0xe9>
lea    0xde2(%rip),%rdi
jmp    11b8 <submask_iserror+0x28>
lea    0xe5a(%rip),%rdi
jmp    11b8 <submask_iserror+0x28>
lea    0xe2c(%rip),%rdi
jmp    11b8 <submask_iserror+0x28>
lea    0xde0(%rip),%rdi
jmp    11b8 <submask_iserror+0x28>
mov    %rbx,%rdi
call   1070 <_submask_isone@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    11c2 <submask_iserror+0x32>
jmp    1288 <submask_iserror+0xf8>
mov    %rbx,%rdi
call   1080 <atoi@plt>
test   $0xffffffdf,%eax
jne    129e <submask_iserror+0x10e>
lea    0xd71(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11bd <submask_iserror+0x2d>
xor    %eax,%eax
jmp    11c2 <submask_iserror+0x32>

LLVM IR (-O0):
@.str = [39 x i8] c"\C2\B2\C3\8E\C3\8A\C3\BD\C3\96\C3\90\C2\B4\C3\A6\C3\94\C3\9A\C2\B7\C3\87\C2\B7\C2\A8\C3\97\C3\96\C2\B7\C3\BB!\0A\00"
@.str.1 = [29 x i8] c"ip\C2\B5\C3\98\C3\96\C2\B7\C2\B8\C3\B1\C3\8A\C2\BD\C2\B4\C3\AD\C3\8E\C3\B3!\0A\00"
@.str.2 = [35 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B8\C3\B1\C3\8A\C2\BD\C2\B4\C3\AD\C3\8E\C3\B3!\0A\00"
@.str.3 = [31 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B2\C2\BB\C3\81\C2\AC\C3\90\C3\B8!\0A\00"
@.str.4 = [27 x i8] c"\C3\8E\C2\A8\C3\92\C2\BB\C2\B5\C3\84ip\C2\B5\C3\98\C3\96\C2\B7:%s\0A\00"
@.str.5 = [35 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B4\C3\B3\C3\90\C2\A1\C2\B4\C3\AD\C3\8E\C3\B3!\0A\00"
@.str.6 = [35 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C3\8E\C2\BB\C3\8A\C3\BD\C2\B9\C3\BD\C3\89\C3\99!\0A\00"
define i32 @submask_iserror(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = call i32 @_submask_isnum(i8* %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = call i32 @_submask_isnum(i8* %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %9, %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %85
15: ; preds = %9
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %49
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = call i64 @_submask_testadd(i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %85
25: ; preds = %19
%26 = load i8*, i8** %5
%27 = call i64 @_submask_testadd(i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %85
31: ; preds = %25
%32 = load i8*, i8** %4
%33 = load i8*, i8** %5
%34 = call i32 @_submask_unmask(i8* %32, i8* %33)
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %85
38: ; preds = %31
%39 = load i8*, i8** %5
%40 = call i32 @_submask_isone(i8* %39)
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i8*, i8** %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %43)
store i32 1, i32* %3
br label %85
45: ; preds = %38
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
br label %84
49: ; preds = %15
%50 = load i8*, i8** %4
%51 = call i64 @_submask_testadd(i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %85
55: ; preds = %49
%56 = load i8*, i8** %5
%57 = call i32 @atoi(i8* %56)
%58 = call i64 @_submask_testmaskc(i32 %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %85
62: ; preds = %55
%63 = load i8*, i8** %4
%64 = load i8*, i8** %5
%65 = call i32 @_submask_unmask(i8* %63, i8* %64)
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %85
69: ; preds = %62
%70 = load i8*, i8** %5
%71 = call i32 @atoi(i8* %70)
%72 = icmp eq i32 %71, 32
br i1 %72, label %77, label %73
73: ; preds = %69
%74 = load i8*, i8** %5
%75 = call i32 @atoi(i8* %74)
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %73, %69
%78 = load i8*, i8** %4
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %78)
store i32 1, i32* %3
br label %85
80: ; preds = %73
br label %81
81: ; preds = %80
br label %82
82: ; preds = %81
br label %83
83: ; preds = %82
br label %84
84: ; preds = %83, %48
store i32 0, i32* %3
br label %85
85: ; preds = %84, %77, %67, %60, %53, %42, %36, %29, %23, %13
%86 = load i32, i32* %3
ret i32 %86
}

LLVM IR (-O2):
@.str.4 = [27 x i8] c"\C3\8E\C2\A8\C3\92\C2\BB\C2\B5\C3\84ip\C2\B5\C3\98\C3\96\C2\B7:%s\0A\00"
@str = [34 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C3\8E\C2\BB\C3\8A\C3\BD\C2\B9\C3\BD\C3\89\C3\99!\00"
@str.7 = [34 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B4\C3\B3\C3\90\C2\A1\C2\B4\C3\AD\C3\8E\C3\B3!\00"
@str.9 = [30 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B2\C2\BB\C3\81\C2\AC\C3\90\C3\B8!\00"
@str.10 = [34 x i8] c"\C3\97\C3\93\C3\8D\C3\B8\C3\91\C3\9A\C3\82\C3\AB\C2\B8\C3\B1\C3\8A\C2\BD\C2\B4\C3\AD\C3\8E\C3\B3!\00"
@str.11 = [28 x i8] c"ip\C2\B5\C3\98\C3\96\C2\B7\C2\B8\C3\B1\C3\8A\C2\BD\C2\B4\C3\AD\C3\8E\C3\B3!\00"
@str.12 = [38 x i8] c"\C2\B2\C3\8E\C3\8A\C3\BD\C3\96\C3\90\C2\B4\C3\A6\C3\94\C3\9A\C2\B7\C3\87\C2\B7\C2\A8\C3\97\C3\96\C2\B7\C3\BB!\00"
define i32 @submask_iserror(i8* %0, i8* %1) {
%3 = tail call i32 @_submask_isnum(i8* %0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @_submask_isnum(i8* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5, %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
br label %51
10: ; preds = %5
%11 = tail call i32 @strlen(i8* %1)
%12 = icmp sgt i32 %11, 2
%13 = tail call i64 @_submask_testadd(i8* %0)
%14 = icmp eq i64 %13, 0
br i1 %12, label %15, label %33
15: ; preds = %10
br i1 %14, label %16, label %18
16: ; preds = %15
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
br label %51
18: ; preds = %15
%19 = tail call i64 @_submask_testadd(i8* %1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.10, i64 0, i64 0))
br label %51
23: ; preds = %18
%24 = tail call i32 @_submask_unmask(i8* %0, i8* %1)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
br label %51
28: ; preds = %23
%29 = tail call i32 @_submask_isone(i8* %1)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %51
31: ; preds = %28
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %51
33: ; preds = %10
br i1 %14, label %34, label %36
34: ; preds = %33
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
br label %51
36: ; preds = %33
%37 = tail call i32 @atoi(i8* %1)
%38 = tail call i64 @_submask_testmaskc(i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
br label %51
42: ; preds = %36
%43 = tail call i32 @_submask_unmask(i8* %0, i8* %1)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %51
47: ; preds = %42
%48 = tail call i32 @atoi(i8* %1)
switch i32 %48, label %51 [
i32 32, label %49
i32 0, label %49
]
49: ; preds = %47, %47
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %51
51: ; preds = %28, %47, %49, %45, %40, %34, %31, %26, %21, %16, %8
%52 = phi i32 [ 1, %8 ], [ 1, %16 ], [ 1, %21 ], [ 1, %26 ], [ 1, %31 ], [ 1, %34 ], [ 1, %40 ], [ 1, %45 ], [ 1, %49 ], [ 0, %47 ], [ 0, %28 ]
ret i32 %52
}