#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_sub(char *, int);
int _submask_isone(char mask[16]) {
  if ((submask_sub(mask, 1) == 255 && submask_sub(mask, 2) == 255 &&
       submask_sub(mask, 3) == 255 && submask_sub(mask, 4) == 255) ||
      (submask_sub(mask, 1) == 0 && submask_sub(mask, 2) == 0 &&
       submask_sub(mask, 3) == 0 && submask_sub(mask, 4) == 0)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_submask_isone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1180 <_submask_isone+0x70>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1180 <_submask_isone+0x70>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1180 <_submask_isone+0x70>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
je     11dc <_submask_isone+0xcc>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <submask_sub@plt>
cmp    $0x0,%eax
jne    11e8 <_submask_isone+0xd8>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <submask_sub@plt>
cmp    $0x0,%eax
jne    11e8 <_submask_isone+0xd8>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <submask_sub@plt>
cmp    $0x0,%eax
jne    11e8 <_submask_isone+0xd8>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <submask_sub@plt>
cmp    $0x0,%eax
jne    11e8 <_submask_isone+0xd8>
movl   $0x1,-0x4(%rbp)
jmp    11ef <_submask_isone+0xdf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_submask_isone>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1169 <_submask_isone+0x59>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1169 <_submask_isone+0x59>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <submask_sub@plt>
cmp    $0xff,%eax
jne    1169 <_submask_isone+0x59>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <submask_sub@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0xff,%ecx
je     11af <_submask_isone+0x9f>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <submask_sub@plt>
test   %eax,%eax
jne    11ad <_submask_isone+0x9d>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <submask_sub@plt>
test   %eax,%eax
jne    11ad <_submask_isone+0x9d>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <submask_sub@plt>
test   %eax,%eax
jne    11ad <_submask_isone+0x9d>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <submask_sub@plt>
test   %eax,%eax
je     11b1 <_submask_isone+0xa1>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_submask_isone(i8* %0) {
%2 = tail call i32 @submask_sub(i8* %0, i32 1)
%3 = icmp eq i32 %2, 255
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i32 @submask_sub(i8* %0, i32 2)
%6 = icmp eq i32 %5, 255
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i32 @submask_sub(i8* %0, i32 3)
%9 = icmp eq i32 %8, 255
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 @submask_sub(i8* %0, i32 4)
%12 = icmp eq i32 %11, 255
br i1 %12, label %26, label %13
13: ; preds = %10, %7, %4, %1
%14 = tail call i32 @submask_sub(i8* %0, i32 1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = tail call i32 @submask_sub(i8* %0, i32 2)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = tail call i32 @submask_sub(i8* %0, i32 3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = tail call i32 @submask_sub(i8* %0, i32 4)
%24 = icmp eq i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %22, %19, %16, %13
br label %26
26: ; preds = %10, %22, %25
%27 = phi i32 [ 0, %25 ], [ 1, %22 ], [ 1, %10 ]
ret i32 %27
}