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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x140,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D148(%rip),%rax
  mov    %rax,-0x138(%rbp)
  lea    D113(%rip),%rax
  mov    %rax,-0x130(%rbp)
  lea    D149(%rip),%rax
  mov    %rax,-0x128(%rbp)
  lea    D58(%rip),%rax
  mov    %rax,-0x120(%rbp)
  lea    D18(%rip),%rax
  mov    %rax,-0x118(%rbp)
  lea    D118(%rip),%rax
  mov    %rax,-0x110(%rbp)
  movabs $0x1222708819f90846,%rax
  mov    %rax,-0x108(%rbp)
  movabs $0x26c2060c86231778,%rax
  mov    %rax,-0x100(%rbp)
  movabs $0xb04970cb4052790b,%rax
  movabs $0xb4f80323eb3191c,%rdx
  mov    %rax,-0xf0(%rbp)
  mov    %rdx,-0xe8(%rbp)
  movabs $0xd76c39412a34b946,%rax
  movabs $0xced7043180f56b38,%rdx
  mov    %rax,-0x60(%rbp)
  mov    %rdx,-0x58(%rbp)
  movabs $0xaf9b1332912b12dc,%rax
  movabs $0x4f5378e14ec9ed2e,%rdx
  mov    %rax,-0x50(%rbp)
  mov    %rdx,-0x48(%rbp)
  movabs $0x49744d075d232d2f,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x138(%rbp),%rcx
  lea    -0x80(%rbp),%rax
  mov    $0x9,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x80(%rbp),%rax
  add    $0x9,%rax
  mov    -0x130(%rbp),%rcx
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x80(%rbp),%rax
  add    $0xa,%rax
  mov    -0x128(%rbp),%rcx
  mov    $0x6,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x80(%rbp),%rax
  add    $0x10,%rax
  mov    -0x120(%rbp),%rcx
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x80(%rbp),%rax
  add    $0x11,%rax
  mov    -0x118(%rbp),%rcx
  mov    $0x6,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x80(%rbp),%rax
  add    $0x17,%rax
  mov    -0x110(%rbp),%rcx
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0xd0(%rbp),%rdx
  lea    -0xe0(%rbp),%rcx
  lea    -0x80(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mrtd_bac_kmrz_to_kenc_kmac@plt>
  lea    -0xe0(%rbp),%rax
  mov    $0x10,%edx
  mov    %rax,%rsi
  lea    D111(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0xd0(%rbp),%rax
  mov    $0x10,%edx
  mov    %rax,%rsi
  lea    D146(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0x30(%rbp),%r8
  lea    -0xd0(%rbp),%rdi
  lea    -0xe0(%rbp),%rcx
  lea    -0x108(%rbp),%rdx
  lea    -0xf0(%rbp),%rsi
  lea    -0x100(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <mrtd_bac_cmd_data@plt>
  lea    -0x30(%rbp),%rax
  mov    $0x28,%edx
  mov    %rax,%rsi
  lea    D103(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0xc0(%rbp),%rdi
  lea    -0xf8(%rbp),%rcx
  lea    -0x100(%rbp),%rdx
  lea    -0xe0(%rbp),%rsi
  lea    -0x60(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <mrtd_bac_challenge_ok@plt>
  test   %rax,%rax
  je     L38
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L11
L38:
  lea    D88(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L11:
  lea    -0x100(%rbp),%rax
  mov    $0x8,%edx
  mov    %rax,%rsi
  lea    D96(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0xc0(%rbp),%rax
  mov    $0x10,%edx
  mov    %rax,%rsi
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  movl   $0x0,-0x140(%rbp)
  jmp    L16
L25:
  mov    -0x140(%rbp),%eax
  cltq
  movzbl -0xf0(%rbp,%rax,1),%edx
  mov    -0x140(%rbp),%eax
  cltq
  movzbl -0xc0(%rbp,%rax,1),%eax
  xor    %eax,%edx
  mov    -0x140(%rbp),%eax
  cltq
  mov    %dl,-0xb0(%rbp,%rax,1)
  addl   $0x1,-0x140(%rbp)
L16:
  cmpl   $0xf,-0x140(%rbp)
  jle    L25
  lea    -0x90(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0xb0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mrtd_bac_kenc_kmac@plt>
  lea    -0xa0(%rbp),%rax
  mov    $0x10,%edx
  mov    %rax,%rsi
  lea    D83(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0x90(%rbp),%rax
  mov    $0x10,%edx
  mov    %rax,%rsi
  lea    D129(%rip),%rax
  mov    %rax,%rdi
  call   <printhex@plt>
  lea    -0x100(%rbp),%rdx
  lea    -0x108(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mrtd_bac_get_ssc@plt>
  mov    %eax,-0x13c(%rbp)
  mov    -0x13c(%rbp),%eax
  mov    %eax,%esi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D148
type_infered: string
name: read_data
arguments: label: D113
type_infered: string
name: read_data
arguments: label: D149
type_infered: string
name: read_data
arguments: label: D58
type_infered: string
name: read_data
arguments: label: D18
type_infered: string
name: read_data
arguments: label: D118
type_infered: string
name: read_data
arguments: label: D111
type_infered: string
name: read_data
arguments: label: D146
type_infered: string
name: read_data
arguments: label: D103
type_infered: string
name: read_data
arguments: label: D38
type_infered: string
name: read_data
arguments: label: D88
type_infered: string
name: read_data
arguments: label: D96
type_infered: string
name: read_data
arguments: label: D57
type_infered: string
name: read_data
arguments: label: D83
type_infered: string
name: read_data
arguments: label: D129
type_infered: string
name: read_data
arguments: label: D12
type_infered: string

tool: D148: L898902C<

tool: D113: 3

tool: D149: 690806

tool: D58: 1

tool: D18: 940623

tool: D118: 6

tool: D111: kenc

tool: D146: kmac

tool: D103: cmd_data

tool: D38: ======================
Challenge successful!
======================

tool: D88: ======================
Challenge failed...
======================

tool: D96: rnd_ifd

tool: D57: kicc

tool: D83: ksenc

tool: D129: ksmac

tool: D12: ssc: %lx


assistant: ```c
int main() {
  int i;
  char *mrp_number = "L898902C<";
  char *mrp_numbercd = "3";
  char *mrp_dob = "690806";
  char *mrp_dobcd = "1";
  char *mrp_expiry = "940623";
  char *mrp_expirycd = "6";
  char remotechallenge[8] = {0x46, 0x08, 0xf9, 0x19, 0x88, 0x70, 0x22, 0x12};
  char rnd_ifd[8] = {0x78, 0x17, 0x23, 0x86, 0x0c, 0x06, 0xc2, 0x26};
  char kifd[16] = {0x0b, 0x79, 0x52, 0x40, 0xcb, 0x70, 0x49, 0xb0, 0x1c, 0x19, 0xb3, 0x3e, 0x32, 0x80, 0x4f, 0x0b};
  char rx_data[40] = {0x46, 0xB9, 0x34, 0x2A, 0x41, 0x39, 0x6C, 0xD7, 0x38, 0x6B, 0xF5, 0x80, 0x31, 0x04, 0xD7, 0xCE, 0xDC, 0x12, 0x2B, 0x91, 0x32, 0x13, 0x9B, 0xAF, 0x2E, 0xED, 0xC9, 0x4E, 0xE1, 0x78, 0x53, 0x4F, 0x2f, 0x2D, 0x23, 0x5D, 0x07, 0x4D, 0x74, 0x49};
  char kmrz[25];
  char kenc[16];
  char kmac[16];
  char cmd_data[40];
  char rnd_icc[8];
  char kicc[16];
  char xored[16];
  char ksenc[16];
  char ksmac[16];
  uint64_t ssc_long;
  strncpy(kmrz, mrp_number, 9);
  strncpy(kmrz + 9, mrp_numbercd, 1);
  strncpy(kmrz + 10, mrp_dob, 6);
  strncpy(kmrz + 16, mrp_dobcd, 1);
  strncpy(kmrz + 17, mrp_expiry, 6);
  strncpy(kmrz + 23, mrp_expirycd, 1);
  mrtd_bac_kmrz_to_kenc_kmac(kmrz, kenc, kmac);
  printhex("kenc", kenc, 16);
  printhex("kmac", kmac, 16);
  mrtd_bac_cmd_data(rnd_ifd, kifd, remotechallenge, kenc, kmac, cmd_data);
  printhex("cmd_data", cmd_data, 40);
  if (mrtd_bac_challenge_ok(rx_data, kenc, rnd_ifd, rnd_icc, kicc)) {
    printf("======================\nChallenge successful!\n======================\n");
  } else {
    printf("======================\nChallenge failed...\n======================\n");
  }
  printhex("rnd_ifd", rnd_ifd, 8);
  printhex("kicc", kicc, 16);
  for (i = 0; i < 16; i++) {
    xored[i] = kifd[i] ^ kicc[i];
  }
  mrtd_bac_kenc_kmac(xored, ksenc, ksmac);
  printhex("ksenc", ksenc, 16);
  printhex("ksmac", ksmac, 16);
  ssc_long = mrtd_bac_get_ssc(remotechallenge, rnd_ifd);
  printf("ssc: %lx\n", ssc_long);
  return 0;
}
```