// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x5(%rsp), %rcx
movl $0x0, -0x1(%rcx)
xorl %edx, %edx
leaq 0x3(%rsp), %r10
movw %dx, -0x1(%r10)
leaq 0x1(%rsp), %r11
movw %dx, -0x1(%r11)
leaq 0x6(%rsp), %r8
leaq 0x7(%rsp), %r9
movq %rsp, %r14
leaq 0x2(%rsp), %r15
leaq 0x86f9f(%rip), %rsi     # 0x14de27
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
pushq %r11
pushq %r14
pushq %r10
pushq %r15
callq 0x10ad37
addq $0x20, %rsp
leaq 0x7179d(%rip), %r14     # 0x138647
leaq 0x86fb9(%rip), %r15     # 0x14de6a
leaq 0x86fcd(%rip), %r12     # 0x14de85
leaq 0x86f02(%rip), %r13     # 0x14ddc1
xorl %ebp, %ebp
movb 0x4(%rsp,%rbp), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xc6ee4
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x58, %r8d
xorl %eax, %eax
callq 0xc8053
incq %rbp
cmpq $0x4, %rbp
jne 0xc6ec1
leaq 0x71753(%rip), %r14     # 0x138647
leaq 0x86fa7(%rip), %r15     # 0x14dea2
leaq 0x86f83(%rip), %r12     # 0x14de85
leaq 0x86eb8(%rip), %r13     # 0x14ddc1
xorl %ebp, %ebp
movb 0x2(%rsp,%rbp), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xc6f2e
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x59, %r8d
xorl %eax, %eax
callq 0xc8053
incq %rbp
cmpq $0x1, %rbp
je 0xc6f0b
leaq 0x71709(%rip), %r14     # 0x138647
leaq 0x86f78(%rip), %r15     # 0x14debd
leaq 0x86f39(%rip), %r12     # 0x14de85
leaq 0x86e6e(%rip), %r13     # 0x14ddc1
xorl %ebp, %ebp
movb (%rsp,%rbp), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0xc6f77
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x5a, %r8d
xorl %eax, %eax
callq 0xc8053
incq %rbp
cmpq $0x1, %rbp
je 0xc6f55
movsbl 0x4(%rsp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movsbl 0x5(%rsp), %ecx
imull $0x64, %ecx, %ecx
addl %eax, %ecx
movsbl 0x6(%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0x7(%rsp), %edx
leal (%rcx,%rax,2), %eax
leal -0xd050(%rdx,%rax), %eax
movl %eax, 0x8(%rbx)
movsbl 0x2(%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0x3(%rsp), %ecx
leal (%rcx,%rax,2), %eax
movl $0xfffffdf0, %ecx       # imm = 0xFFFFFDF0
addl %ecx, %eax
movl %eax, 0xc(%rbx)
movsbl (%rsp), %eax
leal (%rax,%rax,4), %eax
movsbl 0x1(%rsp), %edx
leal (%rdx,%rax,2), %eax
addl %ecx, %eax
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0xc6a30
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq