// File: /workspace/github_c_makefile_star2_O2/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
leaq 0xd(%rsp), %rcx
andl $0x0, -0x1(%rcx)
leaq 0xb(%rsp), %r10
andw $0x0, -0x1(%r10)
leaq 0x9(%rsp), %r11
andw $0x0, -0x1(%r11)
movq %rsi, %rax
movq %rdi, 0x10(%rsp)
leaq 0xe(%rsp), %r8
leaq 0xf(%rsp), %r9
leaq 0x8(%rsp), %rbx
leaq 0xa(%rsp), %r14
leaq 0x61e1f(%rip), %rsi     # 0xc0bf7
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
pushq %r14
callq 0x88fce
addq $0x20, %rsp
leaq 0x4b84e(%rip), %r14     # 0xaa647
leaq 0x61e3a(%rip), %r15     # 0xc0c3a
leaq 0x61e4e(%rip), %r12     # 0xc0c55
leaq 0x61d83(%rip), %r13     # 0xc0b91
pushq $0x58
popq %rbp
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x5ee3e
movb 0xc(%rsp,%rbx), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0x5ee39
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5ffac
incq %rbx
jmp 0x5ee13
leaq 0x4b802(%rip), %r14     # 0xaa647
leaq 0x61e26(%rip), %r15     # 0xc0c72
leaq 0x61e02(%rip), %r12     # 0xc0c55
leaq 0x61d37(%rip), %r13     # 0xc0b91
pushq $0x59
popq %rbp
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x5ee8a
movb 0xa(%rsp,%rbx), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0x5ee85
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5ffac
incq %rbx
jmp 0x5ee5f
leaq 0x4b7b6(%rip), %r14     # 0xaa647
leaq 0x61df5(%rip), %r15     # 0xc0c8d
leaq 0x61db6(%rip), %r12     # 0xc0c55
leaq 0x61ceb(%rip), %r13     # 0xc0b91
pushq $0x5a
popq %rbp
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x5eed6
movb 0x8(%rsp,%rbx), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0x5eed1
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5ffac
incq %rbx
jmp 0x5eeab
movsbl 0xc(%rsp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movsbl 0xd(%rsp), %ecx
imull $0x64, %ecx, %ecx
addl %eax, %ecx
movsbl 0xe(%rsp), %eax
imull $0xa, %eax, %eax
addl %ecx, %eax
movsbl 0xf(%rsp), %ecx
addl %ecx, %eax
addl $0xffff2fb0, %eax       # imm = 0xFFFF2FB0
movq 0x10(%rsp), %rbx
movl %eax, 0x8(%rbx)
movsbl 0xa(%rsp), %eax
imull $0xa, %eax, %eax
movsbl 0xb(%rsp), %ecx
movl $0xfffffdf0, %edx       # imm = 0xFFFFFDF0
addl %edx, %ecx
addl %eax, %ecx
movl %ecx, 0xc(%rbx)
movsbl 0x8(%rsp), %eax
imull $0xa, %eax, %eax
movsbl 0x9(%rsp), %ecx
addl %edx, %ecx
addl %eax, %ecx
movl %ecx, 0x10(%rbx)
movq %rbx, %rdi
callq 0x5e9c4
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq