#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 *strrchr(char *, char);
void versucc(char *vers) {
  char *pdot = strrchr(vers, '.');
  char *pend = NULL;
  if (pdot == NULL) {
    pdot = strrchr(vers, '\0');
    *pdot = '.';
  }
  pdot++;
  for (pend = pdot + 10; pdot < pend; pdot++)
    *pdot = '9';
  *pdot = '\0';
}


x86 assembly (clang, -O0):
<versucc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <versucc+0x47>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x2e,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1195 <versucc+0x85>
mov    -0x10(%rbp),%rax
movb   $0x39,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    116f <versucc+0x5f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<versucc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
jne    1145 <versucc+0x25>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
add    %rbx,%rax
movb   $0x2e,(%rbx,%rcx,1)
movabs $0x3939393939393939,%rcx
39 39 39
mov    %rcx,0x1(%rax)
movw   $0x3939,0x9(%rax)
movb   $0x0,0xb(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @versucc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
store i8* %6, i8** %3
store i8* null, i8** %4
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i8* @strrchr(i8* %10, i8 signext 0)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
store i8 46, i8* %12
br label %13
13: ; preds = %9, %1
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 10
store i8* %17, i8** %4
br label %18
18: ; preds = %24, %13
%19 = load i8*, i8** %3
%20 = load i8*, i8** %4
%21 = icmp ult i8* %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i8*, i8** %3
store i8 57, i8* %23
br label %24
24: ; preds = %22
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
br label %18
27: ; preds = %18
%28 = load i8*, i8** %3
store i8 0, i8* %28
ret void
}

LLVM IR (-O2):
define void @versucc(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = getelementptr i8, i8* %0, i64 %5
store i8 46, i8* %6
br label %7
7: ; preds = %4, %1
%8 = phi i8* [ %6, %4 ], [ %2, %1 ]
%9 = getelementptr i8, i8* %8, i64 1
%10 = getelementptr i8, i8* %8, i64 11
store i8 0, i8* %10
ret void
}