#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*/ find_wildcard_libraries(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void process_wildcard(char *wildcard) {
  char *ptr;
  char beginning[64] = {0};
  char end[64] = {0};
  ptr = strchr(wildcard, '%');
  if (ptr) {
    strncpy(beginning, wildcard, ptr - wildcard);
    ptr += 2;
    strcpy(end, ptr);
  }
  find_wildcard_libraries(beginning, end);
}


x86 assembly (clang, -O0):
<process_wildcard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1070 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1070 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    $0x25,%esi
call   1060 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11d5 <process_wildcard+0x85>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1050 <find_wildcard_libraries@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_wildcard>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    $0x25,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11aa <process_wildcard+0x6a>
mov    %rax,%rbx
mov    %ebx,%edx
sub    %r14d,%edx
lea    0x40(%rsp),%rdi
mov    %r14,%rsi
call   1030 <strncpy@plt>
add    $0x2,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0x40(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <find_wildcard_libraries@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @process_wildcard(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
store i8* %0, i8** %2
%6 = bitcast [64 x i8]* %4 to i8*
%7 = bitcast [64 x i8]* %5 to i8*
%8 = load i8*, i8** %2
%9 = call i8* @strchr(i8* %8, i8 signext 37)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %27
12: ; preds = %1
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%14 = load i8*, i8** %2
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
%21 = call i32 @strncpy(i8* %13, i8* %14, i32 %20)
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8* %23, i8** %3
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%25 = load i8*, i8** %3
%26 = call i32 @strcpy(i8* %24, i8* %25)
br label %27
27: ; preds = %12, %1
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%30 = call i32 @find_wildcard_libraries(i8* %28, i8* %29)
ret void
}

LLVM IR (-O2):
define void @process_wildcard(i8* %0) {
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 37)
%7 = icmp eq i8* %6, null
br i1 %7, label %16, label %8
8: ; preds = %1
%9 = ptrtoint i8* %6 to i64
%10 = ptrtoint i8* %0 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = call i32 @strncpy(i8* %4, i8* %0, i32 %12)
%14 = getelementptr inbounds i8, i8* %6, i64 2
%15 = call i32 @strcpy(i8* %5, i8* %14)
br label %16
16: ; preds = %8, %1
%17 = call i32 @find_wildcard_libraries(i8* %4, i8* %5)
ret void
}