#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 *strchr(char *, char);
void prase_name(char *name, char *version) {
  int i;
  char *q;
  q = strchr(name, 'V');
  for (i = 0, q++; *(q + i) != '-'; i++)
    version[i] = *(q + i);
  version[i] = '\0';
  return;
}


x86 assembly (clang, -O0):
<prase_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x56,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
je     117e <prase_name+0x6e>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%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    1145 <prase_name+0x35>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prase_name>:
push   %rbx
mov    %rsi,%rbx
mov    $0x56,%esi
call   1030 <strchr@plt>
mov    0x1(%rax),%cl
cmp    $0x2d,%cl
jne    112a <prase_name+0x1a>
xor    %eax,%eax
jmp    1143 <prase_name+0x33>
xor    %edx,%edx
nopl   0x0(%rax)
mov    %cl,(%rbx,%rdx,1)
movzbl 0x2(%rax,%rdx,1),%ecx
add    $0x1,%rdx
cmp    $0x2d,%cl
jne    1130 <prase_name+0x20>
mov    %edx,%eax
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret

LLVM IR (-O0):
define void @prase_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @strchr(i8* %7, i8 signext 86)
store i8* %8, i8** %6
store i32 0, i32* %5
%9 = load i8*, i8** %6
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %6
br label %11
11: ; preds = %29, %2
%12 = load i8*, i8** %6
%13 = load i32, i32* %5
%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, 45
br i1 %18, label %19, label %32
19: ; preds = %11
%20 = load i8*, i8** %6
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 %24, i8* %28
br label %29
29: ; preds = %19
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %11
32: ; preds = %11
%33 = load i8*, i8** %4
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 0, i8* %36
ret void
}

LLVM IR (-O2):
define void @prase_name(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 86)
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 45
br i1 %6, label %17, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %11, %7 ], [ 0, %2 ]
%9 = phi i8 [ %13, %7 ], [ %5, %2 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 %9, i8* %10
%11 = add nuw nsw i64 %8, 1
%12 = getelementptr inbounds i8, i8* %4, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 45
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = and i64 %11, 4294967295
br label %17
17: ; preds = %15, %2
%18 = phi i64 [ 0, %2 ], [ %16, %15 ]
%19 = getelementptr inbounds i8, i8* %1, i64 %18
store i8 0, i8* %19
ret void
}