#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 *parse_version_number(char const *, int *);
const char *parse_version_string(const char *s, int *major, int *minor,
                                 int *micro) {
  s = parse_version_number(s, major);
  if (!s || *s != '.')
    return NULL;
  s++;
  s = parse_version_number(s, minor);
  if (!s || *s != '.')
    return NULL;
  s++;
  s = parse_version_number(s, micro);
  if (!s)
    return NULL;
  return s;
}


x86 assembly (clang, -O0):
<parse_version_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <parse_version_number@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1154 <parse_version_string+0x44>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1161 <parse_version_string+0x51>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <parse_version_string+0xd3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <parse_version_number@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1199 <parse_version_string+0x89>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     11a6 <parse_version_string+0x96>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <parse_version_string+0xd3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <parse_version_number@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11db <parse_version_string+0xcb>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <parse_version_string+0xd3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_version_string>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
call   1030 <parse_version_number@plt>
test   %rax,%rax
je     1158 <parse_version_string+0x48>
cmpb   $0x2e,(%rax)
jne    1158 <parse_version_string+0x48>
add    $0x1,%rax
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <parse_version_number@plt>
test   %rax,%rax
je     1158 <parse_version_string+0x48>
cmpb   $0x2e,(%rax)
jne    1158 <parse_version_string+0x48>
add    $0x1,%rax
mov    %rax,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <parse_version_number@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @parse_version_string(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%10 = load i8*, i8** %6
%11 = load i32*, i32** %7
%12 = call i8* @parse_version_number(i8* %10, i32* %11)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %20
15: ; preds = %4
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 46
br i1 %19, label %20, label %21
20: ; preds = %15, %4
store i8* null, i8** %5
br label %46
21: ; preds = %15
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = load i32*, i32** %8
%26 = call i8* @parse_version_number(i8* %24, i32* %25)
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %34
29: ; preds = %21
%30 = load i8*, i8** %6
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 46
br i1 %33, label %34, label %35
34: ; preds = %29, %21
store i8* null, i8** %5
br label %46
35: ; preds = %29
%36 = load i8*, i8** %6
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %6
%38 = load i8*, i8** %6
%39 = load i32*, i32** %9
%40 = call i8* @parse_version_number(i8* %38, i32* %39)
store i8* %40, i8** %6
%41 = load i8*, i8** %6
%42 = icmp ne i8* %41, null
br i1 %42, label %44, label %43
43: ; preds = %35
store i8* null, i8** %5
br label %46
44: ; preds = %35
%45 = load i8*, i8** %6
store i8* %45, i8** %5
br label %46
46: ; preds = %44, %43, %34, %20
%47 = load i8*, i8** %5
ret i8* %47
}

LLVM IR (-O2):
define i8* @parse_version_string(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = tail call i8* @parse_version_number(i8* %0, i32* %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %20, label %7
7: ; preds = %4
%8 = load i8, i8* %5
%9 = icmp eq i8 %8, 46
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = tail call i8* @parse_version_number(i8* %11, i32* %2)
%13 = icmp eq i8* %12, null
br i1 %13, label %20, label %14
14: ; preds = %10
%15 = load i8, i8* %12
%16 = icmp eq i8 %15, 46
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = getelementptr inbounds i8, i8* %12, i64 1
%19 = tail call i8* @parse_version_number(i8* %18, i32* %3)
br label %20
20: ; preds = %17, %10, %14, %4, %7
%21 = phi i8* [ null, %7 ], [ null, %4 ], [ null, %14 ], [ null, %10 ], [ %19, %17 ]
ret i8* %21
}