#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(char *);
char *dialogNameOnly();
scalar_t__ getVersion(char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
char *strtok(char *, char *);
int isDialogVersionBetter09b() {
  char const *lDialogName;
  char *lVersion;
  int lMajor;
  int lMinor;
  int lDate;
  int lResult;
  char *lMinorP;
  char *lLetter;
  char lBuff[128];
  lDialogName = dialogNameOnly();
  if (!strlen(lDialogName) || !(lVersion = (char *)getVersion(lDialogName)))
    return 0;
  strcpy(lBuff, lVersion);
  lMajor = atoi(strtok(lVersion, " ,.-"));
  lMinorP = strtok(0, " ,.-abcdefghijklmnopqrstuvxyz");
  lMinor = atoi(lMinorP);
  lDate = atoi(strtok(0, " ,.-"));
  if (lDate < 0)
    lDate = -lDate;
  lLetter = lMinorP + strlen(lMinorP);
  strcpy(lVersion, lBuff);
  strtok(lLetter, " ,.-");
  lResult = (lMajor > 0) ||
            ((lMinor == 9) && (*lLetter == 'b') && (lDate >= 20031126));
  return lResult;
}


x86 assembly (clang, -O0):
<isDialogVersionBetter09b>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    $0x0,%al
call   1050 <dialogNameOnly@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     119f <isDialogVersionBetter09b+0x3f>
mov    -0x10(%rbp),%rdi
call   1080 <getVersion@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11ab <isDialogVersionBetter09b+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    12d6 <isDialogVersionBetter09b+0x176>
lea    -0xc0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe24(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xdff(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1223 <isDialogVersionBetter09b+0xc3>
xor    %eax,%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1060 <strtok@plt>
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0xc1(%rbp)
jg     12c2 <isDialogVersionBetter09b+0x162>
xor    %eax,%eax
cmpl   $0x9,-0x20(%rbp)
mov    %al,-0xd1(%rbp)
jne    12b6 <isDialogVersionBetter09b+0x156>
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x62,%ecx
mov    %al,-0xd1(%rbp)
jne    12b6 <isDialogVersionBetter09b+0x156>
cmpl   $0x131a696,-0x24(%rbp)
setge  %al
mov    %al,-0xd1(%rbp)
mov    -0xd1(%rbp),%al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDialogVersionBetter09b>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <dialogNameOnly@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     1257 <isDialogVersionBetter09b+0xf7>
mov    %rbx,%rdi
call   1080 <getVersion@plt>
test   %rax,%rax
je     1257 <isDialogVersionBetter09b+0xf7>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xe4b(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,%r12d
lea    0xe33(%rip),%rsi
xor    %edi,%edi
call   1060 <strtok@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,0xc(%rsp)
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
neg    %r13d
cmovs  %eax,%r13d
mov    %rbp,%rdi
call   1040 <strlen@plt>
movslq %eax,%r14
add    %rbp,%r14
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strtok@plt>
mov    $0x1,%ebp
test   %r12d,%r12d
jg     1257 <isDialogVersionBetter09b+0xf7>
cmpl   $0x9,0xc(%rsp)
jne    1255 <isDialogVersionBetter09b+0xf5>
cmpb   $0x62,(%r14)
mov    $0x0,%ebp
jne    1257 <isDialogVersionBetter09b+0xf7>
xor    %ebp,%ebp
cmp    $0x131a696,%r13d
setae  %bpl
jmp    1257 <isDialogVersionBetter09b+0xf7>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" ,.-\00"
@.str.1 = [30 x i8] c" ,.-abcdefghijklmnopqrstuvxyz\00"
define i32 @isDialogVersionBetter09b() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [128 x i8]
%11 = call i8* (...) @dialogNameOnly()
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %0
%16 = load i8*, i8** %2
%17 = call i64 @getVersion(i8* %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %3
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %15, %0
store i32 0, i32* %1
br label %68
21: ; preds = %15
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%23 = load i8*, i8** %3
%24 = call i32 @strcpy(i8* %22, i8* %23)
%25 = load i8*, i8** %3
%26 = call i8* @strtok(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %4
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i8* %28, i8** %8
%29 = load i8*, i8** %8
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %5
%31 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %21
%36 = load i32, i32* %6
%37 = sub nsw i32 0, %36
store i32 %37, i32* %6
br label %38
38: ; preds = %35, %21
%39 = load i8*, i8** %8
%40 = load i8*, i8** %8
%41 = call i32 @strlen(i8* %40)
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
store i8* %43, i8** %9
%44 = load i8*, i8** %3
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%46 = call i32 @strcpy(i8* %44, i8* %45)
%47 = load i8*, i8** %9
%48 = call i8* @strtok(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%49 = load i32, i32* %4
%50 = icmp sgt i32 %49, 0
br i1 %50, label %64, label %51
51: ; preds = %38
%52 = load i32, i32* %5
%53 = icmp eq i32 %52, 9
br i1 %53, label %54, label %62
54: ; preds = %51
%55 = load i8*, i8** %9
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 98
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = load i32, i32* %6
%61 = icmp sge i32 %60, 20031126
br label %62
62: ; preds = %59, %54, %51
%63 = phi i1 [ false, %54 ], [ false, %51 ], [ %61, %59 ]
br label %64
64: ; preds = %62, %38
%65 = phi i1 [ true, %38 ], [ %63, %62 ]
%66 = zext i1 %65 to i32
store i32 %66, i32* %7
%67 = load i32, i32* %7
store i32 %67, i32* %1
br label %68
68: ; preds = %64, %20
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
@.str = [5 x i8] c" ,.-\00"
@.str.1 = [30 x i8] c" ,.-abcdefghijklmnopqrstuvxyz\00"
define i32 @isDialogVersionBetter09b() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i8* (...) @dialogNameOnly()
%4 = tail call i32 @strlen(i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %33, label %6
6: ; preds = %0
%7 = tail call i64 @getVersion(i8* %3)
%8 = inttoptr i64 %7 to i8*
%9 = icmp eq i64 %7, 0
br i1 %9, label %33, label %10
10: ; preds = %6
%11 = call i32 @strcpy(i8* %2, i8* %8)
%12 = call i8* @strtok(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @atoi(i8* %12)
%14 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @atoi(i8* %14)
%16 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @atoi(i8* %16)
%18 = call i32 @llvm.abs.i32(i32 %17, i1 true)
%19 = call i32 @strlen(i8* %14)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %14, i64 %20
%22 = call i32 @strcpy(i8* %8, i8* %2)
%23 = call i8* @strtok(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%24 = icmp sgt i32 %13, 0
br i1 %24, label %33, label %25
25: ; preds = %10
%26 = icmp eq i32 %15, 9
br i1 %26, label %27, label %33
27: ; preds = %25
%28 = load i8, i8* %21
%29 = icmp eq i8 %28, 98
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = icmp ugt i32 %18, 20031125
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %10, %30, %27, %25, %0, %6
%34 = phi i32 [ 0, %6 ], [ 0, %0 ], [ 1, %10 ], [ 0, %27 ], [ 0, %25 ], [ %32, %30 ]
ret i32 %34
}