#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 check_days(char *, int, char *, int);
int check_month(char *, int, char *, int);
int check_year(char *, int, char *, int);
int length_of(char *);
int isOlder(char *dob1, char *dob2) {
  int len1, len2;
  int result = 0;
  len1 = length_of(dob1);
  len2 = length_of(dob2);
  result = check_year(dob1, len1, dob2, len2);
  if (result) {
    if (result > 0) {
      return result;
    } else
      return -1;
  } else {
    len1 = length_of(dob1);
    len2 = length_of(dob2);
    result = check_month(dob1, len1, dob2, len2);
    if (result) {
      if (result > 0) {
        return result;
      } else
        return -1;
    } else {
      len1 = length_of(dob1);
      len2 = length_of(dob2);
      result = check_days(dob1, len1, dob2, len2);
      if (result) {
        if (result > 0) {
          return result;
        } else if (result < 0)
          return -1;
        else {
          return 0;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<isOlder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
call   1040 <check_year@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11b0 <isOlder+0x70>
cmpl   $0x0,-0x24(%rbp)
jle    11a4 <isOlder+0x64>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
movl   $0xffffffff,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
mov    -0x10(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
call   1030 <check_month@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1209 <isOlder+0xc9>
cmpl   $0x0,-0x24(%rbp)
jle    11fd <isOlder+0xbd>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
movl   $0xffffffff,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
mov    -0x10(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <length_of@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
call   1060 <check_days@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1278 <isOlder+0x138>
cmpl   $0x0,-0x24(%rbp)
jle    1256 <isOlder+0x116>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
cmpl   $0x0,-0x24(%rbp)
jge    126c <isOlder+0x12c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
movl   $0x0,-0x4(%rbp)
jmp    1282 <isOlder+0x142>
jmp    127d <isOlder+0x13d>
jmp    1282 <isOlder+0x142>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOlder>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <length_of@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <length_of@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <check_year@plt>
test   %eax,%eax
jne    11b6 <isOlder+0x76>
mov    %rbx,%rdi
call   1050 <length_of@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <length_of@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1030 <check_month@plt>
test   %eax,%eax
jne    11b6 <isOlder+0x76>
mov    %rbx,%rdi
call   1050 <length_of@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <length_of@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1060 <check_days@plt>
test   %eax,%eax
je     11c5 <isOlder+0x85>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmovg  %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
jmp    11c0 <isOlder+0x80>

LLVM IR (-O0):
define i32 @isOlder(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = call i32 @length_of(i8* %9)
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = call i32 @length_of(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = load i8*, i8** %5
%16 = load i32, i32* %7
%17 = call i32 @check_year(i8* %13, i32 %14, i8* %15, i32 %16)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i32, i32* %8
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32, i32* %8
store i32 %24, i32* %3
br label %68
25: ; preds = %20
store i32 -1, i32* %3
br label %68
26: ; preds = %2
%27 = load i8*, i8** %4
%28 = call i32 @length_of(i8* %27)
store i32 %28, i32* %6
%29 = load i8*, i8** %5
%30 = call i32 @length_of(i8* %29)
store i32 %30, i32* %7
%31 = load i8*, i8** %4
%32 = load i32, i32* %6
%33 = load i8*, i8** %5
%34 = load i32, i32* %7
%35 = call i32 @check_month(i8* %31, i32 %32, i8* %33, i32 %34)
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %26
%39 = load i32, i32* %8
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* %8
store i32 %42, i32* %3
br label %68
43: ; preds = %38
store i32 -1, i32* %3
br label %68
44: ; preds = %26
%45 = load i8*, i8** %4
%46 = call i32 @length_of(i8* %45)
store i32 %46, i32* %6
%47 = load i8*, i8** %5
%48 = call i32 @length_of(i8* %47)
store i32 %48, i32* %7
%49 = load i8*, i8** %4
%50 = load i32, i32* %6
%51 = load i8*, i8** %5
%52 = load i32, i32* %7
%53 = call i32 @check_days(i8* %49, i32 %50, i8* %51, i32 %52)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %66
56: ; preds = %44
%57 = load i32, i32* %8
%58 = icmp sgt i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = load i32, i32* %8
store i32 %60, i32* %3
br label %68
61: ; preds = %56
%62 = load i32, i32* %8
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %61
store i32 -1, i32* %3
br label %68
65: ; preds = %61
store i32 0, i32* %3
br label %68
66: ; preds = %44
br label %67
67: ; preds = %66
br label %68
68: ; preds = %23, %25, %41, %43, %59, %64, %65, %67
%69 = load i32, i32* %3
ret i32 %69
}

LLVM IR (-O2):
define i32 @isOlder(i8* %0, i8* %1) {
%3 = tail call i32 @length_of(i8* %0)
%4 = tail call i32 @length_of(i8* %1)
%5 = tail call i32 @check_year(i8* %0, i32 %3, i8* %1, i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = icmp sgt i32 %5, 0
%9 = select i1 %8, i32 %5, i32 -1
br label %26
10: ; preds = %2
%11 = tail call i32 @length_of(i8* %0)
%12 = tail call i32 @length_of(i8* %1)
%13 = tail call i32 @check_month(i8* %0, i32 %11, i8* %1, i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = icmp sgt i32 %13, 0
%17 = select i1 %16, i32 %13, i32 -1
br label %26
18: ; preds = %10
%19 = tail call i32 @length_of(i8* %0)
%20 = tail call i32 @length_of(i8* %1)
%21 = tail call i32 @check_days(i8* %0, i32 %19, i8* %1, i32 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %18
%24 = icmp sgt i32 %21, 0
%25 = select i1 %24, i32 %21, i32 -1
br label %26
26: ; preds = %23, %18, %15, %7
%27 = phi i32 [ %9, %7 ], [ %17, %15 ], [ undef, %18 ], [ %25, %23 ]
ret i32 %27
}