#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 */
scalar_t__ isalnum(char);
scalar_t__ memcmp(char *, char *, int);
int ntohl(int);
int /*<<< orphan*/ use_config(char *, int);
void parse_config_file(signed char *map, size_t len) {
  int *end = (int *)(map + len);
  int *m = (int *)map + 1;
  signed char *p, *q;
  for (; m < end; m++) {
    if (*m == ntohl(0x434f4e46)) {
      p = (signed char *)m;
      goto conf;
    }
    if (*m == ntohl(0x4f4e4649)) {
      p = (signed char *)m - 1;
      goto conf;
    }
    if (*m == ntohl(0x4e464947)) {
      p = (signed char *)m - 2;
      goto conf;
    }
    if (*m == ntohl(0x4649475f)) {
      p = (signed char *)m - 3;
      goto conf;
    }
    continue;
  conf:
    if (p > map + len - 7)
      continue;
    if (memcmp(p, "CONFIG_", 7))
      continue;
    for (q = p + 7; q < map + len; q++) {
      if (!(isalnum(*q) || *q == '_'))
        goto found;
    }
    continue;
  found:
    use_config(p + 7, q - p - 7);
  }
}


x86 assembly (clang, -O0):
<parse_config_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1313 <parse_config_file+0x1d3>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    $0x434f4e46,%edi
call   1050 <ntohl@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jne    11a3 <parse_config_file+0x63>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    123b <parse_config_file+0xfb>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    $0x4f4e4649,%edi
call   1050 <ntohl@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jne    11d4 <parse_config_file+0x94>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    123b <parse_config_file+0xfb>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    $0x4e464947,%edi
call   1050 <ntohl@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jne    1205 <parse_config_file+0xc5>
mov    -0x20(%rbp),%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,-0x28(%rbp)
jmp    123b <parse_config_file+0xfb>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    $0x4649475f,%edi
call   1050 <ntohl@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jne    1236 <parse_config_file+0xf6>
mov    -0x20(%rbp),%rax
add    $0xfffffffffffffffd,%rax
mov    %rax,-0x28(%rbp)
jmp    123b <parse_config_file+0xfb>
jmp    1302 <parse_config_file+0x1c2>
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
add    $0xfffffffffffffff9,%rcx
cmp    %rcx,%rax
jbe    1259 <parse_config_file+0x119>
jmp    1302 <parse_config_file+0x1c2>
mov    -0x28(%rbp),%rdi
lea    0xd9c(%rip),%rsi
mov    $0x7,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     127d <parse_config_file+0x13d>
jmp    1302 <parse_config_file+0x1c2>
mov    -0x28(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    12df <parse_config_file+0x19f>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
jne    12c9 <parse_config_file+0x189>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     12c9 <parse_config_file+0x189>
jmp    12e4 <parse_config_file+0x1a4>
jmp    12ce <parse_config_file+0x18e>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1289 <parse_config_file+0x149>
jmp    1302 <parse_config_file+0x1c2>
mov    -0x28(%rbp),%rdi
add    $0x7,%rdi
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
sub    $0x7,%rax
mov    %eax,%esi
call   1060 <use_config@plt>
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    1168 <parse_config_file+0x28>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_config_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x5,%rsi
jl     1258 <parse_config_file+0x118>
mov    %rsi,%r14
mov    %rdi,%r13
add    %rdi,%r14
add    $0x4,%r13
mov    $0x434f4e46,%edi
call   1050 <ntohl@plt>
mov    %eax,%r12d
lea    -0x7(%r14),%r15
jmp    118d <parse_config_file+0x4d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x4,%r13
cmp    %r14,%r13
jae    1258 <parse_config_file+0x118>
mov    0x0(%r13),%ebx
cmp    %r12d,%ebx
jne    11a0 <parse_config_file+0x60>
mov    %r13,%rbx
cmp    %r15,%rbx
ja     1180 <parse_config_file+0x40>
jmp    11f0 <parse_config_file+0xb0>
mov    $0x4f4e4649,%edi
call   1050 <ntohl@plt>
cmp    %eax,%ebx
jne    11c0 <parse_config_file+0x80>
lea    -0x1(%r13),%rbx
cmp    %r15,%rbx
ja     1180 <parse_config_file+0x40>
jmp    11f0 <parse_config_file+0xb0>
nopl   0x0(%rax)
mov    $0x4e464947,%edi
call   1050 <ntohl@plt>
cmp    %eax,%ebx
jne    11d9 <parse_config_file+0x99>
lea    -0x2(%r13),%rbx
cmp    %r15,%rbx
ja     1180 <parse_config_file+0x40>
jmp    11f0 <parse_config_file+0xb0>
mov    $0x4649475f,%edi
call   1050 <ntohl@plt>
cmp    %eax,%ebx
jne    1180 <parse_config_file+0x40>
lea    -0x3(%r13),%rbx
cmp    %r15,%rbx
ja     1180 <parse_config_file+0x40>
mov    %rbx,%rdi
lea    0xe06(%rip),%rsi
mov    $0x7,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    1180 <parse_config_file+0x40>
add    $0x7,%rbx
cmp    %r14,%rbx
jae    1180 <parse_config_file+0x40>
xor    %ebp,%ebp
jmp    1235 <parse_config_file+0xf5>
xchg   %ax,%ax
lea    (%rbx,%rbp,1),%rax
add    $0x1,%rax
add    $0x1,%rbp
cmp    %r14,%rax
jae    1180 <parse_config_file+0x40>
movsbl (%rbx,%rbp,1),%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1220 <parse_config_file+0xe0>
cmpb   $0x5f,(%rbx,%rbp,1)
je     1220 <parse_config_file+0xe0>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <use_config@plt>
jmp    1180 <parse_config_file+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"CONFIG_\00"
define void @parse_config_file(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = getelementptr inbounds i8, i8* %9, i64 %10
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %5
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to i32*
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32* %15, i32** %6
br label %16
16: ; preds = %105, %2
%17 = load i32*, i32** %6
%18 = load i32*, i32** %5
%19 = icmp ult i32* %17, %18
br i1 %19, label %20, label %108
20: ; preds = %16
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = call i32 @ntohl(i32 1129270854)
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32*, i32** %6
%27 = bitcast i32* %26 to i8*
store i8* %27, i8** %7
br label %56
28: ; preds = %20
%29 = load i32*, i32** %6
%30 = load i32, i32* %29
%31 = call i32 @ntohl(i32 1330529865)
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32*, i32** %6
%35 = bitcast i32* %34 to i8*
%36 = getelementptr inbounds i8, i8* %35, i64 -1
store i8* %36, i8** %7
br label %56
37: ; preds = %28
%38 = load i32*, i32** %6
%39 = load i32, i32* %38
%40 = call i32 @ntohl(i32 1313229127)
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %46
42: ; preds = %37
%43 = load i32*, i32** %6
%44 = bitcast i32* %43 to i8*
%45 = getelementptr inbounds i8, i8* %44, i64 -2
store i8* %45, i8** %7
br label %56
46: ; preds = %37
%47 = load i32*, i32** %6
%48 = load i32, i32* %47
%49 = call i32 @ntohl(i32 1179207519)
%50 = icmp eq i32 %48, %49
br i1 %50, label %51, label %55
51: ; preds = %46
%52 = load i32*, i32** %6
%53 = bitcast i32* %52 to i8*
%54 = getelementptr inbounds i8, i8* %53, i64 -3
store i8* %54, i8** %7
br label %56
55: ; preds = %46
br label %105
56: ; preds = %51, %42, %33, %25
%57 = load i8*, i8** %7
%58 = load i8*, i8** %3
%59 = load i64, i64* %4
%60 = getelementptr inbounds i8, i8* %58, i64 %59
%61 = getelementptr inbounds i8, i8* %60, i64 -7
%62 = icmp ugt i8* %57, %61
br i1 %62, label %63, label %64
63: ; preds = %56
br label %105
64: ; preds = %56
%65 = load i8*, i8** %7
%66 = call i64 @memcmp(i8* %65, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %64
br label %105
69: ; preds = %64
%70 = load i8*, i8** %7
%71 = getelementptr inbounds i8, i8* %70, i64 7
store i8* %71, i8** %8
br label %72
72: ; preds = %90, %69
%73 = load i8*, i8** %8
%74 = load i8*, i8** %3
%75 = load i64, i64* %4
%76 = getelementptr inbounds i8, i8* %74, i64 %75
%77 = icmp ult i8* %73, %76
br i1 %77, label %78, label %93
78: ; preds = %72
%79 = load i8*, i8** %8
%80 = load i8, i8* %79
%81 = call i64 @isalnum(i8 signext %80)
%82 = icmp ne i64 %81, 0
br i1 %82, label %89, label %83
83: ; preds = %78
%84 = load i8*, i8** %8
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 95
br i1 %87, label %89, label %88
88: ; preds = %83
br label %94
89: ; preds = %83, %78
br label %90
90: ; preds = %89
%91 = load i8*, i8** %8
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %8
br label %72
93: ; preds = %72
br label %105
94: ; preds = %88
%95 = load i8*, i8** %7
%96 = getelementptr inbounds i8, i8* %95, i64 7
%97 = load i8*, i8** %8
%98 = load i8*, i8** %7
%99 = ptrtoint i8* %97 to i64
%100 = ptrtoint i8* %98 to i64
%101 = sub i64 %99, %100
%102 = sub nsw i64 %101, 7
%103 = trunc i64 %102 to i32
%104 = call i32 @use_config(i8* %96, i32 %103)
br label %105
105: ; preds = %94, %93, %68, %63, %55
%106 = load i32*, i32** %6
%107 = getelementptr inbounds i32, i32* %106, i32 1
store i32* %107, i32** %6
br label %16
108: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"CONFIG_\00"
define void @parse_config_file(i8* %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = bitcast i8* %3 to i32*
%5 = icmp sgt i64 %1, 4
br i1 %5, label %6, label %65
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
%9 = tail call i32 @ntohl(i32 1129270854)
%10 = getelementptr inbounds i8, i8* %3, i64 -7
br label %11
11: ; preds = %6, %62
%12 = phi i32* [ %8, %6 ], [ %63, %62 ]
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, %9
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = bitcast i32* %12 to i8*
br label %35
17: ; preds = %11
%18 = tail call i32 @ntohl(i32 1330529865)
%19 = icmp eq i32 %13, %18
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = bitcast i32* %12 to i8*
%22 = getelementptr inbounds i8, i8* %21, i64 -1
br label %35
23: ; preds = %17
%24 = tail call i32 @ntohl(i32 1313229127)
%25 = icmp eq i32 %13, %24
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = bitcast i32* %12 to i8*
%28 = getelementptr inbounds i8, i8* %27, i64 -2
br label %35
29: ; preds = %23
%30 = tail call i32 @ntohl(i32 1179207519)
%31 = icmp eq i32 %13, %30
br i1 %31, label %32, label %62
32: ; preds = %29
%33 = bitcast i32* %12 to i8*
%34 = getelementptr inbounds i8, i8* %33, i64 -3
br label %35
35: ; preds = %32, %26, %20, %15
%36 = phi i8* [ %16, %15 ], [ %22, %20 ], [ %28, %26 ], [ %34, %32 ]
%37 = icmp ugt i8* %36, %10
br i1 %37, label %62, label %38
38: ; preds = %35
%39 = tail call i64 @memcmp(i8* %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %62
41: ; preds = %38
%42 = getelementptr inbounds i8, i8* %36, i64 7
%43 = icmp ult i8* %42, %3
br i1 %43, label %44, label %62
44: ; preds = %41, %52
%45 = phi i8* [ %53, %52 ], [ %42, %41 ]
%46 = load i8, i8* %45
%47 = tail call i64 @isalnum(i8 signext %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = load i8, i8* %45
%51 = icmp eq i8 %50, 95
br i1 %51, label %52, label %55
52: ; preds = %44, %49
%53 = getelementptr inbounds i8, i8* %45, i64 1
%54 = icmp ult i8* %53, %3
br i1 %54, label %44, label %62
55: ; preds = %49
%56 = ptrtoint i8* %45 to i64
%57 = ptrtoint i8* %36 to i64
%58 = sub i64 %56, %57
%59 = trunc i64 %58 to i32
%60 = add i32 %59, -7
%61 = tail call i32 @use_config(i8* %42, i32 %60)
br label %62
62: ; preds = %52, %41, %38, %35, %29, %55
%63 = getelementptr inbounds i32, i32* %12, i64 1
%64 = icmp ult i32* %63, %4
br i1 %64, label %11, label %65
65: ; preds = %62, %2
ret void
}