#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 */
char *malloc(int);
char *lwvm_name_to_str(char *name) {
  char *output = malloc(0x24 + 1);
  int i;
  for (i = 0; i < 0x24 && name[i * 2] != 0; i++) {
    output[i] = (char)name[i * 2];
  }
  output[i] = 0;
  return output;
}


x86 assembly (clang, -O0):
<lwvm_name_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x25,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x24,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    115a <lwvm_name_to_str+0x4a>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    116a <lwvm_name_to_str+0x5a>
jmp    1193 <lwvm_name_to_str+0x83>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <lwvm_name_to_str+0x21>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lwvm_name_to_str>:
push   %rbx
mov    %rdi,%rbx
mov    $0x25,%edi
call   1030 <malloc@plt>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x4(%rbx,%rcx,2),%edx
test   %dl,%dl
je     1166 <lwvm_name_to_str+0x56>
mov    %dl,-0x2(%rax,%rcx,1)
movzbl -0x2(%rbx,%rcx,2),%edx
test   %dl,%dl
je     116c <lwvm_name_to_str+0x5c>
mov    %dl,-0x1(%rax,%rcx,1)
movzbl (%rbx,%rcx,2),%edx
test   %dl,%dl
je     1170 <lwvm_name_to_str+0x60>
mov    %dl,(%rax,%rcx,1)
add    $0x3,%rcx
cmp    $0x26,%rcx
jne    1130 <lwvm_name_to_str+0x20>
mov    $0x24,%ecx
jmp    1170 <lwvm_name_to_str+0x60>
add    $0xfffffffffffffffe,%rcx
jmp    1170 <lwvm_name_to_str+0x60>
add    $0xffffffffffffffff,%rcx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @lwvm_name_to_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i8* @malloc(i32 37)
store i8* %5, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %31, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 36
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %4
%12 = mul nsw i32 %11, 2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %9, %6
%19 = phi i1 [ false, %6 ], [ %17, %9 ]
br i1 %19, label %20, label %34
20: ; preds = %18
%21 = load i8*, i8** %2
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8, i8* %25
%27 = load i8*, i8** %3
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 %26, i8* %30
br label %31
31: ; preds = %20
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %6
34: ; preds = %18
%35 = load i8*, i8** %3
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 0, i8* %38
%39 = load i8*, i8** %3
ret i8* %39
}

LLVM IR (-O2):
define noalias i8* @lwvm_name_to_str(i8* nocapture %0) {
%2 = tail call dereferenceable_or_null(37) i8* @malloc(i32 37)
br label %3
3: ; preds = %23, %1
%4 = phi i64 [ 0, %1 ], [ %25, %23 ]
%5 = shl nuw nsw i64 %4, 1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %27, label %9
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %2, i64 %4
store i8 %7, i8* %10
%11 = add nuw nsw i64 %4, 1
%12 = shl nuw nsw i64 %11, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %9
%17 = getelementptr inbounds i8, i8* %2, i64 %11
store i8 %14, i8* %17
%18 = add nuw nsw i64 %4, 2
%19 = shl nuw nsw i64 %18, 1
%20 = getelementptr inbounds i8, i8* %0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %16
%24 = getelementptr inbounds i8, i8* %2, i64 %18
store i8 %21, i8* %24
%25 = add nuw nsw i64 %4, 3
%26 = icmp eq i64 %25, 36
br i1 %26, label %27, label %3
27: ; preds = %23, %16, %9, %3
%28 = phi i64 [ %4, %3 ], [ %11, %9 ], [ %18, %16 ], [ 36, %23 ]
%29 = and i64 %28, 4294967295
%30 = getelementptr inbounds i8, i8* %2, i64 %29
store i8 0, i8* %30
ret i8* %2
}