#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 *);
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 (!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)
cmpq   $0x0,-0x10(%rbp)
je     1198 <isDialogVersionBetter09b+0x38>
mov    -0x10(%rbp),%rdi
call   1080 <getVersion@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11a4 <isDialogVersionBetter09b+0x44>
movl   $0x0,-0x4(%rbp)
jmp    12cf <isDialogVersionBetter09b+0x16f>
lea    -0xc0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe2b(%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    0xe06(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    121c <isDialogVersionBetter09b+0xbc>
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    0xda2(%rip),%rsi
call   1060 <strtok@plt>
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0xc1(%rbp)
jg     12bb <isDialogVersionBetter09b+0x15b>
xor    %eax,%eax
cmpl   $0x9,-0x20(%rbp)
mov    %al,-0xd1(%rbp)
jne    12af <isDialogVersionBetter09b+0x14f>
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x62,%ecx
mov    %al,-0xd1(%rbp)
jne    12af <isDialogVersionBetter09b+0x14f>
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>
test   %rax,%rax
je     124d <isDialogVersionBetter09b+0xed>
mov    %rax,%rdi
call   1080 <getVersion@plt>
test   %rax,%rax
je     124d <isDialogVersionBetter09b+0xed>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xe55(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
lea    0xe3d(%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,%r12d
neg    %r12d
cmovs  %eax,%r12d
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   %r13d,%r13d
jg     124d <isDialogVersionBetter09b+0xed>
cmpl   $0x9,0xc(%rsp)
jne    124b <isDialogVersionBetter09b+0xeb>
cmpb   $0x62,(%r14)
mov    $0x0,%ebp
jne    124d <isDialogVersionBetter09b+0xed>
xor    %ebp,%ebp
cmp    $0x131a696,%r12d
setae  %bpl
jmp    124d <isDialogVersionBetter09b+0xed>
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 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = load i8*, i8** %2
%16 = call i64 @getVersion(i8* %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %3
%18 = icmp ne i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %14, %0
store i32 0, i32* %1
br label %67
20: ; preds = %14
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%22 = load i8*, i8** %3
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %3
%25 = call i8* @strtok(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %4
%27 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i8* %27, i8** %8
%28 = load i8*, i8** %8
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %5
%30 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %6
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %20
%35 = load i32, i32* %6
%36 = sub nsw i32 0, %35
store i32 %36, i32* %6
br label %37
37: ; preds = %34, %20
%38 = load i8*, i8** %8
%39 = load i8*, i8** %8
%40 = call i32 @strlen(i8* %39)
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8* %42, i8** %9
%43 = load i8*, i8** %3
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%45 = call i32 @strcpy(i8* %43, i8* %44)
%46 = load i8*, i8** %9
%47 = call i8* @strtok(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%48 = load i32, i32* %4
%49 = icmp sgt i32 %48, 0
br i1 %49, label %63, label %50
50: ; preds = %37
%51 = load i32, i32* %5
%52 = icmp eq i32 %51, 9
br i1 %52, label %53, label %61
53: ; preds = %50
%54 = load i8*, i8** %9
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 98
br i1 %57, label %58, label %61
58: ; preds = %53
%59 = load i32, i32* %6
%60 = icmp sge i32 %59, 20031126
br label %61
61: ; preds = %58, %53, %50
%62 = phi i1 [ false, %53 ], [ false, %50 ], [ %60, %58 ]
br label %63
63: ; preds = %61, %37
%64 = phi i1 [ true, %37 ], [ %62, %61 ]
%65 = zext i1 %64 to i32
store i32 %65, i32* %7
%66 = load i32, i32* %7
store i32 %66, i32* %1
br label %67
67: ; preds = %63, %19
%68 = load i32, i32* %1
ret i32 %68
}

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 = icmp eq i8* %3, null
br i1 %4, label %32, label %5
5: ; preds = %0
%6 = tail call i64 @getVersion(i8* %3)
%7 = inttoptr i64 %6 to i8*
%8 = icmp eq i64 %6, 0
br i1 %8, label %32, label %9
9: ; preds = %5
%10 = call i32 @strcpy(i8* %2, i8* %7)
%11 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @atoi(i8* %11)
%13 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @atoi(i8* %13)
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @atoi(i8* %15)
%17 = call i32 @llvm.abs.i32(i32 %16, i1 true)
%18 = call i32 @strlen(i8* %13)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %13, i64 %19
%21 = call i32 @strcpy(i8* %7, i8* %2)
%22 = call i8* @strtok(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%23 = icmp sgt i32 %12, 0
br i1 %23, label %32, label %24
24: ; preds = %9
%25 = icmp eq i32 %14, 9
br i1 %25, label %26, label %32
26: ; preds = %24
%27 = load i8, i8* %20
%28 = icmp eq i8 %27, 98
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = icmp ugt i32 %17, 20031125
%31 = zext i1 %30 to i32
br label %32
32: ; preds = %9, %29, %26, %24, %0, %5
%33 = phi i32 [ 0, %5 ], [ 0, %0 ], [ 1, %9 ], [ 0, %26 ], [ 0, %24 ], [ %31, %29 ]
ret i32 %33
}