#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 */
long add_a_day(long);
int /*<<< orphan*/ assert(int);
long date_to_long(int, int, int);
int get_day_of_week(long);
int is_valid_date(long);
int /*<<< orphan*/ long_to_date(long, int *, int *, int *);
long subtract_a_day(long);
void date_tester() {
  int i;
  long l;
  assert(is_valid_date(20070101));
  assert(is_valid_date(20080202));
  assert(is_valid_date(20090303));
  assert(is_valid_date(20100404));
  assert(is_valid_date(20110505));
  assert(is_valid_date(20121212));
  assert(!is_valid_date(20071301));
  assert(!is_valid_date(20071232));
  assert(!is_valid_date(20081232));
  assert(!is_valid_date(20110030));
  assert(!is_valid_date(20070631));
  assert(!is_valid_date(20071131));
  assert(!is_valid_date(20070431));
  assert(!is_valid_date(20290631));
  assert(!is_valid_date(99990931));
  assert(!is_valid_date(59990931));
  assert(is_valid_date(20080229));
  assert(!is_valid_date(20090229));
  assert(!is_valid_date(20100229));
  assert(!is_valid_date(20110229));
  assert(is_valid_date(20120229));
  assert(!is_valid_date(23000229));
  assert(is_valid_date(24000229));
  assert(get_day_of_week(20070611) == 1);
  assert(get_day_of_week(20070612) == 2);
  assert(get_day_of_week(20070610) == 0);
  assert(get_day_of_week(20070613) == 3);
  assert(get_day_of_week(20080101) == 2);
  assert(get_day_of_week(20080229) == 5);
  assert(get_day_of_week(20080125) == 5);
  assert(add_a_day(20071231) == 20080101);
  assert(subtract_a_day(20080101) == 20071231);
  for (l = 20070101; l < 23991230; l = add_a_day(l))
    assert(subtract_a_day(add_a_day(l)) == l);
  for (l = 99070101; l < 99991230; l = add_a_day(l))
    assert(add_a_day(subtract_a_day(l)) == l);
  l = 20070101;
  for (i = 0; i < 366 * 2000; ++i) {
    int dow1 = get_day_of_week(l);
    l = add_a_day(l);
    assert(is_valid_date(l));
    int dow2 = get_day_of_week(l);
    assert((dow1 + 1) % 7 == dow2 % 7);
    int y, m, d;
    long_to_date(l, &y, &m, &d);
    assert(l == date_to_long(y, m, d));
  }
  for (i = 0; i < 366 * 2000; ++i) {
    int dow1 = get_day_of_week(l);
    l = subtract_a_day(l);
    int dow2 = get_day_of_week(l);
    assert((dow2 + 1) % 7 == dow1 % 7);
  }
  int y2, m2, d2;
  long_to_date(l, &y2, &m2, &d2);
  assert(y2 == 2007);
  assert(m2 == 1);
  assert(d2 == 1);
}


x86 assembly (clang, -O0):
<date_tester>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0x1323ed5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132664a,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1328dbf,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132b534,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132dca9,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x133067c,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1324385,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x1324340,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x1326a50,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x132dace,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13240e7,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13242db,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x132401f,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x1359c47,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x5f5bd93,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x3936393,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x1326665,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1328d75,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x132b485,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x132db95,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13302a5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x15ef4a5,%edi
call   1050 <is_valid_date@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x16e36e5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x13240d3,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13240d4,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13240d2,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13240d5,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13265e5,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x1326665,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13265fd,%edi
call   1090 <get_day_of_week@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x132433f,%edi
call   1030 <add_a_day@plt>
cmp    $0x13265e5,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x13265e5,%edi
call   1040 <subtract_a_day@plt>
cmp    $0x132433f,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movq   $0x1323ed5,-0x10(%rbp)
01
cmpq   $0x16e13be,-0x10(%rbp)
01
jge    14d3 <date_tester+0x363>
mov    -0x10(%rbp),%rdi
call   1030 <add_a_day@plt>
mov    %rax,%rdi
call   1040 <subtract_a_day@plt>
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <add_a_day@plt>
mov    %rax,-0x10(%rbp)
jmp    1491 <date_tester+0x321>
movq   $0x5e7b095,-0x10(%rbp)
05
cmpq   $0x5f5bebe,-0x10(%rbp)
05
jge    151d <date_tester+0x3ad>
mov    -0x10(%rbp),%rdi
call   1040 <subtract_a_day@plt>
mov    %rax,%rdi
call   1030 <add_a_day@plt>
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <add_a_day@plt>
mov    %rax,-0x10(%rbp)
jmp    14db <date_tester+0x36b>
movq   $0x1323ed5,-0x10(%rbp)
01
movl   $0x0,-0x4(%rbp)
cmpl   $0xb2b60,-0x4(%rbp)
jge    15ee <date_tester+0x47e>
mov    -0x10(%rbp),%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <add_a_day@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x44(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x44(%rbp),%edx
cmp    %eax,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1070 <long_to_date@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1080 <date_to_long@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    152c <date_tester+0x3bc>
movl   $0x0,-0x4(%rbp)
cmpl   $0xb2b60,-0x4(%rbp)
jge    1665 <date_tester+0x4f5>
mov    -0x10(%rbp),%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <subtract_a_day@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x48(%rbp)
mov    -0x28(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x48(%rbp),%edx
cmp    %eax,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15f5 <date_tester+0x485>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   1070 <long_to_date@plt>
cmpl   $0x7d7,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpl   $0x1,-0x38(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_tester>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1323ed5,%ebx
mov    $0x1323ed5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132664a,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1328dbf,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132b534,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x132dca9,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x133067c,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1324385,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x1324340,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x1326a50,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x132dace,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13240e7,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13242db,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x132401f,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x1359c47,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x5f5bd93,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x3936393,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x1326665,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x1328d75,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x132b485,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x132db95,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13302a5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x15ef4a5,%edi
call   1050 <is_valid_date@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x16e36e5,%edi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    $0x13240d3,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13240d4,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13240d2,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13240d5,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13265e5,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x1326665,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x13265fd,%edi
call   1090 <get_day_of_week@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1060 <assert@plt>
mov    $0x132433f,%edi
call   1030 <add_a_day@plt>
xor    %edi,%edi
cmp    $0x13265e5,%rax
sete   %dil
call   1060 <assert@plt>
mov    $0x13265e5,%edi
call   1040 <subtract_a_day@plt>
xor    %edi,%edi
cmp    $0x132433f,%rax
sete   %dil
call   1060 <assert@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <add_a_day@plt>
mov    %rax,%rdi
call   1040 <subtract_a_day@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <add_a_day@plt>
mov    %rax,%rbx
cmp    $0x16e13be,%rax
jl     1440 <date_tester+0x2d0>
mov    $0x5e7b095,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <subtract_a_day@plt>
mov    %rax,%rdi
call   1030 <add_a_day@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <add_a_day@plt>
mov    %rax,%rbx
cmp    $0x5f5bebe,%rax
jl     1480 <date_tester+0x310>
mov    $0x1323ed5,%ebx
mov    $0xb2b60,%ebp
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   1030 <add_a_day@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <is_valid_date@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1090 <get_day_of_week@plt>
mov    %r13d,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %r13d,%ecx
add    $0x1,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %r13d,%ecx
add    $0x1,%ecx
cltq
imul   $0xffffffff92492493,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x2,%edx
add    %esi,%edx
lea    0x0(,%rdx,8),%esi
sub    %esi,%edx
add    %eax,%edx
xor    %edi,%edi
cmp    %edx,%ecx
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1070 <long_to_date@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1080 <date_to_long@plt>
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1060 <assert@plt>
add    $0xffffffff,%ebp
jne    14d0 <date_tester+0x360>
mov    $0xb2b60,%ebp
nop
mov    %rbx,%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1040 <subtract_a_day@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <get_day_of_week@plt>
mov    %eax,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %ecx,%eax
add    $0x1,%eax
movslq %r14d,%rcx
imul   $0xffffffff92492493,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x2,%edx
add    %esi,%edx
lea    0x0(,%rdx,8),%esi
sub    %esi,%edx
add    %ecx,%edx
xor    %edi,%edi
cmp    %edx,%eax
sete   %dil
call   1060 <assert@plt>
add    $0xffffffff,%ebp
jne    15a0 <date_tester+0x430>
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
call   1070 <long_to_date@plt>
xor    %edi,%edi
cmpl   $0x7d7,0x14(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x10(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0xc(%rsp)
sete   %dil
call   1060 <assert@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @date_tester() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = call i32 @is_valid_date(i64 20070101)
%14 = call i32 @assert(i32 %13)
%15 = call i32 @is_valid_date(i64 20080202)
%16 = call i32 @assert(i32 %15)
%17 = call i32 @is_valid_date(i64 20090303)
%18 = call i32 @assert(i32 %17)
%19 = call i32 @is_valid_date(i64 20100404)
%20 = call i32 @assert(i32 %19)
%21 = call i32 @is_valid_date(i64 20110505)
%22 = call i32 @assert(i32 %21)
%23 = call i32 @is_valid_date(i64 20121212)
%24 = call i32 @assert(i32 %23)
%25 = call i32 @is_valid_date(i64 20071301)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = call i32 @is_valid_date(i64 20071232)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = call i32 @is_valid_date(i64 20081232)
%36 = icmp ne i32 %35, 0
%37 = xor i1 %36, true
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32 @is_valid_date(i64 20110030)
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = call i32 @is_valid_date(i64 20070631)
%46 = icmp ne i32 %45, 0
%47 = xor i1 %46, true
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = call i32 @is_valid_date(i64 20071131)
%51 = icmp ne i32 %50, 0
%52 = xor i1 %51, true
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = call i32 @is_valid_date(i64 20070431)
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = call i32 @is_valid_date(i64 20290631)
%61 = icmp ne i32 %60, 0
%62 = xor i1 %61, true
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = call i32 @is_valid_date(i64 99990931)
%66 = icmp ne i32 %65, 0
%67 = xor i1 %66, true
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = call i32 @is_valid_date(i64 59990931)
%71 = icmp ne i32 %70, 0
%72 = xor i1 %71, true
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = call i32 @is_valid_date(i64 20080229)
%76 = call i32 @assert(i32 %75)
%77 = call i32 @is_valid_date(i64 20090229)
%78 = icmp ne i32 %77, 0
%79 = xor i1 %78, true
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = call i32 @is_valid_date(i64 20100229)
%83 = icmp ne i32 %82, 0
%84 = xor i1 %83, true
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = call i32 @is_valid_date(i64 20110229)
%88 = icmp ne i32 %87, 0
%89 = xor i1 %88, true
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = call i32 @is_valid_date(i64 20120229)
%93 = call i32 @assert(i32 %92)
%94 = call i32 @is_valid_date(i64 23000229)
%95 = icmp ne i32 %94, 0
%96 = xor i1 %95, true
%97 = zext i1 %96 to i32
%98 = call i32 @assert(i32 %97)
%99 = call i32 @is_valid_date(i64 24000229)
%100 = call i32 @assert(i32 %99)
%101 = call i32 @get_day_of_week(i64 20070611)
%102 = icmp eq i32 %101, 1
%103 = zext i1 %102 to i32
%104 = call i32 @assert(i32 %103)
%105 = call i32 @get_day_of_week(i64 20070612)
%106 = icmp eq i32 %105, 2
%107 = zext i1 %106 to i32
%108 = call i32 @assert(i32 %107)
%109 = call i32 @get_day_of_week(i64 20070610)
%110 = icmp eq i32 %109, 0
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
%113 = call i32 @get_day_of_week(i64 20070613)
%114 = icmp eq i32 %113, 3
%115 = zext i1 %114 to i32
%116 = call i32 @assert(i32 %115)
%117 = call i32 @get_day_of_week(i64 20080101)
%118 = icmp eq i32 %117, 2
%119 = zext i1 %118 to i32
%120 = call i32 @assert(i32 %119)
%121 = call i32 @get_day_of_week(i64 20080229)
%122 = icmp eq i32 %121, 5
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
%125 = call i32 @get_day_of_week(i64 20080125)
%126 = icmp eq i32 %125, 5
%127 = zext i1 %126 to i32
%128 = call i32 @assert(i32 %127)
%129 = call i64 @add_a_day(i64 20071231)
%130 = icmp eq i64 %129, 20080101
%131 = zext i1 %130 to i32
%132 = call i32 @assert(i32 %131)
%133 = call i64 @subtract_a_day(i64 20080101)
%134 = icmp eq i64 %133, 20071231
%135 = zext i1 %134 to i32
%136 = call i32 @assert(i32 %135)
store i64 20070101, i64* %2
br label %137
137: ; preds = %148, %0
%138 = load i64, i64* %2
%139 = icmp slt i64 %138, 23991230
br i1 %139, label %140, label %151
140: ; preds = %137
%141 = load i64, i64* %2
%142 = call i64 @add_a_day(i64 %141)
%143 = call i64 @subtract_a_day(i64 %142)
%144 = load i64, i64* %2
%145 = icmp eq i64 %143, %144
%146 = zext i1 %145 to i32
%147 = call i32 @assert(i32 %146)
br label %148
148: ; preds = %140
%149 = load i64, i64* %2
%150 = call i64 @add_a_day(i64 %149)
store i64 %150, i64* %2
br label %137
151: ; preds = %137
store i64 99070101, i64* %2
br label %152
152: ; preds = %163, %151
%153 = load i64, i64* %2
%154 = icmp slt i64 %153, 99991230
br i1 %154, label %155, label %166
155: ; preds = %152
%156 = load i64, i64* %2
%157 = call i64 @subtract_a_day(i64 %156)
%158 = call i64 @add_a_day(i64 %157)
%159 = load i64, i64* %2
%160 = icmp eq i64 %158, %159
%161 = zext i1 %160 to i32
%162 = call i32 @assert(i32 %161)
br label %163
163: ; preds = %155
%164 = load i64, i64* %2
%165 = call i64 @add_a_day(i64 %164)
store i64 %165, i64* %2
br label %152
166: ; preds = %152
store i64 20070101, i64* %2
store i32 0, i32* %1
br label %167
167: ; preds = %198, %166
%168 = load i32, i32* %1
%169 = icmp slt i32 %168, 732000
br i1 %169, label %170, label %201
170: ; preds = %167
%171 = load i64, i64* %2
%172 = call i32 @get_day_of_week(i64 %171)
store i32 %172, i32* %3
%173 = load i64, i64* %2
%174 = call i64 @add_a_day(i64 %173)
store i64 %174, i64* %2
%175 = load i64, i64* %2
%176 = call i32 @is_valid_date(i64 %175)
%177 = call i32 @assert(i32 %176)
%178 = load i64, i64* %2
%179 = call i32 @get_day_of_week(i64 %178)
store i32 %179, i32* %4
%180 = load i32, i32* %3
%181 = add nsw i32 %180, 1
%182 = srem i32 %181, 7
%183 = load i32, i32* %4
%184 = srem i32 %183, 7
%185 = icmp eq i32 %182, %184
%186 = zext i1 %185 to i32
%187 = call i32 @assert(i32 %186)
%188 = load i64, i64* %2
%189 = call i32 @long_to_date(i64 %188, i32* %5, i32* %6, i32* %7)
%190 = load i64, i64* %2
%191 = load i32, i32* %5
%192 = load i32, i32* %6
%193 = load i32, i32* %7
%194 = call i64 @date_to_long(i32 %191, i32 %192, i32 %193)
%195 = icmp eq i64 %190, %194
%196 = zext i1 %195 to i32
%197 = call i32 @assert(i32 %196)
br label %198
198: ; preds = %170
%199 = load i32, i32* %1
%200 = add nsw i32 %199, 1
store i32 %200, i32* %1
br label %167
201: ; preds = %167
store i32 0, i32* %1
br label %202
202: ; preds = %220, %201
%203 = load i32, i32* %1
%204 = icmp slt i32 %203, 732000
br i1 %204, label %205, label %223
205: ; preds = %202
%206 = load i64, i64* %2
%207 = call i32 @get_day_of_week(i64 %206)
store i32 %207, i32* %8
%208 = load i64, i64* %2
%209 = call i64 @subtract_a_day(i64 %208)
store i64 %209, i64* %2
%210 = load i64, i64* %2
%211 = call i32 @get_day_of_week(i64 %210)
store i32 %211, i32* %9
%212 = load i32, i32* %9
%213 = add nsw i32 %212, 1
%214 = srem i32 %213, 7
%215 = load i32, i32* %8
%216 = srem i32 %215, 7
%217 = icmp eq i32 %214, %216
%218 = zext i1 %217 to i32
%219 = call i32 @assert(i32 %218)
br label %220
220: ; preds = %205
%221 = load i32, i32* %1
%222 = add nsw i32 %221, 1
store i32 %222, i32* %1
br label %202
223: ; preds = %202
%224 = load i64, i64* %2
%225 = call i32 @long_to_date(i64 %224, i32* %10, i32* %11, i32* %12)
%226 = load i32, i32* %10
%227 = icmp eq i32 %226, 2007
%228 = zext i1 %227 to i32
%229 = call i32 @assert(i32 %228)
%230 = load i32, i32* %11
%231 = icmp eq i32 %230, 1
%232 = zext i1 %231 to i32
%233 = call i32 @assert(i32 %232)
%234 = load i32, i32* %12
%235 = icmp eq i32 %234, 1
%236 = zext i1 %235 to i32
%237 = call i32 @assert(i32 %236)
ret void
}

LLVM IR (-O2):
define void @date_tester() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = tail call i32 @is_valid_date(i64 20070101)
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @is_valid_date(i64 20080202)
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @is_valid_date(i64 20090303)
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @is_valid_date(i64 20100404)
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @is_valid_date(i64 20110505)
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @is_valid_date(i64 20121212)
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @is_valid_date(i64 20071301)
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @is_valid_date(i64 20071232)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @is_valid_date(i64 20081232)
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @is_valid_date(i64 20110030)
%32 = icmp eq i32 %31, 0
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call i32 @is_valid_date(i64 20070631)
%36 = icmp eq i32 %35, 0
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @is_valid_date(i64 20071131)
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @is_valid_date(i64 20070431)
%44 = icmp eq i32 %43, 0
%45 = zext i1 %44 to i32
%46 = tail call i32 @assert(i32 %45)
%47 = tail call i32 @is_valid_date(i64 20290631)
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = tail call i32 @assert(i32 %49)
%51 = tail call i32 @is_valid_date(i64 99990931)
%52 = icmp eq i32 %51, 0
%53 = zext i1 %52 to i32
%54 = tail call i32 @assert(i32 %53)
%55 = tail call i32 @is_valid_date(i64 59990931)
%56 = icmp eq i32 %55, 0
%57 = zext i1 %56 to i32
%58 = tail call i32 @assert(i32 %57)
%59 = tail call i32 @is_valid_date(i64 20080229)
%60 = tail call i32 @assert(i32 %59)
%61 = tail call i32 @is_valid_date(i64 20090229)
%62 = icmp eq i32 %61, 0
%63 = zext i1 %62 to i32
%64 = tail call i32 @assert(i32 %63)
%65 = tail call i32 @is_valid_date(i64 20100229)
%66 = icmp eq i32 %65, 0
%67 = zext i1 %66 to i32
%68 = tail call i32 @assert(i32 %67)
%69 = tail call i32 @is_valid_date(i64 20110229)
%70 = icmp eq i32 %69, 0
%71 = zext i1 %70 to i32
%72 = tail call i32 @assert(i32 %71)
%73 = tail call i32 @is_valid_date(i64 20120229)
%74 = tail call i32 @assert(i32 %73)
%75 = tail call i32 @is_valid_date(i64 23000229)
%76 = icmp eq i32 %75, 0
%77 = zext i1 %76 to i32
%78 = tail call i32 @assert(i32 %77)
%79 = tail call i32 @is_valid_date(i64 24000229)
%80 = tail call i32 @assert(i32 %79)
%81 = tail call i32 @get_day_of_week(i64 20070611)
%82 = icmp eq i32 %81, 1
%83 = zext i1 %82 to i32
%84 = tail call i32 @assert(i32 %83)
%85 = tail call i32 @get_day_of_week(i64 20070612)
%86 = icmp eq i32 %85, 2
%87 = zext i1 %86 to i32
%88 = tail call i32 @assert(i32 %87)
%89 = tail call i32 @get_day_of_week(i64 20070610)
%90 = icmp eq i32 %89, 0
%91 = zext i1 %90 to i32
%92 = tail call i32 @assert(i32 %91)
%93 = tail call i32 @get_day_of_week(i64 20070613)
%94 = icmp eq i32 %93, 3
%95 = zext i1 %94 to i32
%96 = tail call i32 @assert(i32 %95)
%97 = tail call i32 @get_day_of_week(i64 20080101)
%98 = icmp eq i32 %97, 2
%99 = zext i1 %98 to i32
%100 = tail call i32 @assert(i32 %99)
%101 = tail call i32 @get_day_of_week(i64 20080229)
%102 = icmp eq i32 %101, 5
%103 = zext i1 %102 to i32
%104 = tail call i32 @assert(i32 %103)
%105 = tail call i32 @get_day_of_week(i64 20080125)
%106 = icmp eq i32 %105, 5
%107 = zext i1 %106 to i32
%108 = tail call i32 @assert(i32 %107)
%109 = tail call i64 @add_a_day(i64 20071231)
%110 = icmp eq i64 %109, 20080101
%111 = zext i1 %110 to i32
%112 = tail call i32 @assert(i32 %111)
%113 = tail call i64 @subtract_a_day(i64 20080101)
%114 = icmp eq i64 %113, 20071231
%115 = zext i1 %114 to i32
%116 = tail call i32 @assert(i32 %115)
br label %117
117: ; preds = %0, %117
%118 = phi i64 [ 20070101, %0 ], [ %124, %117 ]
%119 = tail call i64 @add_a_day(i64 %118)
%120 = tail call i64 @subtract_a_day(i64 %119)
%121 = icmp eq i64 %120, %118
%122 = zext i1 %121 to i32
%123 = tail call i32 @assert(i32 %122)
%124 = tail call i64 @add_a_day(i64 %118)
%125 = icmp slt i64 %124, 23991230
br i1 %125, label %117, label %130
126: ; preds = %130
%127 = bitcast i32* %1 to i8*
%128 = bitcast i32* %2 to i8*
%129 = bitcast i32* %3 to i8*
br label %139
130: ; preds = %117, %130
%131 = phi i64 [ %137, %130 ], [ 99070101, %117 ]
%132 = tail call i64 @subtract_a_day(i64 %131)
%133 = tail call i64 @add_a_day(i64 %132)
%134 = icmp eq i64 %133, %131
%135 = zext i1 %134 to i32
%136 = tail call i32 @assert(i32 %135)
%137 = tail call i64 @add_a_day(i64 %131)
%138 = icmp slt i64 %137, 99991230
br i1 %138, label %130, label %126
139: ; preds = %126, %139
%140 = phi i32 [ 0, %126 ], [ %161, %139 ]
%141 = phi i64 [ 20070101, %126 ], [ %143, %139 ]
%142 = call i32 @get_day_of_week(i64 %141)
%143 = call i64 @add_a_day(i64 %141)
%144 = call i32 @is_valid_date(i64 %143)
%145 = call i32 @assert(i32 %144)
%146 = call i32 @get_day_of_week(i64 %143)
%147 = add nsw i32 %142, 1
%148 = srem i32 %147, 7
%149 = srem i32 %146, 7
%150 = icmp eq i32 %148, %149
%151 = zext i1 %150 to i32
%152 = call i32 @assert(i32 %151)
%153 = call i32 @long_to_date(i64 %143, i32* %1, i32* %2, i32* %3)
%154 = load i32, i32* %1
%155 = load i32, i32* %2
%156 = load i32, i32* %3
%157 = call i64 @date_to_long(i32 %154, i32 %155, i32 %156)
%158 = icmp eq i64 %143, %157
%159 = zext i1 %158 to i32
%160 = call i32 @assert(i32 %159)
%161 = add nuw nsw i32 %140, 1
%162 = icmp eq i32 %161, 732000
br i1 %162, label %163, label %139
163: ; preds = %139, %163
%164 = phi i32 [ %175, %163 ], [ 0, %139 ]
%165 = phi i64 [ %167, %163 ], [ %143, %139 ]
%166 = call i32 @get_day_of_week(i64 %165)
%167 = call i64 @subtract_a_day(i64 %165)
%168 = call i32 @get_day_of_week(i64 %167)
%169 = add nsw i32 %168, 1
%170 = srem i32 %169, 7
%171 = srem i32 %166, 7
%172 = icmp eq i32 %170, %171
%173 = zext i1 %172 to i32
%174 = call i32 @assert(i32 %173)
%175 = add nuw nsw i32 %164, 1
%176 = icmp eq i32 %175, 732000
br i1 %176, label %177, label %163
177: ; preds = %163
%178 = bitcast i32* %4 to i8*
%179 = bitcast i32* %5 to i8*
%180 = bitcast i32* %6 to i8*
%181 = call i32 @long_to_date(i64 %167, i32* %4, i32* %5, i32* %6)
%182 = load i32, i32* %4
%183 = icmp eq i32 %182, 2007
%184 = zext i1 %183 to i32
%185 = call i32 @assert(i32 %184)
%186 = load i32, i32* %5
%187 = icmp eq i32 %186, 1
%188 = zext i1 %187 to i32
%189 = call i32 @assert(i32 %188)
%190 = load i32, i32* %6
%191 = icmp eq i32 %190, 1
%192 = zext i1 %191 to i32
%193 = call i32 @assert(i32 %192)
ret void
}