#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*/ Normalized;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char);
char *NormalizeAnchor(char *Name) {
  static char Normalized[17], *EndPoint = &Normalized[sizeof(Normalized) - 1];
  char *s;
  for (s = Normalized, *s = 0; *Name != 0 && s < EndPoint; s += 2, Name++)
    sprintf(s, "%02X", *Name);
  return (Normalized);
}


x86 assembly (clang, -O0):
<NormalizeAnchor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1154 <NormalizeAnchor+0x44>
mov    -0x10(%rbp),%rax
cmp    0x2eda(%rip),%rax
setb   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1164 <NormalizeAnchor+0x54>
jmp    1198 <NormalizeAnchor+0x88>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
lea    0xe8d(%rip),%rsi
movsbl (%rax),%edx
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112e <NormalizeAnchor+0x1e>
lea    0x2ea1(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NormalizeAnchor>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0x0,0x2f21(%rip)
mov    (%rdi),%al
test   %al,%al
je     1173 <NormalizeAnchor+0x63>
mov    %rdi,%r14
add    $0x1,%r14
lea    0x2f0d(%rip),%rbx
lea    0xec6(%rip),%r15
lea    0x2f0f(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
movzbl (%r14),%eax
test   %al,%al
je     1173 <NormalizeAnchor+0x63>
add    $0x2,%rbx
add    $0x1,%r14
cmp    %r12,%rbx
jb     1150 <NormalizeAnchor+0x40>
lea    0x2ec6(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@NormalizeAnchor.Normalized = internal global [17 x i8] zeroinitializer
@NormalizeAnchor.EndPoint = internal global i8* getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i32 0, i64 16)
@.str = [5 x i8] c"%02X\00"
define i8* @NormalizeAnchor(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
store i8 0, i8* %4
br label %5
5: ; preds = %21, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8*, i8** @NormalizeAnchor.EndPoint
%13 = icmp ult i8* %11, %12
br label %14
14: ; preds = %10, %5
%15 = phi i1 [ false, %5 ], [ %13, %10 ]
br i1 %15, label %16, label %26
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %19)
br label %21
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8* %23, i8** %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
br label %5
26: ; preds = %14
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 0)
}

LLVM IR (-O2):
@NormalizeAnchor.Normalized = internal global [17 x i8] zeroinitializer
@.str = [5 x i8] c"%02X\00"
define i8* @NormalizeAnchor(i8* nocapture %0) {
store i8 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 0)
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 0), %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%9 = getelementptr inbounds i8, i8* %6, i64 2
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
%13 = icmp ult i8* %9, getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 16)
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %4, label %15
15: ; preds = %4, %1
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @NormalizeAnchor.Normalized, i64 0, i64 0)
}