#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 */
char *alloca(int);
int /*<<< orphan*/ define_config(char *, int);
scalar_t__ is_defined_config(char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
char tolower(int);
void use_config(char *m, int slen) {
  char *s = alloca(slen + 1);
  char *p;
  if (is_defined_config(m, slen))
    return;
  define_config(m, slen);
  memcpy(s, m, slen);
  s[slen] = 0;
  for (p = s; p < s + slen; p++) {
    if (*p == '_')
      *p = '/';
    else
      *p = tolower((int)*p);
  }
  printf("    $(wildcard include/config/%s.h) \\\n", s);
}


x86 assembly (clang, -O0):
<use_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <is_defined_config@plt>
cmp    $0x0,%rax
je     1199 <use_config+0x39>
jmp    1237 <use_config+0xd7>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <define_config@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0xc(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1227 <use_config+0xc7>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    11fd <use_config+0x9d>
mov    -0x20(%rbp),%rax
movb   $0x2f,(%rax)
jmp    1211 <use_config+0xb1>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1060 <tolower@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    1216 <use_config+0xb6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11c9 <use_config+0x69>
mov    -0x18(%rbp),%rsi
lea    0xdce(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_config>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r15
lea    0x1(%rbx),%edi
call   1040 <alloca@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %ebx,%esi
call   1080 <is_defined_config@plt>
test   %rax,%rax
je     118a <use_config+0x2a>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
mov    %ebx,%esi
call   1070 <define_config@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,(%r14,%rax,1)
test   %ebx,%ebx
jle    11dc <use_config+0x7c>
mov    %r14,%r15
add    %rax,%r15
mov    %r14,%rbx
jmp    11cb <use_config+0x6b>
nopl   0x0(%rax,%rax,1)
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    %r15,%rbx
jae    11dc <use_config+0x7c>
movsbl (%rbx),%edi
mov    $0x2f,%al
cmp    $0x5f,%edi
je     11c0 <use_config+0x60>
call   1060 <tolower@plt>
jmp    11c0 <use_config+0x60>
lea    0xe1d(%rip),%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

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

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