#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 memcmp(unsigned char *, ...);
int /*<<< orphan*/ memcpy(unsigned char *, ...);
int iCompDate6(unsigned char *pszDate1, unsigned char *pszDate2) {
  unsigned char szDate1[8], szDate2[8];
  memcpy(szDate1 + 2, pszDate1, 6);
  if (memcmp(pszDate1, "49", 2) <= 0)
    memcpy(szDate1, "20", 2);
  else
    memcpy(szDate1, "19", 2);
  memcpy(szDate2 + 2, pszDate2, 6);
  if (memcmp(pszDate2, "49", 2) <= 0)
    memcpy(szDate2, "20", 2);
  else
    memcpy(szDate2, "19", 2);
  return (memcmp(szDate1, szDate2, 8));
}


x86 assembly (clang, -O0):
<iCompDate6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
add    $0x2,%rdi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    $0x6,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jg     1184 <iCompDate6+0x64>
lea    -0x18(%rbp),%rdi
lea    0xe90(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1040 <memcpy@plt>
jmp    119b <iCompDate6+0x7b>
lea    -0x18(%rbp),%rdi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x20(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    $0x6,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe42(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jg     11ef <iCompDate6+0xcf>
lea    -0x20(%rbp),%rdi
lea    0xe25(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1040 <memcpy@plt>
jmp    1206 <iCompDate6+0xe6>
lea    -0x20(%rbp),%rdi
lea    0xe0c(%rip),%rsi
xor    %eax,%eax
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iCompDate6>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xa(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <memcpy@plt>
lea    0xeb2(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <memcmp@plt>
test   %eax,%eax
lea    0xe9a(%rip),%r13
lea    0xe96(%rip),%rbx
mov    %rbx,%rsi
cmovle %r13,%rsi
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <memcpy@plt>
lea    0x2(%rsp),%rdi
mov    %r15,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <memcpy@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <memcmp@plt>
test   %eax,%eax
cmovle %r13,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <memcmp@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"49\00"
@.str.1 = [3 x i8] c"20\00"
@.str.2 = [3 x i8] c"19\00"
define i32 @iCompDate6(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [8 x i8]
%6 = alloca [8 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8*, i8** %3
%10 = call i32 (i8*, ...) @memcpy(i8* %8, i8* %9, i32 6)
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) @memcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%13 = icmp sle i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%16 = call i32 (i8*, ...) @memcpy(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %20
17: ; preds = %2
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%19 = call i32 (i8*, ...) @memcpy(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
br label %20
20: ; preds = %17, %14
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8*, i8** %4
%24 = call i32 (i8*, ...) @memcpy(i8* %22, i8* %23, i32 6)
%25 = load i8*, i8** %4
%26 = call i32 (i8*, ...) @memcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%27 = icmp sle i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%30 = call i32 (i8*, ...) @memcpy(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %34
31: ; preds = %20
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @memcpy(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
br label %34
34: ; preds = %31, %28
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%37 = call i32 (i8*, ...) @memcmp(i8* %35, i8* %36, i32 8)
ret i32 %37
}

LLVM IR (-O2):
@.str = [3 x i8] c"49\00"
@.str.1 = [3 x i8] c"20\00"
@.str.2 = [3 x i8] c"19\00"
define i32 @iCompDate6(i8* %0, i8* %1) {
%3 = alloca [8 x i8]
%4 = alloca [8 x i8]
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 2
%8 = call i32 (i8*, ...) @memcpy(i8* %7, i8* %0, i32 6)
%9 = call i32 (i8*, ...) @memcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp slt i32 %9, 1
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%12 = call i32 (i8*, ...) @memcpy(i8* %5, i8* %11, i32 2)
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
%14 = call i32 (i8*, ...) @memcpy(i8* %13, i8* %1, i32 6)
%15 = call i32 (i8*, ...) @memcmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%16 = icmp slt i32 %15, 1
%17 = select i1 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%18 = call i32 (i8*, ...) @memcpy(i8* %6, i8* %17, i32 2)
%19 = call i32 (i8*, ...) @memcmp(i8* %5, i8* %6, i32 8)
ret i32 %19
}