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

```asm
<challenge11>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  lea    D62(%rip),%rdi
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    $0x64,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r15
  lea    0x14(%rsp),%r14
  call   <puts@plt>
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  movl   $0x0,0xc(%rsp)
  movl   $0x0,0x8(%rsp)
  mov    %eax,%r13d
  jmp    L16
  nopl   (%rax)
L37:
  addl   $0x1,0x8(%rsp)
L8:
  cmp    %eax,%edx
  sete   %al
  movzbl %al,%eax
  add    %eax,%ebp
  call   <free@plt>
  sub    $0x1,%ebx
  je     L32
L16:
  mov    %r14,%rdx
  mov    %r15,%rcx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <encryption_oracle@plt>
  mov    0x10(%rsp),%esi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  call   <detect_mode@plt>
  mov    0x14(%rsp),%edx
  mov    (%rsp),%rdi
  test   %edx,%edx
  je     L37
  addl   $0x1,0xc(%rsp)
  jmp    L8
L32:
  pxor   %xmm0,%xmm0
  movss  D35(%rip),%xmm1
  mov    $0x1,%eax
  lea    D30(%rip),%rdi
  cvtsi2ssl 0x8(%rsp),%xmm0
  mulss  %xmm1,%xmm0
  divss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  movss  D35(%rip),%xmm1
  cvtsi2ssl 0xc(%rsp),%xmm0
  lea    D63(%rip),%rdi
  mov    $0x1,%eax
  mulss  %xmm1,%xmm0
  divss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  movss  D35(%rip),%xmm1
  cvtsi2ss %ebp,%xmm0
  lea    D53(%rip),%rdi
  mov    $0x1,%eax
  mulss  %xmm1,%xmm0
  divss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D62
type: string
name: disassemble_data
arguments: tag: D35
type: byte[4]
name: disassemble_data
arguments: tag: D30
type: string
name: disassemble_data
arguments: tag: D63
type: string
name: disassemble_data
arguments: tag: D53
type: string

tool: D62: *** Challenge 11: An ECB/CBC detection oracle

tool: {"D35": [0x00,0x00,0xc8,0x42]}

tool: D30: ECB encryption rate: %.0f%%


tool: D63: CBC encryption rate: %.0f%%


tool: D53: Detection success rate: %.0f%%


assistant: ```c
void challenge11(char *str) {
  uint8_t *enc;
  int out_len;
  int real;
  int detected;
  int num_ecb;
  int num_cbc;
  int successes;
  int len;
  int i;
  float percentage;
  printf("*** Challenge 11: An ECB/CBC detection oracle\n");
  srand(time(NULL));
  len = strlen(str);
  successes = 0;
  num_ecb = 0;
  num_cbc = 0;
  for (i = 0; i < 100; i++) {
    enc = encryption_oracle((uint8_t *)str, len, &real, &out_len);
    detected = detect_mode(enc, out_len);
    if (real == 0)
      num_ecb++;
    else
      num_cbc++;
    if (real == detected)
      successes++;
    free(enc);
  }
  percentage = 100 * (float)num_ecb / 100;
  printf("ECB encryption rate: %.0f%%\n", percentage);
  percentage = 100 * (float)num_cbc / 100;
  printf("CBC encryption rate: %.0f%%\n", percentage);
  percentage = 100 * (float)successes / 100;
  printf("Detection success rate: %.0f%%\n", percentage);
}
```