#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 */
struct pane {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ isalnum(char);
int /*<<< orphan*/ strchr(char *, char);
char *strsave(struct pane *, char const *);
char *fnormalize(struct pane *p, const char *str) {
  char *ret = strsave(p, str);
  char *cp;
  for (cp = ret; cp && *cp; cp++)
    if (!isalnum(*cp) && !strchr("/_-+=.,@#", *cp))
      *cp = '_';
  return ret ?: "_";
}


x86 assembly (clang, -O0):
<fnormalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strsave@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     1179 <fnormalize+0x49>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1189 <fnormalize+0x59>
jmp    11d7 <fnormalize+0xa7>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%eax
jne    11c1 <fnormalize+0x91>
mov    -0x20(%rbp),%rax
lea    0xe57(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%eax
jne    11c1 <fnormalize+0x91>
mov    -0x20(%rbp),%rax
movb   $0x5f,(%rax)
jmp    11c6 <fnormalize+0x96>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1159 <fnormalize+0x29>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     11f6 <fnormalize+0xc6>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1206 <fnormalize+0xd6>
lea    0xe0d(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1206 <fnormalize+0xd6>
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnormalize>:
push   %r15
push   %r14
push   %rbx
call   1050 <strsave@plt>
test   %rax,%rax
je     118c <fnormalize+0x5c>
mov    %rax,%r15
mov    (%rax),%al
test   %al,%al
je     1193 <fnormalize+0x63>
lea    0xeb1(%rip),%r14
mov    %r15,%rbx
jmp    116c <fnormalize+0x3c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1193 <fnormalize+0x63>
movsbl %al,%edi
call   1040 <isalnum@plt>
test   %eax,%eax
jne    1160 <fnormalize+0x30>
movsbl (%rbx),%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %eax,%eax
jne    1160 <fnormalize+0x30>
movb   $0x5f,(%rbx)
jmp    1160 <fnormalize+0x30>
lea    0xe77(%rip),%r15
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.pane = type { i32 }
@.str = [10 x i8] c"/_-+=.,@#\00"
@.str.1 = [2 x i8] c"_\00"
define i8* @fnormalize(%struct.pane* %0, i8* %1) {
%3 = alloca %struct.pane*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store %struct.pane* %0, %struct.pane** %3
store i8* %1, i8** %4
%7 = load %struct.pane*, %struct.pane** %3
%8 = load i8*, i8** %4
%9 = call i8* @strsave(%struct.pane* %7, i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
store i8* %10, i8** %6
br label %11
11: ; preds = %34, %2
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br label %19
19: ; preds = %14, %11
%20 = phi i1 [ false, %11 ], [ %18, %14 ]
br i1 %20, label %21, label %37
21: ; preds = %19
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = call i32 @isalnum(i8 signext %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = call i32 @strchr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %26
%32 = load i8*, i8** %6
store i8 95, i8* %32
br label %33
33: ; preds = %31, %26, %21
br label %34
34: ; preds = %33
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %6
br label %11
37: ; preds = %19
%38 = load i8*, i8** %5
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %41
40: ; preds = %37
br label %42
41: ; preds = %37
br label %42
42: ; preds = %41, %40
%43 = phi i8* [ %38, %40 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %41 ]
ret i8* %43
}

LLVM IR (-O2):
%struct.pane = type { i32 }
@.str = [10 x i8] c"/_-+=.,@#\00"
@.str.1 = [2 x i8] c"_\00"
define i8* @fnormalize(%struct.pane* %0, i8* %1) {
%3 = tail call i8* @strsave(%struct.pane* %0, i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %22, label %5
5: ; preds = %2
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %22, label %8
8: ; preds = %5, %18
%9 = phi i8 [ %20, %18 ], [ %6, %5 ]
%10 = phi i8* [ %19, %18 ], [ %3, %5 ]
%11 = tail call i32 @isalnum(i8 signext %9)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8, i8* %10
%15 = tail call i32 @strchr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 95, i8* %10
br label %18
18: ; preds = %8, %13, %17
%19 = getelementptr inbounds i8, i8* %10, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %8
22: ; preds = %18, %5, %2
%23 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %3, %5 ], [ %3, %18 ]
ret i8* %23
}