#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;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ snappend(char *, size_t, char *, char *);
int /*<<< orphan*/ snprintf(char *, size_t, char *);
char *strdup(char const *);
char *strtok_r(char *, char *, char **);
scalar_t__ token_to_fast_log_bitfield(char *, int /*<<< orphan*/ *);
void str_to_fast_log_bitfield(const char *str, uint8_t bits[(64 + 7) / 8],
                              char *err, size_t err_len) {
  char *buf, *tok, *state = NULL;
  buf = strdup(str);
  if (!buf) {
    snprintf(err, err_len, "str_to_fast_log_bitfield: OOM");
    return;
  }
  for (tok = strtok_r(buf, ";", &state); tok;
       (tok = strtok_r(NULL, ";", &state))) {
    if (token_to_fast_log_bitfield(tok, bits)) {
      snappend(err, err_len,
               "No log type corresponds "
               "to \"%s\"\n",
               tok);
    }
  }
  free(buf);
}


x86 assembly (clang, -O0):
<str_to_fast_log_bitfield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b1 <str_to_fast_log_bitfield+0x51>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xe59(%rip),%rdx
call   1040 <snprintf@plt>
jmp    122e <str_to_fast_log_bitfield+0xce>
mov    -0x28(%rbp),%rdi
lea    0xe62(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1225 <str_to_fast_log_bitfield+0xc5>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <token_to_fast_log_bitfield@plt>
cmp    $0x0,%rax
je     1203 <str_to_fast_log_bitfield+0xa3>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rcx
lea    0xe22(%rip),%rdx
call   1070 <snappend@plt>
jmp    1208 <str_to_fast_log_bitfield+0xa8>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe0b(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x30(%rbp)
jmp    11c9 <str_to_fast_log_bitfield+0x69>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_fast_log_bitfield>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
call   1080 <strdup@plt>
test   %rax,%rax
je     1215 <str_to_fast_log_bitfield+0xb5>
lea    0xe89(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   1050 <strtok_r@plt>
test   %rax,%rax
je     11fc <str_to_fast_log_bitfield+0x9c>
mov    %rax,%r12
lea    0xe68(%rip),%r13
lea    0x8(%rsp),%rbp
jmp    11d5 <str_to_fast_log_bitfield+0x75>
nopl   (%rax)
xor    %edi,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1050 <strtok_r@plt>
mov    %rax,%r12
test   %rax,%rax
je     11fc <str_to_fast_log_bitfield+0x9c>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <token_to_fast_log_bitfield@plt>
test   %rax,%rax
je     11c0 <str_to_fast_log_bitfield+0x60>
mov    %r15,%rdi
mov    %r14,%rsi
lea    0xe2e(%rip),%rdx
mov    %r12,%rcx
call   1070 <snappend@plt>
jmp    11c0 <str_to_fast_log_bitfield+0x60>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde4(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"str_to_fast_log_bitfield: OOM\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [33 x i8] c"No log type corresponds to \22%s\22\0A\00"
define void @str_to_fast_log_bitfield(i8* %0, i32* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
store i8* null, i8** %11
%12 = load i8*, i8** %5
%13 = call i8* @strdup(i8* %12)
store i8* %13, i8** %9
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %20, label %16
16: ; preds = %4
%17 = load i8*, i8** %7
%18 = load i64, i64* %8
%19 = call i32 @snprintf(i8* %17, i64 %18, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %42
20: ; preds = %4
%21 = load i8*, i8** %9
%22 = call i8* @strtok_r(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %11)
store i8* %22, i8** %10
br label %23
23: ; preds = %37, %20
%24 = load i8*, i8** %10
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i8*, i8** %10
%28 = load i32*, i32** %6
%29 = call i64 @token_to_fast_log_bitfield(i8* %27, i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load i8*, i8** %7
%33 = load i64, i64* %8
%34 = load i8*, i8** %10
%35 = call i32 @snappend(i8* %32, i64 %33, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %31, %26
br label %37
37: ; preds = %36
%38 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %11)
store i8* %38, i8** %10
br label %23
39: ; preds = %23
%40 = load i8*, i8** %9
%41 = call i32 @free(i8* %40)
br label %42
42: ; preds = %39, %16
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"str_to_fast_log_bitfield: OOM\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [33 x i8] c"No log type corresponds to \22%s\22\0A\00"
define void @str_to_fast_log_bitfield(i8* nocapture %0, i32* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%7 = tail call i8* @strdup(i8* %0)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @snprintf(i8* %2, i64 %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %25
11: ; preds = %4
%12 = call i8* @strtok_r(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5)
%13 = icmp eq i8* %12, null
br i1 %13, label %23, label %14
14: ; preds = %11, %20
%15 = phi i8* [ %21, %20 ], [ %12, %11 ]
%16 = call i64 @token_to_fast_log_bitfield(i8* %15, i32* %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 @snappend(i8* %2, i64 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %20
20: ; preds = %14, %18
%21 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5)
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %14
23: ; preds = %20, %11
%24 = call i32 @free(i8* %7)
br label %25
25: ; preds = %23, %9
ret void
}