#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 *gen_name_base(char const *);
char *gen_name(const char *path) {
  char *name = gen_name_base(path);
  for (int i = 0; name[i] != '\0'; ++i) {
    char c = name[i];
    switch (c) {
    case '-':
    case '_':
      name[i] = ' ';
    }
  }
  return name;
}


x86 assembly (clang, -O0):
<gen_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <gen_name_base@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1198 <gen_name+0x88>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2d,%eax
je     1179 <gen_name+0x69>
jmp    1168 <gen_name+0x58>
mov    -0x1c(%rbp),%eax
sub    $0x5f,%eax
jne    1185 <gen_name+0x75>
jmp    1179 <gen_name+0x69>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    118a <gen_name+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <gen_name+0x20>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_name>:
push   %rax
call   1030 <gen_name_base@plt>
mov    (%rax),%dl
test   %dl,%dl
je     114e <gen_name+0x3e>
mov    %rax,%rcx
add    $0x1,%rcx
jmp    113f <gen_name+0x2f>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x20,-0x1(%rcx)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
je     114e <gen_name+0x3e>
movsbl %dl,%edx
cmp    $0x5f,%edx
je     1130 <gen_name+0x20>
cmp    $0x2d,%edx
je     1130 <gen_name+0x20>
jmp    1134 <gen_name+0x24>
pop    %rcx
ret

LLVM IR (-O0):
define i8* @gen_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @gen_name_base(i8* %6)
store i8* %7, i8** %3
store i32 0, i32* %4
br label %8
8: ; preds = %30, %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
store i8 %21, i8* %5
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
switch i32 %23, label %29 [
i32 45, label %24
i32 95, label %24
]
24: ; preds = %16, %16
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 32, i8* %28
br label %29
29: ; preds = %24, %16
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %8
33: ; preds = %8
%34 = load i8*, i8** %3
ret i8* %34
}

LLVM IR (-O2):
define i8* @gen_name(i8* %0) {
%2 = tail call i8* @gen_name_base(i8* %0)
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %12, %1
ret i8* %2
6: ; preds = %1, %12
%7 = phi i64 [ %13, %12 ], [ 0, %1 ]
%8 = phi i8 [ %15, %12 ], [ %3, %1 ]
%9 = phi i8* [ %14, %12 ], [ %2, %1 ]
%10 = sext i8 %8 to i32
switch i32 %10, label %12 [
i32 45, label %11
i32 95, label %11
]
11: ; preds = %6, %6
store i8 32, i8* %9
br label %12
12: ; preds = %11, %6
%13 = add nuw i64 %7, 1
%14 = getelementptr inbounds i8, i8* %2, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %5, label %6
}