#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__ islower(char);
int /*<<< orphan*/ toupper(char);
void make_macro_name(char *to, char *from) {
  char *f;
  for (f = from; *f; f++)
    if (*f == '/' || *f == '\\')
      from = f + 1;
  *to++ = '_';
  for (; *from; ++from)
    if (isalnum(*from))
      if (islower(*from))
        *to++ = toupper(*from);
      else
        *to++ = *from;
    else
      *to++ = '_';
  *to = '\0';
}


x86 assembly (clang, -O0):
<make_macro_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1197 <make_macro_name+0x67>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1175 <make_macro_name+0x45>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1181 <make_macro_name+0x51>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1186 <make_macro_name+0x56>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <make_macro_name+0x18>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x5f,(%rax)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     124a <make_macro_name+0x11a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalnum@plt>
cmp    $0x0,%rax
je     1222 <make_macro_name+0xf2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1206 <make_macro_name+0xd6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    121d <make_macro_name+0xed>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1234 <make_macro_name+0x104>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x5f,(%rax)
jmp    1239 <make_macro_name+0x109>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <make_macro_name+0x79>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_macro_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x1(%rsi),%rax
jmp    1147 <make_macro_name+0x17>
mov    %rax,%rbx
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x2f,%cl
je     1140 <make_macro_name+0x10>
cmp    $0x5c,%cl
je     1140 <make_macro_name+0x10>
test   %cl,%cl
jne    1143 <make_macro_name+0x13>
movb   $0x5f,(%r14)
add    $0x1,%r14
mov    (%rbx),%al
jmp    1181 <make_macro_name+0x51>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x5f,%al
mov    %al,(%r14)
add    $0x1,%r14
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11af <make_macro_name+0x7f>
movsbl %al,%edi
call   1050 <isalnum@plt>
test   %rax,%rax
je     1170 <make_macro_name+0x40>
movsbl (%rbx),%edi
call   1030 <islower@plt>
mov    %rax,%rcx
movzbl (%rbx),%eax
test   %rcx,%rcx
je     1172 <make_macro_name+0x42>
movsbl %al,%edi
call   1040 <toupper@plt>
jmp    1172 <make_macro_name+0x42>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @make_macro_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
br label %7
7: ; preds = %25, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 92
br i1 %20, label %21, label %24
21: ; preds = %16, %11
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %4
br label %24
24: ; preds = %21, %16
br label %25
25: ; preds = %24
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %7
28: ; preds = %7
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
store i8 95, i8* %29
br label %31
31: ; preds = %62, %28
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %65
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = call i64 @isalnum(i8 signext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %58
40: ; preds = %35
%41 = load i8*, i8** %4
%42 = load i8, i8* %41
%43 = call i64 @islower(i8 signext %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %40
%46 = load i8*, i8** %4
%47 = load i8, i8* %46
%48 = call i32 @toupper(i8 signext %47)
%49 = trunc i32 %48 to i8
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %3
store i8 %49, i8* %50
br label %57
52: ; preds = %40
%53 = load i8*, i8** %4
%54 = load i8, i8* %53
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %3
store i8 %54, i8* %55
br label %57
57: ; preds = %52, %45
br label %61
58: ; preds = %35
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %3
store i8 95, i8* %59
br label %61
61: ; preds = %58, %57
br label %62
62: ; preds = %61
%63 = load i8*, i8** %4
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %4
br label %31
65: ; preds = %31
%66 = load i8*, i8** %3
store i8 0, i8* %66
ret void
}

LLVM IR (-O2):
define void @make_macro_name(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %1, %2 ], [ %10, %9 ]
%5 = phi i8* [ %1, %2 ], [ %11, %9 ]
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 47, label %7
i8 92, label %7
]
7: ; preds = %3, %3
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %9
9: ; preds = %3, %7
%10 = phi i8* [ %8, %7 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
12: ; preds = %3
store i8 95, i8* %0
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %4
%15 = icmp eq i8 %14, 0
br i1 %15, label %36, label %16
16: ; preds = %12, %30
%17 = phi i8 [ %34, %30 ], [ %14, %12 ]
%18 = phi i8* [ %33, %30 ], [ %13, %12 ]
%19 = phi i8* [ %32, %30 ], [ %4, %12 ]
%20 = tail call i64 @isalnum(i8 signext %17)
%21 = icmp eq i64 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %16
%23 = load i8, i8* %19
%24 = tail call i64 @islower(i8 signext %23)
%25 = icmp eq i64 %24, 0
%26 = load i8, i8* %19
br i1 %25, label %30, label %27
27: ; preds = %22
%28 = tail call i32 @toupper(i8 signext %26)
%29 = trunc i32 %28 to i8
br label %30
30: ; preds = %16, %22, %27
%31 = phi i8 [ %29, %27 ], [ %26, %22 ], [ 95, %16 ]
store i8 %31, i8* %18
%32 = getelementptr inbounds i8, i8* %19, i64 1
%33 = getelementptr inbounds i8, i8* %18, i64 1
%34 = load i8, i8* %32
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %16
36: ; preds = %30, %12
%37 = phi i8* [ %13, %12 ], [ %33, %30 ]
store i8 0, i8* %37
ret void
}