#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ err;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ str_to_fast_log_bitfield(char *, int /*<<< orphan*/ *,
                                            char *, int);
int test_tokenizer(void) {
  char err[512] = {0};
  size_t err_len = sizeof(err);
  uint8_t bits[(64 + 7) / 8];
  memset(err, 0, err_len);
  str_to_fast_log_bitfield("MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG", bits, err,
                           sizeof(err));
  do {
    int __my_ret__ = err[0];
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 281, "err[0]");
      return __my_ret__;
    }
  } while (0);
  ;
  memset(err, 0, err_len);
  str_to_fast_log_bitfield("MSGR_DEBUG;BOGUS;MSGR_DEBUG", bits, err,
                           sizeof(err));
  do {
    int __my_ret__ = err[0];
    if (__my_ret__ == 0) {
      fprintf(stderr, "failed on line %d: %s\n", 286, "err[0]");
      return -1;
    }
  } while (0);
  ;
  memset(err, 0, err_len);
  str_to_fast_log_bitfield("MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG;", bits, err,
                           sizeof(err));
  do {
    int __my_ret__ = err[0];
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 291, "err[0]");
      return __my_ret__;
    }
  } while (0);
  ;
  memset(err, 0, err_len);
  str_to_fast_log_bitfield(";", bits, err, sizeof(err));
  do {
    int __my_ret__ = err[0];
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 296, "err[0]");
      return __my_ret__;
    }
  } while (0);
  ;
  memset(err, 0, err_len);
  str_to_fast_log_bitfield("", bits, err, sizeof(err));
  do {
    int __my_ret__ = err[0];
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 301, "err[0]");
      return __my_ret__;
    }
  } while (0);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<test_tokenizer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
movq   $0x200,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0x240(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xe7d(%rip),%rdi
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl -0x210(%rbp),%eax
mov    %eax,-0x244(%rbp)
cmpl   $0x0,-0x244(%rbp)
je     11d6 <test_tokenizer+0xa6>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
lea    0xe6a(%rip),%rsi
mov    $0x119,%edx
lea    0xe75(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x244(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13e8 <test_tokenizer+0x2b8>
jmp    11db <test_tokenizer+0xab>
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0x240(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xe3a(%rip),%rdi
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl -0x210(%rbp),%eax
mov    %eax,-0x248(%rbp)
cmpl   $0x0,-0x248(%rbp)
jne    1256 <test_tokenizer+0x126>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xde8(%rip),%rsi
mov    $0x11e,%edx
lea    0xdf3(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e8 <test_tokenizer+0x2b8>
jmp    125b <test_tokenizer+0x12b>
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0x240(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xdd6(%rip),%rdi
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl -0x210(%rbp),%eax
mov    %eax,-0x24c(%rbp)
cmpl   $0x0,-0x24c(%rbp)
je     12d8 <test_tokenizer+0x1a8>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
lea    0xd68(%rip),%rsi
mov    $0x123,%edx
lea    0xd73(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x24c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13e8 <test_tokenizer+0x2b8>
jmp    12dd <test_tokenizer+0x1ad>
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0x240(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xd74(%rip),%rdi
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl -0x210(%rbp),%eax
mov    %eax,-0x250(%rbp)
cmpl   $0x0,-0x250(%rbp)
je     135a <test_tokenizer+0x22a>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
lea    0xce6(%rip),%rsi
mov    $0x128,%edx
lea    0xcf1(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x250(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13e8 <test_tokenizer+0x2b8>
jmp    135f <test_tokenizer+0x22f>
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0x240(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xcae(%rip),%rdi
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl -0x210(%rbp),%eax
mov    %eax,-0x254(%rbp)
cmpl   $0x0,-0x254(%rbp)
je     13dc <test_tokenizer+0x2ac>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
lea    0xc64(%rip),%rsi
mov    $0x12d,%edx
lea    0xc6f(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x254(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13e8 <test_tokenizer+0x2b8>
jmp    13e1 <test_tokenizer+0x2b1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tokenizer>:
push   %rbp
push   %r14
push   %rbx
sub    $0x220,%rsp
lea    0x20(%rsp),%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe9b(%rip),%rdi
mov    %rsp,%rsi
mov    %rbx,%rdx
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl 0x20(%rsp),%ebp
test   %ebp,%ebp
je     11af <test_tokenizer+0x7f>
mov    $0x119,%edx
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
lea    0xe9e(%rip),%rcx
call   1040 <fprintf@plt>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x220,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0x20(%rsp),%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe75(%rip),%rdi
mov    %rsp,%rsi
mov    %rbx,%rdx
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
cmpb   $0x0,0x20(%rsp)
je     121f <test_tokenizer+0xef>
lea    0x20(%rsp),%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe5f(%rip),%rdi
mov    %rsp,%rsi
mov    %rbx,%rdx
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl 0x20(%rsp),%ebp
test   %ebp,%ebp
je     122e <test_tokenizer+0xfe>
mov    $0x123,%edx
jmp    1183 <test_tokenizer+0x53>
mov    $0xffffffff,%ebp
mov    $0x11e,%edx
jmp    1183 <test_tokenizer+0x53>
lea    0x20(%rsp),%r14
xor    %ebx,%ebx
mov    $0x200,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe30(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl 0x20(%rsp),%ebp
test   %ebp,%ebp
je     126e <test_tokenizer+0x13e>
mov    $0x128,%edx
jmp    1183 <test_tokenizer+0x53>
lea    0x20(%rsp),%r14
mov    $0x200,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xdae(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
mov    $0x200,%ecx
call   1050 <str_to_fast_log_bitfield@plt>
movsbl 0x20(%rsp),%ebp
test   %ebp,%ebp
je     11a1 <test_tokenizer+0x71>
mov    $0x12d,%edx
jmp    1183 <test_tokenizer+0x53>

LLVM IR (-O0):
@.str = [33 x i8] c"MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.2 = [7 x i8] c"err[0]\00"
@.str.3 = [28 x i8] c"MSGR_DEBUG;BOGUS;MSGR_DEBUG\00"
@.str.4 = [34 x i8] c"MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG;\00"
@.str.5 = [2 x i8] c";\00"
@.str.6 = [1 x i8] zeroinitializer
define i32 @test_tokenizer() {
%1 = alloca i32
%2 = alloca [512 x i8]
%3 = alloca i64
%4 = alloca [8 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast [512 x i8]* %2 to i8*
store i64 512, i64* %3
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%12 = load i64, i64* %3
%13 = call i32 @memset(i8* %11, i32 0, i64 %12)
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%16 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32* %14, i8* %15, i32 512)
br label %17
17: ; preds = %0
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 281, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %5
store i32 %26, i32* %1
br label %100
27: ; preds = %17
br label %28
28: ; preds = %27
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%30 = load i64, i64* %3
%31 = call i32 @memset(i8* %29, i32 0, i64 %30)
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%34 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32* %32, i8* %33, i32 512)
br label %35
35: ; preds = %28
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 286, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %100
44: ; preds = %35
br label %45
45: ; preds = %44
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%47 = load i64, i64* %3
%48 = call i32 @memset(i8* %46, i32 0, i64 %47)
%49 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%50 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%51 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32* %49, i8* %50, i32 512)
br label %52
52: ; preds = %45
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
store i32 %55, i32* %7
%56 = load i32, i32* %7
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %52
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 291, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%61 = load i32, i32* %7
store i32 %61, i32* %1
br label %100
62: ; preds = %52
br label %63
63: ; preds = %62
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%65 = load i64, i64* %3
%66 = call i32 @memset(i8* %64, i32 0, i64 %65)
%67 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%69 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32* %67, i8* %68, i32 512)
br label %70
70: ; preds = %63
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
store i32 %73, i32* %8
%74 = load i32, i32* %8
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %70
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 296, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%79 = load i32, i32* %8
store i32 %79, i32* %1
br label %100
80: ; preds = %70
br label %81
81: ; preds = %80
%82 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%83 = load i64, i64* %3
%84 = call i32 @memset(i8* %82, i32 0, i64 %83)
%85 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%87 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32* %85, i8* %86, i32 512)
br label %88
88: ; preds = %81
%89 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
store i32 %91, i32* %9
%92 = load i32, i32* %9
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %88
%95 = load i32, i32* @stderr
%96 = call i32 @fprintf(i32 %95, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 301, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%97 = load i32, i32* %9
store i32 %97, i32* %1
br label %100
98: ; preds = %88
br label %99
99: ; preds = %98
store i32 0, i32* %1
br label %100
100: ; preds = %99, %94, %76, %58, %41, %23
%101 = load i32, i32* %1
ret i32 %101
}

LLVM IR (-O2):
@.str = [33 x i8] c"MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.2 = [7 x i8] c"err[0]\00"
@.str.3 = [28 x i8] c"MSGR_DEBUG;BOGUS;MSGR_DEBUG\00"
@.str.4 = [34 x i8] c"MSGR_DEBUG;MSGR_DEBUG;MSGR_DEBUG;\00"
@.str.5 = [2 x i8] c";\00"
@.str.6 = [1 x i8] zeroinitializer
define i32 @test_tokenizer() {
%1 = alloca [512 x i8]
%2 = alloca [8 x i32]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%4 = bitcast [8 x i32]* %2 to i8*
%5 = call i32 @memset(i8* %3, i32 0, i64 512)
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32* %6, i8* %3, i32 512)
%8 = load i8, i8* %3
%9 = icmp eq i8 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = sext i8 %8 to i32
br label %38
12: ; preds = %0
%13 = call i32 @memset(i8* %3, i32 0, i64 512)
%14 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32* %6, i8* %3, i32 512)
%15 = load i8, i8* %3
%16 = icmp eq i8 %15, 0
br i1 %16, label %38, label %17
17: ; preds = %12
%18 = call i32 @memset(i8* %3, i32 0, i64 512)
%19 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32* %6, i8* %3, i32 512)
%20 = load i8, i8* %3
%21 = icmp eq i8 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = sext i8 %20 to i32
br label %38
24: ; preds = %17
%25 = call i32 @memset(i8* %3, i32 0, i64 512)
%26 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32* %6, i8* %3, i32 512)
%27 = load i8, i8* %3
%28 = icmp eq i8 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = sext i8 %27 to i32
br label %38
31: ; preds = %24
%32 = call i32 @memset(i8* %3, i32 0, i64 512)
%33 = call i32 @str_to_fast_log_bitfield(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32* %6, i8* %3, i32 512)
%34 = load i8, i8* %3
%35 = icmp eq i8 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %31
%37 = sext i8 %34 to i32
br label %38
38: ; preds = %12, %10, %22, %29, %36
%39 = phi i32 [ 301, %36 ], [ 296, %29 ], [ 291, %22 ], [ 281, %10 ], [ 286, %12 ]
%40 = phi i32 [ %37, %36 ], [ %30, %29 ], [ %23, %22 ], [ %11, %10 ], [ -1, %12 ]
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %38, %31
%44 = phi i32 [ 0, %31 ], [ %40, %38 ]
ret i32 %44
}