#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__ allocate(scalar_t__);
int /*<<< orphan*/ sanitize_character(char **, char);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void sanatize_name(char **dest, char *src) {
  *dest = (char *)allocate(strlen(src) + 1);
  strcpy(*dest, src);
  sanitize_character(dest, ':');
  sanitize_character(dest, '.');
  sanitize_character(dest, '<');
  sanitize_character(dest, '>');
  sanitize_character(dest, '(');
  sanitize_character(dest, ')');
  sanitize_character(dest, '-');
}


x86 assembly (clang, -O0):
<sanatize_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <allocate@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3e,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x28,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x29,%esi
call   1050 <sanitize_character@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <sanitize_character@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanatize_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <allocate@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x3e,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x29,%esi
call   1050 <sanitize_character@plt>
mov    %rbx,%rdi
mov    $0x2d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <sanitize_character@plt>

LLVM IR (-O0):
define void @sanatize_name(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @allocate(i64 %7)
%9 = inttoptr i64 %8 to i8*
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8**, i8*** %3
%16 = call i32 @sanitize_character(i8** %15, i8 signext 58)
%17 = load i8**, i8*** %3
%18 = call i32 @sanitize_character(i8** %17, i8 signext 46)
%19 = load i8**, i8*** %3
%20 = call i32 @sanitize_character(i8** %19, i8 signext 60)
%21 = load i8**, i8*** %3
%22 = call i32 @sanitize_character(i8** %21, i8 signext 62)
%23 = load i8**, i8*** %3
%24 = call i32 @sanitize_character(i8** %23, i8 signext 40)
%25 = load i8**, i8*** %3
%26 = call i32 @sanitize_character(i8** %25, i8 signext 41)
%27 = load i8**, i8*** %3
%28 = call i32 @sanitize_character(i8** %27, i8 signext 45)
ret void
}

LLVM IR (-O2):
define void @sanatize_name(i8** %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add nsw i64 %3, 1
%5 = tail call i64 @allocate(i64 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %0
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
%8 = tail call i32 @sanitize_character(i8** %0, i8 signext 58)
%9 = tail call i32 @sanitize_character(i8** %0, i8 signext 46)
%10 = tail call i32 @sanitize_character(i8** %0, i8 signext 60)
%11 = tail call i32 @sanitize_character(i8** %0, i8 signext 62)
%12 = tail call i32 @sanitize_character(i8** %0, i8 signext 40)
%13 = tail call i32 @sanitize_character(i8** %0, i8 signext 41)
%14 = tail call i32 @sanitize_character(i8** %0, i8 signext 45)
ret void
}