// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_cday.c
// Function: selftest
static void selftest( void )
{
    BLM_INIT();

    bcore_cday_ymd_s* ymd = BLM_CREATE( bcore_cday_ymd_s );

    for( s2_t cday = 0; cday < 60000; cday++ )
    {
        bcore_cday_ymd_s_from_cday( ymd, cday );
        ASSERT( cday == bcore_cday_ymd_s_to_cday( ymd ) );
    }

    st_s* string = BLM_CREATE( st_s );

    bcore_cday_to_string( 0, string );
    ASSERT( st_s_equal_sc( string, "1900-03-01" ) );

    bcore_cday_to_string( 73048, string );
    ASSERT( st_s_equal_sc( string, "2100-02-28" ) );

    bcore_cday_ymd_s_from_sc( ymd, "2018-05-04" );
    bcore_cday_ymd_s_to_string( ymd, string );
    ASSERT( st_s_equal_sc( string, "2018-05-04" ) );

    bcore_cday_ymd_s_from_sc( ymd, "2012-12-29" );
    bcore_cday_ymd_s_to_string( ymd, string );
    ASSERT( st_s_equal_sc( string, "2012-12-29" ) );

    //bcore_msg_fa( "#<s2_t>\n", bcore_cday_from_sc( "1970-01-01" ) );

    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2019-11-26" ) ) == 48 );
    ASSERT( bcore_cday_to_wday( bcore_cday_from_sc( "2019-11-26" ) ) ==  1 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "1969-06-11" ) ) == 24 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2012-01-01" ) ) == 52 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2012-12-31" ) ) ==  1 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2020-12-31" ) ) == 53 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2027-01-01" ) ) == 53 );
    ASSERT( bcore_cday_to_wnum( bcore_cday_from_sc( "2027-01-09" ) ) ==  1 );

    bcore_cday_utc_s* utc1 = BLM_CREATE( bcore_cday_utc_s );
    bcore_cday_utc_s* utc2 = BLM_CREATE( bcore_cday_utc_s );
    bcore_cday_utc_s_from_system( utc1 );
    bcore_cday_utc_s_to_string( utc1, string );
    bcore_cday_utc_s_from_string( utc2, string );
    ASSERT( bcore_cday_utc_s_diff_ms( utc2, utc1 ) == 0 );

    bcore_cday_utc_s_from_sc( utc1, "2027-01-09T09:07:23Z" );
    ASSERT( utc1->ms == ( 9 * 3600 + 7 * 60 + 23 ) * 1000 );

    //bcore_sink_a_push_fa( BCORE_STDOUT, "#<sc_t>\n", string->sc );

    BLM_DOWN();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0x11674e(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x8(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xbfe80
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movb $0x0, %al
callq 0x47fb0
movq -0x70(%rbp), %rdi
movq %rax, %rdx
movabsq $0x925c4b71ad1263d, %rsi # imm = 0x925C4B71AD1263D
callq 0xc00e0
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
cmpl $0xea60, -0x4c(%rbp)    # imm = 0xEA60
jge 0x9bc99
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x9ae20
movl -0x4c(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9b1f0
movl %eax, %ecx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
je 0x9bc8c
leaq 0x97d35(%rip), %rdi     # 0x13399f
leaq 0xb1564(%rip), %rsi     # 0x14d1d5
leaq 0xba465(%rip), %rdx     # 0x1560dd
leaq 0xb1316(%rip), %rcx     # 0x14cf95
movl $0x1aa, %r8d            # imm = 0x1AA
movb $0x0, %al
callq 0x9cea0
jmp 0x9bc8e
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x9bc36
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movb $0x0, %al
callq 0xff2e0
movq -0x80(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
callq 0xc00e0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
xorl %edi, %edi
callq 0x9b6f0
movq -0x58(%rbp), %rdi
leaq 0xb1525(%rip), %rsi     # 0x14d1fd
callq 0x9c5f0
testb $0x1, %al
jne 0x9bd0a
leaq 0x97cb7(%rip), %rdi     # 0x13399f
leaq 0xb1519(%rip), %rsi     # 0x14d208
leaq 0xba3e7(%rip), %rdx     # 0x1560dd
leaq 0xb1298(%rip), %rcx     # 0x14cf95
movl $0x1b0, %r8d            # imm = 0x1B0
movb $0x0, %al
callq 0x9cea0
movq -0x58(%rbp), %rsi
movl $0x11d58, %edi          # imm = 0x11D58
callq 0x9b6f0
movq -0x58(%rbp), %rdi
leaq 0xb150b(%rip), %rsi     # 0x14d22e
callq 0x9c5f0
testb $0x1, %al
jne 0x9bd55
leaq 0x97c6c(%rip), %rdi     # 0x13399f
leaq 0xb14ff(%rip), %rsi     # 0x14d239
leaq 0xba39c(%rip), %rdx     # 0x1560dd
leaq 0xb124d(%rip), %rcx     # 0x14cf95
movl $0x1b3, %r8d            # imm = 0x1B3
movb $0x0, %al
callq 0x9cea0
movq -0x48(%rbp), %rdi
leaq 0xb14ff(%rip), %rsi     # 0x14d25f
callq 0x9b190
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x9b3b0
movq -0x58(%rbp), %rdi
leaq 0xb14e2(%rip), %rsi     # 0x14d25f
callq 0x9c5f0
testb $0x1, %al
jne 0x9bdaf
leaq 0x97c12(%rip), %rdi     # 0x13399f
leaq 0xb14d6(%rip), %rsi     # 0x14d26a
leaq 0xba342(%rip), %rdx     # 0x1560dd
leaq 0xb11f3(%rip), %rcx     # 0x14cf95
movl $0x1b7, %r8d            # imm = 0x1B7
movb $0x0, %al
callq 0x9cea0
movq -0x48(%rbp), %rdi
leaq 0xb14d6(%rip), %rsi     # 0x14d290
callq 0x9b190
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x9b3b0
movq -0x58(%rbp), %rdi
leaq 0xb14b9(%rip), %rsi     # 0x14d290
callq 0x9c5f0
testb $0x1, %al
jne 0x9be09
leaq 0x97bb8(%rip), %rdi     # 0x13399f
leaq 0xb14ad(%rip), %rsi     # 0x14d29b
leaq 0xba2e8(%rip), %rdx     # 0x1560dd
leaq 0xb1199(%rip), %rcx     # 0x14cf95
movl $0x1bb, %r8d            # imm = 0x1BB
movb $0x0, %al
callq 0x9cea0
leaq 0xb14b1(%rip), %rdi     # 0x14d2c1
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x30, %eax
je 0x9be4a
leaq 0x97b77(%rip), %rdi     # 0x13399f
leaq 0xb149d(%rip), %rsi     # 0x14d2cc
leaq 0xba2a7(%rip), %rdx     # 0x1560dd
leaq 0xb1158(%rip), %rcx     # 0x14cf95
movl $0x1bf, %r8d            # imm = 0x1BF
movb $0x0, %al
callq 0x9cea0
leaq 0xb1470(%rip), %rdi     # 0x14d2c1
callq 0x9b720
movl %eax, %edi
callq 0x9b410
cmpl $0x1, %eax
je 0x9be8b
leaq 0x97b36(%rip), %rdi     # 0x13399f
leaq 0xb149b(%rip), %rsi     # 0x14d30b
leaq 0xba266(%rip), %rdx     # 0x1560dd
leaq 0xb1117(%rip), %rcx     # 0x14cf95
movl $0x1c0, %r8d            # imm = 0x1C0
movb $0x0, %al
callq 0x9cea0
leaq 0xb14b7(%rip), %rdi     # 0x14d349
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x18, %eax
je 0x9becc
leaq 0x97af5(%rip), %rdi     # 0x13399f
leaq 0xb14a3(%rip), %rsi     # 0x14d354
leaq 0xba225(%rip), %rdx     # 0x1560dd
leaq 0xb10d6(%rip), %rcx     # 0x14cf95
movl $0x1c1, %r8d            # imm = 0x1C1
movb $0x0, %al
callq 0x9cea0
leaq 0xb14c0(%rip), %rdi     # 0x14d393
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x34, %eax
je 0x9bf0d
leaq 0x97ab4(%rip), %rdi     # 0x13399f
leaq 0xb14ac(%rip), %rsi     # 0x14d39e
leaq 0xba1e4(%rip), %rdx     # 0x1560dd
leaq 0xb1095(%rip), %rcx     # 0x14cf95
movl $0x1c2, %r8d            # imm = 0x1C2
movb $0x0, %al
callq 0x9cea0
leaq 0xb14c9(%rip), %rdi     # 0x14d3dd
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x1, %eax
je 0x9bf4e
leaq 0x97a73(%rip), %rdi     # 0x13399f
leaq 0xb14b5(%rip), %rsi     # 0x14d3e8
leaq 0xba1a3(%rip), %rdx     # 0x1560dd
leaq 0xb1054(%rip), %rcx     # 0x14cf95
movl $0x1c3, %r8d            # imm = 0x1C3
movb $0x0, %al
callq 0x9cea0
leaq 0xb14d1(%rip), %rdi     # 0x14d426
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x35, %eax
je 0x9bf8f
leaq 0x97a32(%rip), %rdi     # 0x13399f
leaq 0xb14bd(%rip), %rsi     # 0x14d431
leaq 0xba162(%rip), %rdx     # 0x1560dd
leaq 0xb1013(%rip), %rcx     # 0x14cf95
movl $0x1c4, %r8d            # imm = 0x1C4
movb $0x0, %al
callq 0x9cea0
leaq 0xb14da(%rip), %rdi     # 0x14d470
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x35, %eax
je 0x9bfd0
leaq 0x979f1(%rip), %rdi     # 0x13399f
leaq 0xb14c6(%rip), %rsi     # 0x14d47b
leaq 0xba121(%rip), %rdx     # 0x1560dd
leaq 0xb0fd2(%rip), %rcx     # 0x14cf95
movl $0x1c5, %r8d            # imm = 0x1C5
movb $0x0, %al
callq 0x9cea0
leaq 0xb14e3(%rip), %rdi     # 0x14d4ba
callq 0x9b720
movl %eax, %edi
callq 0x9b630
cmpl $0x1, %eax
je 0x9c011
leaq 0x979b0(%rip), %rdi     # 0x13399f
leaq 0xb14cf(%rip), %rsi     # 0x14d4c5
leaq 0xba0e0(%rip), %rdx     # 0x1560dd
leaq 0xb0f91(%rip), %rcx     # 0x14cf95
movl $0x1c6, %r8d            # imm = 0x1C6
movb $0x0, %al
callq 0x9cea0
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movb $0x0, %al
callq 0x480e0
movq -0x90(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x4c00d686e3307dff, %rsi # imm = 0xB3FF29791CCF8201
callq 0xc00e0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movb $0x0, %al
callq 0x480e0
movq -0x88(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x4c00d686e3307dff, %rsi # imm = 0xB3FF29791CCF8201
callq 0xc00e0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x9b7e0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x9b9a0
movq -0x68(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x9ba80
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x9bae0
cmpq $0x0, %rax
je 0x9c0ce
leaq 0x978f3(%rip), %rdi     # 0x13399f
leaq 0xb1450(%rip), %rsi     # 0x14d503
leaq 0xba023(%rip), %rdx     # 0x1560dd
leaq 0xb0ed4(%rip), %rcx     # 0x14cf95
movl $0x1cd, %r8d            # imm = 0x1CD
movb $0x0, %al
callq 0x9cea0
movq -0x60(%rbp), %rdi
leaq 0xb1456(%rip), %rsi     # 0x14d52f
callq 0x9ba50
movq -0x60(%rbp), %rax
cmpl $0x1f524f8, 0xc(%rax)   # imm = 0x1F524F8
je 0x9c114
leaq 0x978ad(%rip), %rdi     # 0x13399f
leaq 0xb144b(%rip), %rsi     # 0x14d544
leaq 0xb9fdd(%rip), %rdx     # 0x1560dd
leaq 0xb0e8e(%rip), %rcx     # 0x14cf95
movl $0x1d0, %r8d            # imm = 0x1D0
movb $0x0, %al
callq 0x9cea0
leaq -0x40(%rbp), %rdi
callq 0xc06e0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)