user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  cmp    $0x4,%edi
  jne    L42
  mov    %rsi,%r13
  mov    0x10(%rsi),%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jle    L89
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L101
  mov    %ebp,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    0x10(%r13),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  mov    0x18(%r13),%rdi
  call   <strlen@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  jle    L27
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L62
  mov    %r14d,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    0x18(%r13),%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rdx
  mov    %r14d,%ecx
  lea    (%rbx,%rcx,1),%r8
  jmp    L74
L42:
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L89:
  lea    D62(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L101:
  lea    D21(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L27:
  lea    D49(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L62:
  lea    D21(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L158
L156:
  lea    D19(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
L158:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L119:
  add    $0x1,%rdx
  cmp    %r8,%rdx
  je     L17
L74:
  movzbl (%rdx),%eax
  lea    -0x5b(%rax),%esi
  cmp    $0x5,%sil
  jbe    L156
  lea    -0x41(%rax),%esi
  cmp    $0x39,%sil
  ja     L156
  lea    -0x61(%rax),%esi
  cmp    $0x19,%sil
  ja     L119
  sub    $0x20,%eax
  mov    %al,(%rdx)
  jmp    L119
L17:
  mov    0x8(%r13),%rax
  cmpb   $0x64,0x1(%rax)
  setne  %dil
  movzbl %dil,%edi
  lea    -0x1(%rdi,%rdi,1),%edi
  mov    $0x0,%esi
L175:
  mov    %esi,%eax
  cltd
  idiv   %ebp
  movslq %edx,%rdx
  movsbl (%r12,%rdx,1),%eax
  sub    $0x41,%eax
  imul   %edi,%eax
  movsbl (%rbx,%rsi,1),%edx
  lea    -0x41(%rax,%rdx,1),%edx
  movslq %edx,%rax
  imul   $0x4ec4ec4f,%rax,%rax
  sar    $0x23,%rax
  mov    %edx,%r8d
  sar    $0x1f,%r8d
  sub    %r8d,%eax
  imul   $0x1a,%eax,%r8d
  mov    %edx,%eax
  sub    %r8d,%eax
  lea    0x1a(%rax),%edx
  cmovs  %edx,%eax
  add    $0x41,%eax
  mov    %al,(%rbx,%rsi,1)
  add    $0x1,%rsi
  cmp    %rcx,%rsi
  jne    L175
  mov    0x10(%r13),%rdx
  mov    0x18(%r13),%rsi
  mov    %rbx,%rcx
  lea    D68(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L158
```

tool_calls: name: unpack_data
arguments: data_label: D3
type_infered: string
name: unpack_data
arguments: data_label: D62
type_infered: string
name: unpack_data
arguments: data_label: D21
type_infered: string
name: unpack_data
arguments: data_label: D49
type_infered: string
name: unpack_data
arguments: data_label: D19
type_infered: string
name: unpack_data
arguments: data_label: D68
type_infered: string

tool: D3: Usage: vigenere -d[ecrypt]|-e[ncrypt] <Key> <Message>

tool: D62: Please provide a valid key.

tool: D21: Malloc failed. Please make sure enough memory is available.

tool: D49: Please provide a valid message.

tool: D19: Message does not contain valid characters!

tool: D68: Input: %s
Key: %s
Output:%s


assistant: ```c
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("Usage: vigenere -d[ecrypt]|-e[ncrypt] <Key> <Message>\r\n");
    return -1;
  }
  int key_len = strlen(argv[2]);
  if (key_len <= 0) {
    printf("Please provide a valid key.\r\n");
    return -1;
  }
  char *key = malloc(sizeof(char) * key_len);
  if (!key) {
    printf("Malloc failed. Please make sure enough memory is available.\r\n");
    return -1;
  }
  memset(key, 0, key_len);
  strcpy(key, argv[2]);
  int len = strlen(argv[3]);
  if (len <= 0) {
    printf("Please provide a valid message.\r\n");
    return -1;
  }
  char *input = malloc(sizeof(char) * len);
  if (!input) {
    printf("Malloc failed. Please make sure enough memory is available.\r\n");
    return -1;
  }
  memset(input, 0, len);
  strcpy(input, argv[3]);
  int y;
  for (y = 0; y < len; y++) {
    if (input[y] < 65 || (input[y] > 90 && input[y] < 97) || (input[y] > 122)) {
      printf("Message does not contain valid characters!\r\n");
      return -1;
    }
    if (input[y] >= 97 && input[y] <= 122)
      input[y] = input[y] - 32;
  }
  int x;
  int modifier = (argv[1][1] == 'd' ? -1 : 1);
  int val = 0;
  for (x = 0; x < len; x++) {
    val = (((input[x] - 65) + (modifier * (key[x % key_len] - 65))) % 26);
    while (val < 0)
      val += 26;
    input[x] = val + 65;
  }
  printf("Input: %s\r\nKey: %s\r\nOutput:%s\r\n", argv[3], argv[2], input);
  free(key);
  free(input);
}
```