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


x86 assembly (clang, -O0):
<str_to_lwvm_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x48,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x48,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    1175 <str_to_lwvm_name+0x55>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1185 <str_to_lwvm_name+0x65>
jmp    11ae <str_to_lwvm_name+0x8e>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <str_to_lwvm_name+0x31>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_lwvm_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x48,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1030 <memset@plt>
mov    $0x2,%eax
nopl   0x0(%rax,%rax,1)
movzbl -0x2(%r14,%rax,1),%ecx
test   %cl,%cl
je     1182 <str_to_lwvm_name+0x62>
mov    %cl,-0x4(%rbx,%rax,2)
movzbl -0x1(%r14,%rax,1),%ecx
test   %cl,%cl
je     1182 <str_to_lwvm_name+0x62>
mov    %cl,-0x2(%rbx,%rax,2)
movzbl (%r14,%rax,1),%ecx
test   %cl,%cl
je     1182 <str_to_lwvm_name+0x62>
mov    %cl,(%rbx,%rax,2)
add    $0x3,%rax
cmp    $0x4a,%rax
jne    1150 <str_to_lwvm_name+0x30>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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