user: 请将以下的汇编代码转换成C语言代码：

```asm
<ex3>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %edx,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  xor    %eax,%eax
  mov    %rbp,0x20(%rsp)
  call   <rand@plt>
  movl   $0x1,0x14(%rsp)
  cltd
  idiv   %r12d
  cmp    $0x1,%r12d
  jle    L130
  cmp    $0x1,%ebx
  mov    %edx,%ebp
  mov    $0x1,%eax
  sete   %r13b
  xor    %r14d,%r14d
  jmp    L195
  nopl   (%rax)
L178:
  test   %r13b,%r13b
  je     L213
  mov    $0x4,%esi
  lea    0x14(%rsp),%rdi
  call   <flipBit@plt>
  mov    0x14(%rsp),%ecx
  pxor   %xmm0,%xmm0
  mov    0x20(%rsp),%rsi
  cvtsi2sd %ecx,%xmm0
  lea    -0x2(%rcx,%rcx,1),%r15d
  mov    %r15d,%eax
  mov    %r15d,0x18(%rsp)
  sub    %r14d,%eax
  mov    %eax,0x1c(%rsp)
  cltq
  lea    (%rsi,%rax,8),%rax
  movsd  %xmm0,(%rax)
  mov    %rax,0x20(%rsp)
L98:
  lea    0x20(%rsp),%r9
  lea    D31(%rip),%rdi
  mov    %r15d,%r14d
  mov    %r9,%rsi
  call   <writeValue@plt>
  mov    0x14(%rsp),%eax
L81:
  add    $0x1,%eax
  mov    %eax,0x14(%rsp)
  cmp    %r12d,%eax
  jge    L130
L195:
  cmp    %ebp,%eax
  je     L178
L213:
  mov    0x14(%rsp),%eax
  lea    -0x2(%rax,%rax,1),%r15d
  mov    %eax,%esi
  mov    %r15d,0x18(%rsp)
  cmp    $0x2,%ebx
  je     L68
  mov    %r15d,%ecx
  sub    %r14d,%ecx
  mov    %ecx,0x1c(%rsp)
  cmp    $0x3,%ebx
  jne    L26
  cmp    %ebp,%eax
  je     L122
L18:
  pxor   %xmm0,%xmm0
  mov    0x20(%rsp),%rax
  movslq %ecx,%rcx
  cvtsi2sd %esi,%xmm0
  lea    (%rax,%rcx,8),%rax
  movsd  %xmm0,(%rax)
  mov    %rax,0x20(%rsp)
L165:
  lea    0x20(%rsp),%r9
  lea    D35(%rip),%rdi
  mov    %r15d,%r14d
  mov    %r9,%rsi
  call   <writeValue@plt>
  mov    0x14(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x14(%rsp)
  cmp    %r12d,%eax
  jl     L195
  nop
L130:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L229
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L68:
  cmp    %ebp,%eax
  je     L0
L205:
  pxor   %xmm0,%xmm0
  mov    %r15d,%eax
  mov    0x20(%rsp),%rcx
  cvtsi2sd %esi,%xmm0
  sub    %r14d,%eax
  mov    %eax,0x1c(%rsp)
  cltq
  lea    (%rcx,%rax,8),%rax
  movsd  %xmm0,(%rax)
  mov    %rax,0x20(%rsp)
L11:
  lea    0x20(%rsp),%r9
  lea    D11(%rip),%rdi
  mov    %r15d,%r14d
  mov    %r9,%rsi
  call   <writeValue@plt>
  mov    0x14(%rsp),%eax
  jmp    L81
L26:
  pxor   %xmm0,%xmm0
  mov    0x20(%rsp),%rdi
  movslq %ecx,%rcx
  cvtsi2sd %eax,%xmm0
  lea    (%rdi,%rcx,8),%rcx
  movsd  %xmm0,(%rcx)
  mov    %rcx,0x20(%rsp)
  cmp    $0x4,%ebx
  jne    L33
  lea    0x20(%rsp),%r9
  cmp    %ebp,%eax
  je     L164
L32:
  mov    %r15d,%r14d
L95:
  mov    %r9,%rsi
  lea    D10(%rip),%rdi
  call   <writeValue@plt>
  mov    0x14(%rsp),%eax
  jmp    L81
L164:
  mov    %r9,%rdi
  mov    $0x8,%esi
  mov    %r9,0x8(%rsp)
  call   <flipBit@plt>
  mov    0x8(%rsp),%r9
  jmp    L32
  nopl   0x0(%rax)
L122:
  mov    $0x4,%esi
  lea    0x1c(%rsp),%rdi
  call   <flipBit@plt>
  mov    0x14(%rsp),%esi
  mov    0x1c(%rsp),%ecx
  mov    0x18(%rsp),%r15d
  jmp    L18
  nopl   0x0(%rax)
L0:
  mov    $0x4,%esi
  lea    0x18(%rsp),%rdi
  call   <flipBit@plt>
  mov    0x14(%rsp),%esi
  mov    0x18(%rsp),%r15d
  jmp    L205
L33:
  cmp    $0x1,%ebx
  je     L98
  cmp    $0x2,%ebx
  je     L11
  cmp    $0x3,%ebx
  je     L165
  mov    %r15d,%r14d
  lea    0x20(%rsp),%r9
  cmp    $0x4,%ebx
  je     L95
  test   %ebx,%ebx
  jne    L81
  mov    %r9,%rsi
  lea    D32(%rip),%rdi
  call   <writeValue@plt>
  mov    0x14(%rsp),%eax
  jmp    L81
L229:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D31
data_type: string
name: parse_data
arguments: data_label: D35
data_type: string
name: parse_data
arguments: data_label: D11
data_type: string
name: parse_data
arguments: data_label: D10
data_type: string
name: parse_data
arguments: data_label: D32
data_type: string

tool: D31: ex3_var_addr_fi_1.csv

tool: D35: ex3_var_addr_fi_3.csv

tool: D11: ex3_var_addr_fi_2.csv

tool: D10: ex3_var_addr_fi_4.csv

tool: D32: ex3_var_addr.csv

assistant: ```c
void ex3(double *A, int n, int ch) {
  srand(time(NULL));
  double *addr = A;
  int pid = 0;
  int tidx = 1 + (rand() % n - 1);
  for (int i = 1; i < n; i++) {
    if (ch == 1 && tidx == i) {
      flipBit((void *)&i, 4);
    }
    int id = 2 * i - 2;
    if (ch == 2 && tidx == i) {
      flipBit((void *)&id, 4);
    }
    int rid = id - pid;
    if (ch == 3 && tidx == i) {
      flipBit((void *)&rid, 4);
    }
    addr[rid] = i;
    pid = id;
    addr = &addr[rid];
    if (ch == 4 && tidx == i) {
      flipBit((void *)&addr, 8);
    }
    if (ch == 1)
      writeValue("ex3_var_addr_fi_1.csv", (void *)&addr);
    if (ch == 2)
      writeValue("ex3_var_addr_fi_2.csv", (void *)&addr);
    if (ch == 3)
      writeValue("ex3_var_addr_fi_3.csv", (void *)&addr);
    if (ch == 4)
      writeValue("ex3_var_addr_fi_4.csv", (void *)&addr);
    if (ch == 0)
      writeValue("ex3_var_addr.csv", (void *)&addr);
  }
}
```