user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x1,%ecx
  lea    D1(%rip),%rdx
  mov    $0x29,%esi
  call   <cal_sha1@plt>
  test   %rax,%rax
  jne    L50
  mov    %rsp,%rbx
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    D142(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L109
L50:
  lea    D93(%rip),%rdi
  call   <printf@plt>
L63:
  mov    %rsp,%rdi
  mov    $0x0,%ecx
  lea    D127(%rip),%rdx
  mov    $0x29,%esi
  call   <cal_sha1@plt>
  test   %rax,%rax
  jne    L68
  mov    %rsp,%rbx
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    D14(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L11
L68:
  lea    D7(%rip),%rdi
  call   <printf@plt>
L6:
  mov    %rsp,%rdi
  mov    $0x0,%ecx
  lea    D137(%rip),%rdx
  mov    $0x29,%esi
  call   <cal_sha1@plt>
  test   %rax,%rax
  jne    L69
  mov    %rsp,%rbx
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    D90(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L102
L69:
  lea    D123(%rip),%rdi
  call   <printf@plt>
L81:
  mov    %rsp,%rdi
  mov    $0x1,%ecx
  lea    D43(%rip),%rdx
  mov    $0x29,%esi
  call   <cal_sha1@plt>
  test   %rax,%rax
  jne    L20
  mov    %rsp,%rbx
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    D41(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L36
L20:
  lea    D97(%rip),%rdi
  call   <printf@plt>
L129:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  mov    $0x0,%eax
  add    $0x40,%rsp
  pop    %rbx
  ret
L109:
  lea    D106(%rip),%rdi
  call   <printf@plt>
  jmp    L63
L11:
  lea    D99(%rip),%rdi
  call   <printf@plt>
  jmp    L6
L102:
  lea    D32(%rip),%rdi
  call   <printf@plt>
  jmp    L81
L36:
  lea    D153(%rip),%rdi
  call   <printf@plt>
  jmp    L129
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D1
data_type: string
name: extract_symbolic_data
arguments: label: D142
data_type: string
name: extract_symbolic_data
arguments: label: D93
data_type: string
name: extract_symbolic_data
arguments: label: D127
data_type: string
name: extract_symbolic_data
arguments: label: D14
data_type: string
name: extract_symbolic_data
arguments: label: D7
data_type: string
name: extract_symbolic_data
arguments: label: D137
data_type: string
name: extract_symbolic_data
arguments: label: D90
data_type: string
name: extract_symbolic_data
arguments: label: D123
data_type: string
name: extract_symbolic_data
arguments: label: D43
data_type: string
name: extract_symbolic_data
arguments: label: D41
data_type: string
name: extract_symbolic_data
arguments: label: D97
data_type: string
name: extract_symbolic_data
arguments: label: D106
data_type: string
name: extract_symbolic_data
arguments: label: D99
data_type: string
name: extract_symbolic_data
arguments: label: D32
data_type: string
name: extract_symbolic_data
arguments: label: D153
data_type: string

tool: D1: abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz123

tool: D142: 5e8ea80e5c1f2debab393d2678b0279ae2089bc4

tool: D93: test 1 failed!


tool: D127: abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234

tool: D14: 70ED417BFA26AFF9BE6F6D7841197F29FE16A994

tool: D7: test 2 failed!


tool: D137: abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz12345

tool: D90: 413CB77D8DF41D00739F51D93A2507EFE1900C80

tool: D123: test 3 failed!


tool: 

tool: D41: da39a3ee5e6b4b0d3255bfef95601890afd80709

tool: D97: test 4 failed!


tool: D106: test 1 successful!


tool: D99: test 2 successful!


tool: D32: test 3 successful!


tool: D153: test 4 successful!


assistant: ```c
int main(void) {
  char result[41];
  int32_t ret = -1;
  ret = cal_sha1(result, sizeof(result), "abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz123", 1);
  if (ret == 0 && 0 == strncmp(result, "5e8ea80e5c1f2debab393d2678b0279ae2089bc4", strlen(result))) {
    printf("test 1 successful!\n");
  } else {
    printf("test 1 failed!\n");
  }
  ret = cal_sha1(result, sizeof(result), "abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234", 0);
  if (ret == 0 && 0 == strncmp(result, "70ED417BFA26AFF9BE6F6D7841197F29FE16A994", strlen(result))) {
    printf("test 2 successful!\n");
  } else {
    printf("test 2 failed!\n");
  }
  ret = cal_sha1(result, sizeof(result), "abcdegfhijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz12345", 0);
  if (ret == 0 && 0 == strncmp(result, "413CB77D8DF41D00739F51D93A2507EFE1900C80", strlen(result))) {
    printf("test 3 successful!\n");
  } else {
    printf("test 3 failed!\n");
  }
  ret = cal_sha1(result, sizeof(result), "", 1);
  if (ret == 0 && 0 == strncmp(result, "da39a3ee5e6b4b0d3255bfef95601890afd80709", strlen(result))) {
    printf("test 4 successful!\n");
  } else {
    printf("test 4 failed!\n");
  }
  return 0;
}
```