#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 */
int atoi(int /*<<< orphan*/);
scalar_t__ getVersion(char const *);
int /*<<< orphan*/ strtok(char *, char *);
int *getMajorMinorPatch(char const *aExecutable) {
  static int lArray[3];
  char *lTmp;
  lTmp = (char *)getVersion(aExecutable);
  lArray[0] = atoi(strtok(lTmp, " ,.-"));
  lArray[1] = atoi(strtok(0, " ,.-"));
  lArray[2] = atoi(strtok(0, " ,.-"));
  if (!lArray[0] && !lArray[1] && !lArray[2])
    return NULL;
  return lArray;
}


x86 assembly (clang, -O0):
<getMajorMinorPatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getVersion@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2ed6(%rip)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8f(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2ebd(%rip)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe72(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2ea4(%rip)
cmpl   $0x0,0x2e95(%rip)
jne    11d4 <getMajorMinorPatch+0xa4>
cmpl   $0x0,0x2e8c(%rip)
jne    11d4 <getMajorMinorPatch+0xa4>
cmpl   $0x0,0x2e83(%rip)
jne    11d4 <getMajorMinorPatch+0xa4>
movq   $0x0,-0x8(%rbp)
jmp    11df <getMajorMinorPatch+0xaf>
lea    0x2e61(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMajorMinorPatch>:
push   %r15
push   %r14
push   %rbx
call   1050 <getVersion@plt>
lea    0xebf(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2ee3(%rip)
lea    0x2edc(%rip),%rbx
xor    %r15d,%r15d
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2ec6(%rip)
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1040 <atoi@plt>
mov    %eax,0x2eb3(%rip)
mov    0x2ea5(%rip),%ecx
or     0x2ea3(%rip),%ecx
or     %eax,%ecx
cmove  %r15,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@getMajorMinorPatch.lArray = internal global [3 x i32] zeroinitializer
@.str = [5 x i8] c" ,.-\00"
define i32* @getMajorMinorPatch(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @getVersion(i8* %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strtok(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @atoi(i32 %9)
store i32 %10, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0)
%11 = call i32 @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @atoi(i32 %11)
store i32 %12, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 1)
%13 = call i32 @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @atoi(i32 %13)
store i32 %14, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 2)
%15 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0)
%16 = icmp ne i32 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %1
%18 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 1)
%19 = icmp ne i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 2)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %20
store i32* null, i32** %2
br label %25
24: ; preds = %20, %17, %1
store i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0), i32** %2
br label %25
25: ; preds = %24, %23
%26 = load i32*, i32** %2
ret i32* %26
}

LLVM IR (-O2):
@getMajorMinorPatch.lArray = internal global [3 x i32] zeroinitializer
@.str = [5 x i8] c" ,.-\00"
define i32* @getMajorMinorPatch(i8* %0) {
%2 = tail call i64 @getVersion(i8* %0)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @strtok(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @atoi(i32 %4)
store i32 %5, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0)
%6 = tail call i32 @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @atoi(i32 %6)
store i32 %7, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 1)
%8 = tail call i32 @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @atoi(i32 %8)
store i32 %9, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 2)
%10 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0)
%11 = icmp ne i32 %10, 0
%12 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 1)
%13 = icmp ne i32 %12, 0
%14 = select i1 %11, i1 true, i1 %13
%15 = icmp ne i32 %9, 0
%16 = select i1 %14, i1 true, i1 %15
%17 = select i1 %16, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @getMajorMinorPatch.lArray, i64 0, i64 0), i32* null
ret i32* %17
}