#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 */
size_t strlen(char *);
char *remap_long_name(char *remapped) {
  size_t i;
  for (i = 0; i < strlen(remapped); i++) {
    if (remapped[i] == '_')
      remapped[i] = '-';
  }
  return remapped;
}


x86 assembly (clang, -O0):
<remap_long_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jae    117c <remap_long_name+0x6c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    1166 <remap_long_name+0x56>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x2d,(%rax,%rcx,1)
jmp    116b <remap_long_name+0x5b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <remap_long_name+0x14>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remap_long_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1152 <remap_long_name+0x42>
mov    $0x1,%ebx
cmp    $0x5f,%al
jne    1136 <remap_long_name+0x26>
cs nopw 0x0(%rax,%rax,1)
movb   $0x2d,-0x1(%r14,%rbx,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbx
jae    1152 <remap_long_name+0x42>
movzbl (%r14,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0x5f,%al
je     1130 <remap_long_name+0x20>
jmp    1136 <remap_long_name+0x26>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @remap_long_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %21, %1
%5 = load i64, i64* %3
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = icmp ult i64 %5, %7
br i1 %8, label %9, label %24
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i64, i64* %3
%12 = getelementptr inbounds i8, i8* %10, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 95
br i1 %15, label %16, label %20
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = load i64, i64* %3
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8 45, i8* %19
br label %20
20: ; preds = %16, %9
br label %21
21: ; preds = %20
%22 = load i64, i64* %3
%23 = add i64 %22, 1
store i64 %23, i64* %3
br label %4
24: ; preds = %4
%25 = load i8*, i8** %2
ret i8* %25
}

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