// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore_cday.c
// Function: bcore_cday_ymd_s_from_source
bcore_cday_ymd_s* bcore_cday_ymd_s_from_source( bcore_cday_ymd_s* o, bcore_source* source )
{
    char y[4] = { 0 };
    char m[2] = { 0 };
    char d[2] = { 0 };

    // We deliberately parse characters (rather than using direct integer conversions) in order to enforce the correct format.
    bcore_source_a_parse_fa( source, "#<char*>#<char*>#<char*>#<char*>-#<char*>#<char*>-#<char*>#<char*>", &y[0], &y[1], &y[2], &y[3], &m[0], &m[1], &d[0], &d[1] );

    for( sz_t i = 0; i < 4; i++ ) ASSERT( y[i] >= '0' && y[i] <= '9' );
    for( sz_t i = 0; i < 2; i++ ) ASSERT( m[i] >= '0' && m[i] <= '9' );
    for( sz_t i = 0; i < 2; i++ ) ASSERT( d[i] >= '0' && d[i] <= '9' );

    o->y = ( y[0] - '0' ) * 1000 + ( y[1] - '0' ) * 100 + ( y[2] - '0' ) * 10 + ( y[3] - '0' );
    o->m = ( m[0] - '0' ) * 10   + ( m[1] - '0' );
    o->d = ( d[0] - '0' ) * 10   + ( d[1] - '0' );

    bcore_cday_ymd_s_check_plausibility( o );

    return o;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, 0x10(%rsp)
leaq 0x9(%rsp), %rcx
movl $0x0, -0x1(%rcx)
xorl %edx, %edx
leaq 0xf(%rsp), %r11
movw %dx, -0x1(%r11)
leaq 0x7(%rsp), %r10
movw %dx, -0x1(%r10)
leaq 0xa(%rsp), %r8
leaq 0xb(%rsp), %r9
leaq 0x6(%rsp), %rbp
leaq 0xe(%rsp), %rbx
leaq 0x85b4a(%rip), %rsi     # 0x142e67
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
pushq %r10
pushq %rbp
movq %r11, %r15
pushq %r11
pushq %rbx
callq 0x100150
addq $0x20, %rsp
leaq 0x85b85(%rip), %r12     # 0x142ec5
leaq 0x85aba(%rip), %r13     # 0x142e01
xorl %r14d, %r14d
movb 0x8(%rsp,%r14), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xbd376
leaq 0x702eb(%rip), %rdi     # 0x12d647
leaq 0x85b47(%rip), %rsi     # 0x142eaa
movq %r12, %rdx
movq %r13, %rcx
movl $0x58, %r8d
xorl %eax, %eax
callq 0xbe4ef
incq %r14
cmpq $0x4, %r14
jne 0xbd34a
movb $0x1, %r14b
leaq 0x85b3c(%rip), %r12     # 0x142ec5
leaq 0x85a71(%rip), %r13     # 0x142e01
movb (%rbx), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xbd3b9
leaq 0x702a8(%rip), %rdi     # 0x12d647
leaq 0x85b3c(%rip), %rsi     # 0x142ee2
movq %r12, %rdx
movq %r13, %rcx
movl $0x59, %r8d
xorl %eax, %eax
callq 0xbe4ef
movq %r15, %rbx
testb $0x1, %r14b
movl $0x0, %r14d
jne 0xbd390
movb $0x1, %bl
leaq 0x70276(%rip), %r14     # 0x12d647
leaq 0x85b25(%rip), %r15     # 0x142efd
leaq 0x85ae6(%rip), %r12     # 0x142ec5
leaq 0x85a1b(%rip), %r13     # 0x142e01
movb (%rbp), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xbd408
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x5a, %r8d
xorl %eax, %eax
callq 0xbe4ef
leaq 0x7(%rsp), %rbp
testb $0x1, %bl
movl $0x0, %ebx
jne 0xbd3e6
movsbl 0x8(%rsp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movsbl 0x9(%rsp), %ecx
imull $0x64, %ecx, %ecx
addl %eax, %ecx
movsbl 0xa(%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0xb(%rsp), %edx
leal (%rcx,%rax,2), %eax
leal -0xd050(%rdx,%rax), %eax
movq 0x10(%rsp), %rbx
movl %eax, 0x8(%rbx)
movsbl 0xe(%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0xf(%rsp), %ecx
leal (%rcx,%rax,2), %eax
movl $0xfffffdf0, %ecx       # imm = 0xFFFFFDF0
addl %ecx, %eax
movl %eax, 0xc(%rbx)
movsbl 0x6(%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0x7(%rsp), %edx
leal (%rdx,%rax,2), %eax
addl %ecx, %eax
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0xbceb0
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq