#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
float difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ parse_date(char *, struct tm *);
int /*<<< orphan*/ printf(char *, char *, char, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  float diff;
  char *date1;
  char *date2;
  struct tm tm1;
  struct tm tm2;
  time_t time1;
  time_t time2;
  if (argc != 3) {
    fprintf(stderr, "usage: compare-date date1 date2\n");
    exit(1);
  }
  date1 = argv[1];
  date2 = argv[2];
  if (!parse_date(date1, &tm1)) {
    fprintf(stderr, "unsupported date: %s\n", date1);
    exit(1);
  }
  if (!parse_date(date2, &tm1)) {
    fprintf(stderr, "unsupported date: %s\n", date2);
    exit(1);
  }
  time1 = mktime(&tm1);
  time2 = mktime(&tm2);
  diff = difftime(time1, time2);
  printf("%s %c %s\n", date1, (diff < 0 ? '<' : (diff > 0 ? '>' : '==')),
         date2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11a1 <main+0x41>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <parse_date@plt>
cmp    $0x0,%eax
jne    11f4 <main+0x94>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <parse_date@plt>
cmp    $0x0,%eax
jne    122f <main+0xcf>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x30(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,-0x3c(%rbp)
lea    -0x38(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1050 <difftime@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1279 <main+0x119>
mov    $0x3c,%eax
mov    %eax,-0x4c(%rbp)
jmp    1294 <main+0x134>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0x3d3d,%eax
mov    $0x3e,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%eax
mov    -0x28(%rbp),%rcx
lea    0xd91(%rip),%rdi
movsbl %al,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jne    11f5 <main+0x95>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <parse_date@plt>
test   %eax,%eax
je     1216 <main+0xb6>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <parse_date@plt>
test   %eax,%eax
je     122b <main+0xcb>
mov    %rsp,%rdi
call   1070 <mktime@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rdi
call   1070 <mktime@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <difftime@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
add    $0x3d,%al
ucomiss %xmm0,%xmm1
movzbl %al,%eax
mov    $0x3c,%ecx
cmovbe %eax,%ecx
movzbl %cl,%edx
lea    0xe58(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%rip),%rsi
mov    %rbx,%rdx
jmp    123e <main+0xde>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [33 x i8] c"usage: compare-date date1 date2\0A\00"
@.str.1 = [22 x i8] c"unsupported date: %s\0A\00"
@.str.2 = [10 x i8] c"%s %c %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.tm
%10 = alloca %struct.tm
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
store i8* %25, i8** %8
%26 = load i8*, i8** %7
%27 = call i32 @parse_date(i8* %26, %struct.tm* %9)
%28 = icmp ne i32 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %19
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %7
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %19
%35 = load i8*, i8** %8
%36 = call i32 @parse_date(i8* %35, %struct.tm* %9)
%37 = icmp ne i32 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %34
%39 = load i32, i32* @stderr
%40 = load i8*, i8** %8
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %34
%44 = call i32 @mktime(%struct.tm* %9)
store i32 %44, i32* %11
%45 = call i32 @mktime(%struct.tm* %10)
store i32 %45, i32* %12
%46 = load i32, i32* %11
%47 = load i32, i32* %12
%48 = call float @difftime(i32 %46, i32 %47)
store float %48, float* %6
%49 = load i8*, i8** %7
%50 = load float, float* %6
%51 = fcmp olt float %50, 0.000000e+00
br i1 %51, label %52, label %53
52: ; preds = %43
br label %58
53: ; preds = %43
%54 = load float, float* %6
%55 = fcmp ogt float %54, 0.000000e+00
%56 = zext i1 %55 to i64
%57 = select i1 %55, i32 62, i32 15677
br label %58
58: ; preds = %53, %52
%59 = phi i32 [ 60, %52 ], [ %57, %53 ]
%60 = trunc i32 %59 to i8
%61 = load i8*, i8** %8
%62 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %49, i8 signext %60, i8* %61)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [33 x i8] c"usage: compare-date date1 date2\0A\00"
@.str.1 = [22 x i8] c"unsupported date: %s\0A\00"
@.str.2 = [10 x i8] c"%s %c %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = bitcast %struct.tm* %3 to i8*
%6 = bitcast %struct.tm* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @parse_date(i8* %14, %struct.tm* %3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %12
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %12
%24 = call i32 @parse_date(i8* %16, %struct.tm* %3)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %23
%31 = call i32 @mktime(%struct.tm* %3)
%32 = call i32 @mktime(%struct.tm* %4)
%33 = call float @difftime(i32 %31, i32 %32)
%34 = fcmp olt float %33, 0.000000e+00
%35 = fcmp ogt float %33, 0.000000e+00
%36 = select i1 %35, i8 62, i8 61
%37 = select i1 %34, i8 60, i8 %36
%38 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8 signext %37, i8* %16)
ret i32 0
}