#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 PATH_MAX;
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(unsigned char);
void use_config(char *m, int slen) {
  char s[PATH_MAX];
  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((unsigned char)*p);
  }
  printf("    $(wildcard include/config/%s.h) \\\n", s);
}


x86 assembly (clang, -O0):
<use_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <is_defined_config@plt>
cmp    $0x0,%rax
je     11ad <use_config+0x5d>
movl   $0x1,-0x2c(%rbp)
jmp    124e <use_config+0xfe>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <define_config@plt>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x38(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1237 <use_config+0xe7>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    120d <use_config+0xbd>
mov    -0x28(%rbp),%rax
movb   $0x2f,(%rax)
jmp    1221 <use_config+0xd1>
mov    -0x28(%rbp),%rax
movzbl (%rax),%edi
call   1050 <tolower@plt>
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
jmp    1226 <use_config+0xd6>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11d9 <use_config+0x89>
mov    -0x38(%rbp),%rsi
lea    0xdbe(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_config>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
call   1070 <is_defined_config@plt>
test   %rax,%rax
jne    11ee <use_config+0x9e>
mov    %r15,%rdi
mov    %r14d,%esi
call   1060 <define_config@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <memcpy@plt>
movslq %r14d,%r15
movb   $0x0,(%r12,%r15,1)
test   %r14d,%r14d
jle    11df <use_config+0x8f>
add    %r12,%r15
mov    %r12,%rbx
jmp    11cb <use_config+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    %r15,%rbx
jae    11df <use_config+0x8f>
movzbl (%rbx),%ecx
mov    $0x2f,%al
cmp    $0x5f,%cl
je     11c0 <use_config+0x70>
movzbl %cl,%edi
call   1050 <tolower@plt>
jmp    11c0 <use_config+0x70>
lea    0xe1a(%rip),%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.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 i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i32, i32* @PATH_MAX
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i64 @is_defined_config(i8* %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %8
br label %52
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = call i32 @define_config(i8* %19, i32 %20)
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = call i32 @memcpy(i8* %12, i8* %22, i32 %23)
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %12, i64 %26
store i8 0, i8* %27
store i8* %12, i8** %7
br label %28
28: ; preds = %47, %18
%29 = load i8*, i8** %7
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %12, i64 %31
%33 = icmp ult i8* %29, %32
br i1 %33, label %34, label %50
34: ; preds = %28
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 95
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i8*, i8** %7
store i8 47, i8* %40
br label %46
41: ; preds = %34
%42 = load i8*, i8** %7
%43 = load i8, i8* %42
%44 = call signext i8 @tolower(i8 zeroext %43)
%45 = load i8*, i8** %7
store i8 %44, i8* %45
br label %46
46: ; preds = %41, %39
br label %47
47: ; preds = %46
%48 = load i8*, i8** %7
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %7
br label %28
50: ; preds = %28
%51 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %8
br label %52
52: ; preds = %50, %17
%53 = load i8*, i8** %5
%54 = load i32, i32* %8
switch i32 %54, label %56 [
i32 0, label %55
i32 1, label %55
]
55: ; preds = %52, %52
ret void
56: ; preds = %52
unreachable
}

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