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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmpq   $0x0,0x8(%rsi)
  je     L121
  cmpq   $0x0,0x10(%rsi)
  mov    %rsi,%rbx
  je     L121
  cmpq   $0x0,0x18(%rsi)
  je     L121
  cmpq   $0x0,0x20(%rsi)
  je     L121
  xor    %eax,%eax
  call   <OpenSSL_add_all_algorithms@plt>
  mov    0x8(%rbx),%rdi
  lea    D52(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L82
  lea    D108(%rip),%rdi
  mov    0x18(%rbx),%rbp
  mov    0x20(%rbx),%r12
  call   <printf@plt>
  mov    0x10(%rbx),%rdi
  lea    0x4(%rsp),%rdx
  lea    D0(%rip),%rsi
  movl   $0x0,0x4(%rsp)
  call   <sscanf@plt>
  mov    0x4(%rsp),%edi
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <genkey@plt>
  xor    %eax,%eax
  jmp    L29
L121:
  lea    D74(%rip),%rdi
  call   <printf@plt>
  lea    D64(%rip),%rdi
  call   <printf@plt>
  lea    D53(%rip),%rdi
  call   <printf@plt>
  lea    D27(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L29:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L82:
  mov    0x8(%rbx),%rdi
  lea    D45(%rip),%rsi
  mov    $0x2,%r14d
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L80
L107:
  mov    0x18(%rbx),%rbp
  mov    0x20(%rbx),%r12
  mov    0x10(%rbx),%r13
  cmp    $0x2,%r14d
  je     L9
  lea    D56(%rip),%rdi
  call   <printf@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <decrypt@plt>
  xor    %eax,%eax
  jmp    L29
L9:
  lea    D107(%rip),%rdi
  call   <printf@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <encrypt@plt>
  xor    %eax,%eax
  jmp    L29
L80:
  mov    0x8(%rbx),%rdi
  lea    D20(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L107
  mov    $0x3,%r14d
  jmp    L107
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D52
type: string
name: unpack_data
arguments: tag: D108
type: string
name: unpack_data
arguments: tag: D0
type: string
name: unpack_data
arguments: tag: D74
type: string
name: unpack_data
arguments: tag: D64
type: string
name: unpack_data
arguments: tag: D53
type: string
name: unpack_data
arguments: tag: D27
type: string
name: unpack_data
arguments: tag: D45
type: string
name: unpack_data
arguments: tag: D56
type: string
name: unpack_data
arguments: tag: D107
type: string
name: unpack_data
arguments: tag: D20
type: string

tool: D52: genkey

tool: D108: Start generating private and public key pair ...


tool: D0: %d

tool: D74: Upss, something is wrong, check your parameters!


tool: D64: Correct format for key generation: genkey 2048 private.pem public.pem


tool: D53: Correct format for encryption: encrypt public.pem input encrypted


tool: D27: Correct format for decryption: decrypt private.pem encrypted decrypted


tool: D45: encrypt

tool: D56: Start decrypting ...


tool: D107: Start encrypting ...


tool: D20: decrypt

assistant: ```c
int main(int argc, char *argv[]) {
  if (argv[1] == NULL || argv[2] == NULL || argv[3] == NULL || argv[4] == NULL) {
    printf("Upss, something is wrong, check your parameters!\n");
    printf("Correct format for key generation: genkey 2048 private.pem public.pem\n");
    printf("Correct format for encryption: encrypt public.pem input encrypted\n");
    printf("Correct format for decryption: decrypt private.pem encrypted decrypted\n");
    return 1;
  }
  OpenSSL_add_all_algorithms();
  int mode;
  if (strcmp(argv[1], "genkey") == 0) {
    mode = 1;
  } else if (strcmp(argv[1], "encrypt") == 0) {
    mode = 2;
  } else if (strcmp(argv[1], "decrypt") == 0) {
    mode = 3;
  }
  char *inFile = argv[3];
  char *outFile = argv[4];
  if (mode == 1) {
    printf("Start generating private and public key pair ...\n");
    int keyLength = 0;
    sscanf(argv[2], "%d", &keyLength);
    genkey(keyLength, inFile, outFile);
    return 0;
  }
  char *keyFile = argv[2];
  if (mode == 2) {
    printf("Start encrypting ...\n");
    encrypt(keyFile, inFile, outFile);
    return 0;
  }
  if (mode == 3) {
    printf("Start decrypting ...\n");
    decrypt(keyFile, inFile, outFile);
    return 0;
  }
  return 1;
}
```