#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 */
typedef int /*<<< orphan*/ retname;

/* Variables and functions */
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char tolower(char);
char *makeunixname(char *n83) {
  static char retname[13];
  int f, g;
  memset(retname, 0, sizeof(retname));
  for (f = g = 0; f < 11; f++) {
    if (f == 8 && memcmp(n83 + 8, "   ", 3) != 0)
      retname[g++] = '.';
    switch (n83[f]) {
    case ' ':
      break;
    case '/':
      retname[g++] = '_';
      break;
    default:
      retname[g++] = tolower(n83[f]);
    }
  }
  return (retname);
}


x86 assembly (clang, -O0):
<makeunixname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2ef6(%rip),%rdi
xor    %esi,%esi
mov    $0xd,%edx
call   1030 <memset@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xb,-0xc(%rbp)
jge    123c <makeunixname+0x10c>
cmpl   $0x8,-0xc(%rbp)
jne    11ad <makeunixname+0x7d>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
lea    0xe80(%rip),%rsi
mov    $0x3,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     11ad <makeunixname+0x7d>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
movslq %eax,%rcx
lea    0x2e90(%rip),%rax
movb   $0x2e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
sub    $0x20,%eax
je     11db <makeunixname+0xab>
jmp    11ca <makeunixname+0x9a>
mov    -0x14(%rbp),%eax
sub    $0x2f,%eax
je     11e0 <makeunixname+0xb0>
jmp    11fe <makeunixname+0xce>
jmp    1229 <makeunixname+0xf9>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
movslq %eax,%rcx
lea    0x2e44(%rip),%rax
movb   $0x5f,(%rax,%rcx,1)
jmp    1229 <makeunixname+0xf9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
mov    %al,%dl
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
movslq %eax,%rcx
lea    0x2e13(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    122e <makeunixname+0xfe>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <makeunixname+0x2d>
lea    0x2df6(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeunixname>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
lea    0x2ef4(%rip),%r14
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xd,%edx
call   1030 <memset@plt>
lea    0x8(%r13),%r15
mov    $0xfffffffffffffff5,%rbx
lea    0xe98(%rip),%r12
jmp    117f <makeunixname+0x4f>
nopw   0x0(%rax,%rax,1)
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%rcx,%r14,1)
inc    %rbx
je     11be <makeunixname+0x8e>
cmp    $0xfffffffffffffffd,%rbx
jne    11a5 <makeunixname+0x75>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x3,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
je     11a5 <makeunixname+0x75>
movslq %ebp,%rax
add    $0x1,%ebp
movb   $0x2e,(%rax,%r14,1)
movsbl 0xb(%r13,%rbx,1),%edi
cmp    $0x20,%edi
je     117a <makeunixname+0x4a>
mov    $0x5f,%al
cmp    $0x2f,%edi
je     1170 <makeunixname+0x40>
call   1050 <tolower@plt>
jmp    1170 <makeunixname+0x40>
lea    0x2e74(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@makeunixname.retname = internal global [13 x i8] zeroinitializer
@.str = [4 x i8] c" \00"
define i8* @makeunixname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @memset(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 0), i32 0, i32 13)
store i32 0, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %47, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 11
br i1 %8, label %9, label %50
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 8
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 8
%15 = call i64 @memcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds [13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 %20
store i8 46, i8* %21
br label %22
22: ; preds = %17, %12, %9
%23 = load i8*, i8** %2
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
switch i32 %28, label %35 [
i32 32, label %29
i32 47, label %30
]
29: ; preds = %22
br label %46
30: ; preds = %22
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 %33
store i8 95, i8* %34
br label %46
35: ; preds = %22
%36 = load i8*, i8** %2
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = call signext i8 @tolower(i8 signext %40)
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 %44
store i8 %41, i8* %45
br label %46
46: ; preds = %35, %30, %29
br label %47
47: ; preds = %46
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %6
50: ; preds = %6
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 0)
}

LLVM IR (-O2):
@makeunixname.retname = internal global [13 x i8] zeroinitializer
@.str = [4 x i8] c" \00"
define i8* @makeunixname(i8* %0) {
%2 = tail call i32 @memset(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 0), i32 0, i32 13)
%3 = getelementptr inbounds i8, i8* %0, i64 8
br label %4
4: ; preds = %1, %27
%5 = phi i64 [ 0, %1 ], [ %29, %27 ]
%6 = phi i32 [ 0, %1 ], [ %28, %27 ]
%7 = icmp eq i64 %5, 8
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = tail call i64 @memcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = add nsw i32 %6, 1
%13 = sext i32 %6 to i64
%14 = getelementptr inbounds [13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 %13
store i8 46, i8* %14
br label %15
15: ; preds = %11, %8, %4
%16 = phi i32 [ %12, %11 ], [ %6, %8 ], [ %6, %4 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
switch i32 %19, label %20 [
i32 32, label %27
i32 47, label %22
]
20: ; preds = %15
%21 = tail call signext i8 @tolower(i8 signext %18)
br label %22
22: ; preds = %15, %20
%23 = phi i8 [ %21, %20 ], [ 95, %15 ]
%24 = add nsw i32 %16, 1
%25 = sext i32 %16 to i64
%26 = getelementptr inbounds [13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 %25
store i8 %23, i8* %26
br label %27
27: ; preds = %22, %15
%28 = phi i32 [ %16, %15 ], [ %24, %22 ]
%29 = add nuw nsw i64 %5, 1
%30 = icmp eq i64 %29, 11
br i1 %30, label %31, label %4
31: ; preds = %27
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @makeunixname.retname, i64 0, i64 0)
}