#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 */
int /*<<< orphan*/ putc(char const, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void printEncodingName(const char *name) {
  while (*name != '\0') {
    if (*name >= 'A' && *name <= 'Z') {
      putc(*name - 'A' + 'a', stdout);
    } else if (*name == '-') {
      putc('_', stdout);
    } else {
      putc(*name, stdout);
    }
    ++name;
  }
}


x86 assembly (clang, -O0):
<printEncodingName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c4 <printEncodingName+0xb4>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     116f <printEncodingName+0x5f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     116f <printEncodingName+0x5f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    0x2e80(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    11b3 <printEncodingName+0xa3>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1197 <printEncodingName+0x87>
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
mov    $0x5f,%edi
call   1030 <putc@plt>
jmp    11ae <printEncodingName+0x9e>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    0x2e3c(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    11b3 <printEncodingName+0xa3>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <printEncodingName+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printEncodingName>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     115e <printEncodingName+0x4e>
mov    %rdi,%rbx
add    $0x1,%rbx
mov    0x2eb8(%rip),%r14
jmp    1148 <printEncodingName+0x38>
nopw   0x0(%rax,%rax,1)
add    $0x20,%al
mov    (%r14),%esi
movsbl %al,%edi
call   1030 <putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     115e <printEncodingName+0x4e>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
jbe    1130 <printEncodingName+0x20>
mov    (%r14),%esi
cmp    $0x2d,%al
jne    1135 <printEncodingName+0x25>
mov    $0x5f,%edi
jmp    1138 <printEncodingName+0x28>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @printEncodingName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %41, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %44
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 65
br i1 %12, label %13, label %27
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br i1 %17, label %18, label %27
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 65
%23 = add nsw i32 %22, 97
%24 = trunc i32 %23 to i8
%25 = load i32, i32* @stdout
%26 = call i32 @putc(i8 signext %24, i32 %25)
br label %41
27: ; preds = %13, %8
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 45
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* @stdout
%34 = call i32 @putc(i8 signext 95, i32 %33)
br label %40
35: ; preds = %27
%36 = load i8*, i8** %2
%37 = load i8, i8* %36
%38 = load i32, i32* @stdout
%39 = call i32 @putc(i8 signext %37, i32 %38)
br label %40
40: ; preds = %35, %32
br label %41
41: ; preds = %40, %18
%42 = load i8*, i8** %2
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %2
br label %3
44: ; preds = %3
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @printEncodingName(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %1, %20
%5 = phi i8 [ %22, %20 ], [ %2, %1 ]
%6 = phi i8* [ %21, %20 ], [ %0, %1 ]
%7 = add i8 %5, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = add nuw nsw i8 %5, 32
%11 = load i32, i32* @stdout
%12 = tail call i32 @putc(i8 signext %10, i32 %11)
br label %20
13: ; preds = %4
%14 = icmp eq i8 %5, 45
%15 = load i32, i32* @stdout
br i1 %14, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @putc(i8 signext 95, i32 %15)
br label %20
18: ; preds = %13
%19 = tail call i32 @putc(i8 signext %5, i32 %15)
br label %20
20: ; preds = %16, %18, %9
%21 = getelementptr inbounds i8, i8* %6, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %20, %1
ret void
}