#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 /*<<< orphan*/ CFCUtil_die(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void S_check_flags(int supplied, int acceptable, const char *type_name) {
  int bad = (supplied & ~acceptable);
  if (bad) {
    char bad_flag[20];
    if ((bad & 0x00000001)) {
      strcpy(bad_flag, "CONST");
    } else if ((bad & 0x00000002)) {
      strcpy(bad_flag, "NULLABLE");
    } else if ((bad & 0x00000008)) {
      strcpy(bad_flag, "INCREMENTED");
    } else if ((bad & 0x00000010)) {
      strcpy(bad_flag, "DECREMENTED");
    } else if ((bad & 0x00000020)) {
      strcpy(bad_flag, "OBJECT");
    } else if ((bad & 0x00000040)) {
      strcpy(bad_flag, "PRIMITIVE");
    } else if ((bad & 0x00000080)) {
      strcpy(bad_flag, "INTEGER");
    } else if ((bad & 0x00000100)) {
      strcpy(bad_flag, "FLOATING");
    } else if ((bad & 0x00000200)) {
      strcpy(bad_flag, "STRING_TYPE");
    } else if ((bad & 0x00000400)) {
      strcpy(bad_flag, "VA_LIST");
    } else if ((bad & 0x00000800)) {
      strcpy(bad_flag, "ARBITRARY");
    } else if ((bad & 0x00001000)) {
      strcpy(bad_flag, "COMPOSITE");
    } else {
      CFCUtil_die("Unknown flags: %d", bad);
    }
    CFCUtil_die("Bad flag for type %s: %s", type_name, bad_flag);
  }
}


x86 assembly (clang, -O0):
<S_check_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1364 <S_check_flags+0x244>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116e <S_check_flags+0x4e>
lea    -0x30(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    134e <S_check_flags+0x22e>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1192 <S_check_flags+0x72>
lea    -0x30(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1349 <S_check_flags+0x229>
mov    -0x14(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11b6 <S_check_flags+0x96>
lea    -0x30(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1344 <S_check_flags+0x224>
mov    -0x14(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11da <S_check_flags+0xba>
lea    -0x30(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    133f <S_check_flags+0x21f>
mov    -0x14(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11fe <S_check_flags+0xde>
lea    -0x30(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1030 <strcpy@plt>
jmp    133a <S_check_flags+0x21a>
mov    -0x14(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1222 <S_check_flags+0x102>
lea    -0x30(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1335 <S_check_flags+0x215>
mov    -0x14(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1248 <S_check_flags+0x128>
lea    -0x30(%rbp),%rdi
lea    0xdfa(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1330 <S_check_flags+0x210>
mov    -0x14(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     126e <S_check_flags+0x14e>
lea    -0x30(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1030 <strcpy@plt>
jmp    132b <S_check_flags+0x20b>
mov    -0x14(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     1294 <S_check_flags+0x174>
lea    -0x30(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1326 <S_check_flags+0x206>
mov    -0x14(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     12ba <S_check_flags+0x19a>
lea    -0x30(%rbp),%rdi
lea    0xda5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1321 <S_check_flags+0x201>
mov    -0x14(%rbp),%eax
and    $0x800,%eax
cmp    $0x0,%eax
je     12e0 <S_check_flags+0x1c0>
lea    -0x30(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1030 <strcpy@plt>
jmp    131c <S_check_flags+0x1fc>
mov    -0x14(%rbp),%eax
and    $0x1000,%eax
cmp    $0x0,%eax
je     1306 <S_check_flags+0x1e6>
lea    -0x30(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1317 <S_check_flags+0x1f7>
mov    -0x14(%rbp),%esi
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1040 <CFCUtil_die@plt>
jmp    131c <S_check_flags+0x1fc>
jmp    1321 <S_check_flags+0x201>
jmp    1326 <S_check_flags+0x206>
jmp    132b <S_check_flags+0x20b>
jmp    1330 <S_check_flags+0x210>
jmp    1335 <S_check_flags+0x215>
jmp    133a <S_check_flags+0x21a>
jmp    133f <S_check_flags+0x21f>
jmp    1344 <S_check_flags+0x224>
jmp    1349 <S_check_flags+0x229>
jmp    134e <S_check_flags+0x22e>
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1040 <CFCUtil_die@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_check_flags>:
not    %esi
and    %edi,%esi
je     121f <S_check_flags+0xff>
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
test   $0x1,%sil
jne    1194 <S_check_flags+0x74>
test   $0x2,%sil
jne    119d <S_check_flags+0x7d>
test   $0x8,%sil
jne    11a6 <S_check_flags+0x86>
test   $0x10,%sil
jne    11af <S_check_flags+0x8f>
test   $0x20,%sil
jne    11b8 <S_check_flags+0x98>
test   $0x40,%sil
jne    11c1 <S_check_flags+0xa1>
test   $0x80,%sil
jne    11ca <S_check_flags+0xaa>
test   $0x100,%esi
jne    11d3 <S_check_flags+0xb3>
test   $0x200,%esi
jne    11dc <S_check_flags+0xbc>
test   $0x400,%esi
jne    11e5 <S_check_flags+0xc5>
test   $0x800,%esi
jne    11ee <S_check_flags+0xce>
test   $0x1000,%esi
jne    11f7 <S_check_flags+0xd7>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1040 <CFCUtil_die@plt>
jmp    1206 <S_check_flags+0xe6>
lea    0xe65(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe62(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe62(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe65(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe68(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe66(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe67(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe66(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe66(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe69(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe68(%rip),%rsi
jmp    11fe <S_check_flags+0xde>
lea    0xe69(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xe76(%rip),%rdi
mov    %rsp,%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <CFCUtil_die@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"CONST\00"
@.str.1 = [9 x i8] c"NULLABLE\00"
@.str.2 = [12 x i8] c"INCREMENTED\00"
@.str.3 = [12 x i8] c"DECREMENTED\00"
@.str.4 = [7 x i8] c"OBJECT\00"
@.str.5 = [10 x i8] c"PRIMITIVE\00"
@.str.6 = [8 x i8] c"INTEGER\00"
@.str.7 = [9 x i8] c"FLOATING\00"
@.str.8 = [12 x i8] c"STRING_TYPE\00"
@.str.9 = [8 x i8] c"VA_LIST\00"
@.str.10 = [10 x i8] c"ARBITRARY\00"
@.str.11 = [10 x i8] c"COMPOSITE\00"
@.str.12 = [18 x i8] c"Unknown flags: %d\00"
@.str.13 = [25 x i8] c"Bad flag for type %s: %s\00"
define void @S_check_flags(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [20 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = xor i32 %10, -1
%12 = and i32 %9, %11
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %117
15: ; preds = %3
%16 = load i32, i32* %7
%17 = and i32 %16, 1
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %113
22: ; preds = %15
%23 = load i32, i32* %7
%24 = and i32 %23, 2
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %112
29: ; preds = %22
%30 = load i32, i32* %7
%31 = and i32 %30, 8
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %111
36: ; preds = %29
%37 = load i32, i32* %7
%38 = and i32 %37, 16
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%42 = call i32 @strcpy(i8* %41, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %110
43: ; preds = %36
%44 = load i32, i32* %7
%45 = and i32 %44, 32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%49 = call i32 @strcpy(i8* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %109
50: ; preds = %43
%51 = load i32, i32* %7
%52 = and i32 %51, 64
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %108
57: ; preds = %50
%58 = load i32, i32* %7
%59 = and i32 %58, 128
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%63 = call i32 @strcpy(i8* %62, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %107
64: ; preds = %57
%65 = load i32, i32* %7
%66 = and i32 %65, 256
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%70 = call i32 @strcpy(i8* %69, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %106
71: ; preds = %64
%72 = load i32, i32* %7
%73 = and i32 %72, 512
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%77 = call i32 @strcpy(i8* %76, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %105
78: ; preds = %71
%79 = load i32, i32* %7
%80 = and i32 %79, 1024
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%84 = call i32 @strcpy(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %104
85: ; preds = %78
%86 = load i32, i32* %7
%87 = and i32 %86, 2048
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %85
%90 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%91 = call i32 @strcpy(i8* %90, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %103
92: ; preds = %85
%93 = load i32, i32* %7
%94 = and i32 %93, 4096
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %92
%97 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%98 = call i32 @strcpy(i8* %97, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
br label %102
99: ; preds = %92
%100 = load i32, i32* %7
%101 = call i32 (i8*, ...) @CFCUtil_die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %100)
br label %102
102: ; preds = %99, %96
br label %103
103: ; preds = %102, %89
br label %104
104: ; preds = %103, %82
br label %105
105: ; preds = %104, %75
br label %106
106: ; preds = %105, %68
br label %107
107: ; preds = %106, %61
br label %108
108: ; preds = %107, %54
br label %109
109: ; preds = %108, %47
br label %110
110: ; preds = %109, %40
br label %111
111: ; preds = %110, %33
br label %112
112: ; preds = %111, %26
br label %113
113: ; preds = %112, %19
%114 = load i8*, i8** %6
%115 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%116 = call i32 (i8*, ...) @CFCUtil_die(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0), i8* %114, i8* %115)
br label %117
117: ; preds = %113, %3
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"CONST\00"
@.str.1 = [9 x i8] c"NULLABLE\00"
@.str.2 = [12 x i8] c"INCREMENTED\00"
@.str.3 = [12 x i8] c"DECREMENTED\00"
@.str.4 = [7 x i8] c"OBJECT\00"
@.str.5 = [10 x i8] c"PRIMITIVE\00"
@.str.6 = [8 x i8] c"INTEGER\00"
@.str.7 = [9 x i8] c"FLOATING\00"
@.str.8 = [12 x i8] c"STRING_TYPE\00"
@.str.9 = [8 x i8] c"VA_LIST\00"
@.str.10 = [10 x i8] c"ARBITRARY\00"
@.str.11 = [10 x i8] c"COMPOSITE\00"
@.str.12 = [18 x i8] c"Unknown flags: %d\00"
@.str.13 = [25 x i8] c"Bad flag for type %s: %s\00"
define void @S_check_flags(i32 %0, i32 %1, i8* %2) {
%4 = alloca [20 x i8]
%5 = xor i32 %1, -1
%6 = and i32 %5, %0
%7 = icmp eq i32 %6, 0
br i1 %7, label %73, label %8
8: ; preds = %3
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%10 = and i32 %6, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %71
14: ; preds = %8
%15 = and i32 %6, 2
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %71
19: ; preds = %14
%20 = and i32 %6, 8
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %71
24: ; preds = %19
%25 = and i32 %6, 16
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %71
29: ; preds = %24
%30 = and i32 %6, 32
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %71
34: ; preds = %29
%35 = and i32 %6, 64
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %71
39: ; preds = %34
%40 = and i32 %6, 128
%41 = icmp eq i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %71
44: ; preds = %39
%45 = and i32 %6, 256
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %71
49: ; preds = %44
%50 = and i32 %6, 512
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %71
54: ; preds = %49
%55 = and i32 %6, 1024
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %54
%58 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %71
59: ; preds = %54
%60 = and i32 %6, 2048
%61 = icmp eq i32 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %71
64: ; preds = %59
%65 = and i32 %6, 4096
%66 = icmp eq i32 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %64
%68 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
br label %71
69: ; preds = %64
%70 = tail call i32 (i8*, ...) @CFCUtil_die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %6)
br label %71
71: ; preds = %17, %27, %37, %47, %57, %67, %69, %62, %52, %42, %32, %22, %12
%72 = call i32 (i8*, ...) @CFCUtil_die(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0), i8* %2, i8* %9)
br label %73
73: ; preds = %71, %3
ret void
}