#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*/ define_config(char const *, unsigned int, unsigned int);
scalar_t__ is_defined_config(char const *, unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(unsigned int);
unsigned int strhash(char const *, unsigned int);
unsigned int tolower(unsigned int);
void use_config(const char *m, unsigned int slen) {
  unsigned int hash = strhash(m, slen);
  unsigned int c, i;
  if (is_defined_config(m, slen, hash))
    return;
  define_config(m, slen, hash);
  printf("    $(wildcard include/config/");
  for (i = 0; i < slen; i++) {
    c = m[i];
    if (c == '_')
      c = '/';
    else
      c = tolower(c);
    putchar(c);
  }
  printf(".h) \\\n");
}


x86 assembly (clang, -O0):
<use_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <strhash@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1080 <is_defined_config@plt>
cmp    $0x0,%rax
je     119c <use_config+0x3c>
jmp    121b <use_config+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1070 <define_config@plt>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    120f <use_config+0xaf>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x5f,-0x14(%rbp)
jne    11ee <use_config+0x8e>
movl   $0x2f,-0x14(%rbp)
jmp    11f9 <use_config+0x99>
mov    -0x14(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11be <use_config+0x5e>
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_config>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r15
call   1070 <strhash@plt>
mov    %eax,%r14d
mov    %r15,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1090 <is_defined_config@plt>
test   %rax,%rax
je     11a0 <use_config+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1080 <define_config@plt>
lea    0xe4c(%rip),%rdi
call   1050 <printf@plt>
test   %ebp,%ebp
je     11f8 <use_config+0x88>
mov    %ebp,%ebp
xor    %ebx,%ebx
jmp    11de <use_config+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11f8 <use_config+0x88>
movsbl (%r15,%rbx,1),%eax
mov    $0x2f,%edi
cmp    $0x5f,%eax
je     11d0 <use_config+0x60>
mov    %eax,%edi
call   1060 <tolower@plt>
mov    %eax,%edi
jmp    11d0 <use_config+0x60>
lea    0xe20(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [31 x i8] c" $(wildcard include/config/\00"
@.str.1 = [7 x i8] c".h) \\\0A\00"
define void @use_config(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @strhash(i8* %8, i32 %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i64 @is_defined_config(i8* %11, i32 %12, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
br label %48
17: ; preds = %2
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i32 @define_config(i8* %18, i32 %19, i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %23
23: ; preds = %43, %17
%24 = load i32, i32* %7
%25 = load i32, i32* %4
%26 = icmp ult i32 %24, %25
br i1 %26, label %27, label %46
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = load i32, i32* %7
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 95
br i1 %35, label %36, label %37
36: ; preds = %27
store i32 47, i32* %6
br label %40
37: ; preds = %27
%38 = load i32, i32* %6
%39 = call i32 @tolower(i32 %38)
store i32 %39, i32* %6
br label %40
40: ; preds = %37, %36
%41 = load i32, i32* %6
%42 = call i32 @putchar(i32 %41)
br label %43
43: ; preds = %40
%44 = load i32, i32* %7
%45 = add i32 %44, 1
store i32 %45, i32* %7
br label %23
46: ; preds = %23
%47 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %48
48: ; preds = %46, %16
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c" $(wildcard include/config/\00"
@str = [6 x i8] c".h) \\\00"
define void @use_config(i8* %0, i32 %1) {
%3 = tail call i32 @strhash(i8* %0, i32 %1)
%4 = tail call i64 @is_defined_config(i8* %0, i32 %1, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %27
6: ; preds = %2
%7 = tail call i32 @define_config(i8* %0, i32 %1, i32 %3)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %1, 0
br i1 %9, label %25, label %10
10: ; preds = %6
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %10, %20
%13 = phi i64 [ 0, %10 ], [ %23, %20 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 95
br i1 %16, label %20, label %17
17: ; preds = %12
%18 = sext i8 %15 to i32
%19 = tail call i32 @tolower(i32 %18)
br label %20
20: ; preds = %12, %17
%21 = phi i32 [ %19, %17 ], [ 47, %12 ]
%22 = tail call i32 @putchar(i32 %21)
%23 = add nuw nsw i64 %13, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %25, label %12
25: ; preds = %20, %6
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %2, %25
ret void
}