user: Please show me the C implementation that matches the assembly code listed below:

```asm
<juliam_KP>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmpb   $0x2e,(%rdi)
  sete   %r13b
  movzbl %r13b,%r13d
  lea    0x2(%rdi,%r13,1),%rsi
  lea    0x13(%rsp),%rbp
  mov    $0x4,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x17(%rsp)
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <atol@plt>
  movslq %eax,%rbx
  lea    0x6(%r12,%r13,1),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x15(%rsp)
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <atol@plt>
  mov    %eax,%r14d
  lea    0x8(%r12,%r13,1),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x15(%rsp)
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <atol@plt>
  mov    %eax,0xc(%rsp)
  lea    0xa(%r12,%r13,1),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x15(%rsp)
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <atol@plt>
  movslq %eax,%r15
  lea    0xc(%r12,%r13,1),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x15(%rsp)
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <atol@plt>
  movslq %eax,%rdi
  movslq 0xc(%rsp),%rdx
  test   %rdx,%rdx
  mov    $0x1,%eax
  cmovle %rax,%rdx
  lea    (%rbx,%rbx,8),%rax
  lea    (%rbx,%rax,8),%rax
  lea    (%rax,%rax,4),%rsi
  movslq %r14d,%rax
  test   %rax,%rax
  mov    $0x1,%ecx
  cmovle %rcx,%rax
  movswq %ax,%rax
  lea    D2(%rip),%rcx
  add    (%rcx,%rax,8),%rdx
  mov    %rdx,%r8
  lea    0x3(%rbx),%r9
  test   %rbx,%rbx
  cmovns %rbx,%r9
  sar    $0x2,%r9
  movabs $0xa3d70a3d70a3d70b,%rdx
  mov    %rbx,%rax
  imul   %rdx
  lea    (%rdx,%rbx,1),%rcx
  sar    $0x6,%rcx
  mov    %rbx,%r10
  sar    $0x3f,%r10
  sub    %r10,%rcx
  movabs $0x20c49ba5e353f7cf,%rdx
  mov    %rbx,%rax
  imul   %rdx
  sar    $0x7,%rdx
  sub    %r10,%rdx
  mov    %r9,%r10
  sub    %rcx,%r10
  add    %rdx,%r10
  shl    $0x2,%r9
  cmp    %rbx,%r9
  je     L29
L5:
  lea    (%rsi,%r8,1),%rax
  add    %r10,%rax
  lea    (%rax,%rax,2),%rax
  lea    (%r15,%rax,8),%rdx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  lea    (%rdi,%rax,4),%rax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L39
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L29:
  lea    (%rcx,%rcx,4),%rax
  lea    (%rax,%rax,4),%rax
  shl    $0x2,%rax
  cmp    %rbx,%rax
  je     L46
L64:
  cmp    $0x2,%r14d
  jg     L5
  sub    $0x1,%r10
  jmp    L5
L46:
  imul   $0x3e8,%rdx,%rdx
  cmp    %rbx,%rdx
  jne    L5
  jmp    L64
L39:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D2
type_guessed: string

tool: 

assistant: ```c
long int juliam_KP(filename)
char *filename;
{
  static long kmo[13] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  long leap = 1;
  long ky;
  long km;
  long kd;
  long temp;
  long l = 0;
  long kl;
  long ky4;
  long ky1;
  long ky0;
  long khour;
  long kmin;
  char temp_str[5];
  int pos;
  if (filename[0] == '.') {
    pos = 1;
  } else {
    pos = 0;
  }
  strncpy(temp_str, filename + 2 + pos, 4);
  temp_str[4] = 0;
  ky = atol(temp_str);
  strncpy(temp_str, filename + 6 + pos, 2);
  temp_str[2] = 0;
  km = atol(temp_str);
  strncpy(temp_str, filename + 8 + pos, 2);
  temp_str[2] = 0;
  kd = atol(temp_str);
  strncpy(temp_str, filename + 10 + pos, 2);
  temp_str[2] = 0;
  khour = atol(temp_str);
  strncpy(temp_str, filename + 12 + pos, 2);
  temp_str[2] = 0;
  kmin = atol(temp_str);
  if (km <= 0)
    km = 1;
  if (kd <= 0)
    kd = 1;
  temp = 365 * ky;
  kd = kmo[(short)km] + kd;
  ky4 = ky / 4;
  ky1 = ky / 100;
  ky0 = ky / 1000;
  kl = leap * (ky4 - ky1 + ky0);
  if (((ky4 * 4) == ky) && (((ky1 * 100) != ky) || ((ky0 * 1000) == ky)))
    l = leap;
  if ((l != 0) && (km < 3))
    kl = kl - leap;
  temp = temp + kd + kl;
  temp = temp * 24 + khour;
  temp = temp * 60 + kmin;
  return (temp);
}
```