#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 tolower(char);
void weenixname(char *name) {
  char *p;
  for (p = name; *p != 0; p++) {
    switch (*p) {
    case '.':
      *p = '_';
      break;
    case '/':
      *p = '{';
      break;
    case '_':
      *p = '}';
      break;
    case ' ':
      *p = '~';
      break;
    default:
      *p = tolower(*p);
      break;
    }
  }
  while (*--p == '~')
    *p = 0;
}


x86 assembly (clang, -O0):
<weenixname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d9 <weenixname+0xc9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x20,%eax
je     11a3 <weenixname+0x93>
jmp    114c <weenixname+0x3c>
mov    -0x14(%rbp),%eax
sub    $0x2e,%eax
je     117f <weenixname+0x6f>
jmp    115d <weenixname+0x4d>
mov    -0x14(%rbp),%eax
sub    $0x2f,%eax
je     118b <weenixname+0x7b>
jmp    116e <weenixname+0x5e>
mov    -0x14(%rbp),%eax
sub    $0x5f,%eax
je     1197 <weenixname+0x87>
jmp    11af <weenixname+0x9f>
mov    -0x10(%rbp),%rax
movb   $0x5f,(%rax)
jmp    11c3 <weenixname+0xb3>
mov    -0x10(%rbp),%rax
movb   $0x7b,(%rax)
jmp    11c3 <weenixname+0xb3>
mov    -0x10(%rbp),%rax
movb   $0x7d,(%rax)
jmp    11c3 <weenixname+0xb3>
mov    -0x10(%rbp),%rax
movb   $0x7e,(%rax)
jmp    11c3 <weenixname+0xb3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    11c8 <weenixname+0xb8>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <weenixname+0x14>
jmp    11de <weenixname+0xce>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x7e,%eax
jne    1206 <weenixname+0xf6>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11de <weenixname+0xce>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weenixname>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
jmp    112a <weenixname+0x1a>
call   1030 <tolower@plt>
nopl   (%rax)
mov    %al,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1166 <weenixname+0x56>
movsbl %al,%edi
cmp    $0x2e,%edi
jg     1150 <weenixname+0x40>
cmp    $0x20,%edi
je     115e <weenixname+0x4e>
mov    $0x5f,%al
cmp    $0x2e,%edi
je     1120 <weenixname+0x10>
jmp    1118 <weenixname+0x8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x5f,%edi
je     1162 <weenixname+0x52>
cmp    $0x2f,%edi
jne    1118 <weenixname+0x8>
mov    $0x7b,%al
jmp    1120 <weenixname+0x10>
mov    $0x7e,%al
jmp    1120 <weenixname+0x10>
mov    $0x7d,%al
jmp    1120 <weenixname+0x10>
cmpb   $0x7e,-0x1(%rbx)
jne    117d <weenixname+0x6d>
add    $0xffffffffffffffff,%rbx
movb   $0x0,(%rbx)
cmpb   $0x7e,-0x1(%rbx)
lea    -0x1(%rbx),%rbx
je     1170 <weenixname+0x60>
pop    %rbx
ret

LLVM IR (-O0):
define void @weenixname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %28, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
switch i32 %13, label %22 [
i32 46, label %14
i32 47, label %16
i32 95, label %18
i32 32, label %20
]
14: ; preds = %10
%15 = load i8*, i8** %3
store i8 95, i8* %15
br label %27
16: ; preds = %10
%17 = load i8*, i8** %3
store i8 123, i8* %17
br label %27
18: ; preds = %10
%19 = load i8*, i8** %3
store i8 125, i8* %19
br label %27
20: ; preds = %10
%21 = load i8*, i8** %3
store i8 126, i8* %21
br label %27
22: ; preds = %10
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = call signext i8 @tolower(i8 signext %24)
%26 = load i8*, i8** %3
store i8 %25, i8* %26
br label %27
27: ; preds = %22, %20, %18, %16, %14
br label %28
28: ; preds = %27
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
br label %5
31: ; preds = %5
br label %32
32: ; preds = %38, %31
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i32 -1
store i8* %34, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 126
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = load i8*, i8** %3
store i8 0, i8* %39
br label %32
40: ; preds = %32
ret void
}

LLVM IR (-O2):
define void @weenixname(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %18, %1
%5 = phi i8* [ %0, %1 ], [ %20, %18 ]
%6 = getelementptr inbounds i8, i8* %5, i64 -1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 126
br i1 %8, label %23, label %28
9: ; preds = %1, %18
%10 = phi i8 [ %21, %18 ], [ %2, %1 ]
%11 = phi i8* [ %20, %18 ], [ %0, %1 ]
%12 = sext i8 %10 to i32
switch i32 %12, label %16 [
i32 46, label %18
i32 47, label %13
i32 95, label %14
i32 32, label %15
]
13: ; preds = %9
br label %18
14: ; preds = %9
br label %18
15: ; preds = %9
br label %18
16: ; preds = %9
%17 = tail call signext i8 @tolower(i8 signext %10)
br label %18
18: ; preds = %9, %13, %14, %15, %16
%19 = phi i8 [ 123, %13 ], [ 125, %14 ], [ 126, %15 ], [ %17, %16 ], [ 95, %9 ]
store i8 %19, i8* %11
%20 = getelementptr inbounds i8, i8* %11, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %4, label %9
23: ; preds = %4, %23
%24 = phi i8* [ %25, %23 ], [ %6, %4 ]
store i8 0, i8* %24
%25 = getelementptr inbounds i8, i8* %24, i64 -1
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 126
br i1 %27, label %23, label %28
28: ; preds = %23, %4
ret void
}