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

```asm
<getPhase>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  movsd  (%rdi),%xmm2
  movsd  0x8(%rdi),%xmm1
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  lea    0x40(%rsp),%rax
  movq   $0x0,0x10(%rsp)
  movapd %xmm2,%xmm0
  maxsd  D62(%rip),%xmm0
  movapd %xmm1,%xmm3
  mov    %rax,0x38(%rsp)
  minsd  D164(%rip),%xmm2
  maxsd  %xmm0,%xmm3
  minsd  %xmm2,%xmm1
  movsd  0x10(%rdi),%xmm2
  movapd %xmm3,%xmm0
  movapd %xmm2,%xmm3
  maxsd  %xmm0,%xmm3
  minsd  %xmm1,%xmm2
  movsd  0x18(%rdi),%xmm1
  movapd %xmm3,%xmm0
  movapd %xmm1,%xmm3
  minsd  %xmm2,%xmm1
  movsd  0x20(%rdi),%xmm2
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm2,%xmm3
  minsd  %xmm1,%xmm2
  movsd  0x28(%rdi),%xmm1
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm1,%xmm3
  minsd  %xmm2,%xmm1
  movsd  0x30(%rdi),%xmm2
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm2,%xmm3
  minsd  %xmm1,%xmm2
  movsd  0x38(%rdi),%xmm1
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm1,%xmm3
  minsd  %xmm2,%xmm1
  movsd  0x40(%rdi),%xmm2
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm2,%xmm3
  minsd  %xmm1,%xmm2
  movsd  0x48(%rdi),%xmm1
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm1,%xmm3
  minsd  %xmm2,%xmm1
  movsd  0x50(%rdi),%xmm2
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm2,%xmm3
  minsd  %xmm1,%xmm2
  movsd  0x58(%rdi),%xmm1
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  movapd %xmm1,%xmm3
  minsd  %xmm2,%xmm1
  movsd  D150(%rip),%xmm2
  maxsd  %xmm0,%xmm3
  movapd %xmm3,%xmm0
  subsd  %xmm1,%xmm3
  addsd  %xmm0,%xmm1
  mulsd  %xmm2,%xmm3
  mulsd  %xmm2,%xmm1
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm1,0x20(%rsp)
  movsd  D154(%rip),%xmm1
  movsd  %xmm1,0x30(%rsp)
L71:
  movq   $0x0,0x28(%rsp)
  mov    0x38(%rsp),%r14
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L110:
  pxor   %xmm0,%xmm0
  movq   $0x0,(%r14)
  mov    %r12,%rbx
  xor    %r15d,%r15d
  cvtsi2sd %ebp,%xmm0
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  nopl   0x0(%rax)
L79:
  pxor   %xmm0,%xmm0
  add    $0x8,%rbx
  cvtsi2sd %r15d,%xmm0
  addsd  0x8(%rsp),%xmm0
  add    $0x1e,%r15d
  addsd  0x10(%rsp),%xmm0
  mulsd  D143(%rip),%xmm0
  divsd  D14(%rip),%xmm0
  cvttsd2si %xmm0,%edi
  call   <sin@plt>
  mulsd  0x18(%rsp),%xmm0
  addsd  0x20(%rsp),%xmm0
  subsd  -0x8(%rbx),%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  addsd  (%r14),%xmm0
  movsd  %xmm0,(%r14)
  cmp    $0x168,%r15d
  jne    L79
  addsd  0x28(%rsp),%xmm0
  add    $0x1,%ebp
  add    $0x8,%r14
  movsd  %xmm0,0x28(%rsp)
  cmp    $0xc,%ebp
  jne    L110
  movsd  0x40(%rsp),%xmm1
  movapd %xmm0,%xmm3
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm3
  jbe    L62
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L62:
  movsd  0x48(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L73
  movsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L73:
  movsd  0x50(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L90
  movsd  0x30(%rsp),%xmm3
  movsd  %xmm1,0x28(%rsp)
  movapd %xmm3,%xmm0
  addsd  %xmm3,%xmm0
L90:
  movsd  0x58(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  comisd %xmm1,%xmm2
  jbe    L135
  movsd  D166(%rip),%xmm0
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L135:
  movsd  0x60(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L101
  movsd  D167(%rip),%xmm0
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L101:
  movsd  0x68(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  comisd %xmm1,%xmm2
  jbe    L77
  movsd  D38(%rip),%xmm0
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L77:
  movsd  0x70(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L87
  movsd  D36(%rip),%xmm0
  mulsd  0x30(%rsp),%xmm0
  movsd  %xmm1,0x28(%rsp)
L87:
  movsd  0x78(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  comisd %xmm1,%xmm2
  jbe    L30
  movsd  0x30(%rsp),%xmm0
  mulsd  D82(%rip),%xmm0
  movsd  %xmm1,0x28(%rsp)
L30:
  movsd  0x80(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L7
  movsd  0x30(%rsp),%xmm0
  mulsd  D107(%rip),%xmm0
  movsd  %xmm1,0x28(%rsp)
L7:
  movsd  0x88(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  comisd %xmm1,%xmm2
  jbe    L74
  movsd  0x30(%rsp),%xmm0
  mulsd  D155(%rip),%xmm0
  movsd  %xmm1,0x28(%rsp)
L74:
  movsd  0x90(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm3
  comisd %xmm1,%xmm3
  jbe    L36
  movsd  0x30(%rsp),%xmm0
  mulsd  D165(%rip),%xmm0
  movsd  %xmm1,0x28(%rsp)
L36:
  movsd  0x28(%rsp),%xmm1
  comisd 0x98(%rsp),%xmm1
  jbe    L9
  movsd  0x30(%rsp),%xmm0
  mulsd  D137(%rip),%xmm0
L9:
  addsd  0x10(%rsp),%xmm0
  add    $0x1,%r13d
  movsd  %xmm0,0x10(%rsp)
  cmp    $0x3,%r13d
  je     L138
  movsd  D35(%rip),%xmm1
  movsd  %xmm1,0x30(%rsp)
  cmp    $0x2,%r13d
  je     L71
  movsd  D156(%rip),%xmm1
  movsd  %xmm1,0x30(%rsp)
  jmp    L71
L138:
  cvttsd2si 0x10(%rsp),%eax
  mov    0xa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L139
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L139:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D62
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D164
data_type: f64
name: extract_symbolic_data
arguments: data_label: D150
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D154
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D143
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D14
data_type: f64
name: extract_symbolic_data
arguments: data_label: D166
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D167
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D38
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D36
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D82
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D107
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D155
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D165
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D137
data_type: f32[2]
name: extract_symbolic_data
arguments: data_label: D35
data_type: byte[8]
name: extract_symbolic_data
arguments: data_label: D156
data_type: f32[2]

tool: {"D62": [0.0,-4.4755859375]}

tool: D164: 999

tool: {"D150": [0.0,1.75]}

tool: {"D154": [0.0,2.96875]}

tool: {"D143": [0.0,2.1426987648010254]}

tool: D14: 180

tool: {"D166": [0.0,2.125]}

tool: {"D167": [0.0,2.25]}

tool: {"D38": [0.0,2.3125]}

tool: {"D36": [0.0,2.375]}

tool: {"D82": [0.0,2.4375]}

tool: {"D107": [0.0,2.5]}

tool: {"D155": [0.0,2.53125]}

tool: {"D165": [0.0,2.5625]}

tool: {"D137": [0.0,2.59375]}

tool: {"D35": [0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xca,0x3f]}

tool: {"D156": [0.0,2.0625]}

assistant: ```c
int getPhase(double *wave) {
  double max = -999, min = 999;
  double amp, offset;
  double angle = 0, base;
  int i, j, k;
  for (i = 0; i < 12; i++) {
    if (wave[i] > max)
      max = wave[i];
    if (wave[i] < min)
      min = wave[i];
  }
  amp = (max - min) / 2;
  offset = (max + min) / 2;
  for (k = 0; k < 3; k++) {
    double error[12], curerror = 0;
    double segsize = 360;
    for (i = 0; i <= k; i++)
      segsize /= 12.0;
    for (j = 0; j < 12; j++) {
      error[j] = 0;
      for (i = 0; i < 12; i++)
        error[j] += fabs((amp * sin((i * 30 + j * segsize + angle) * 3.14159f / 180.0) + offset) - wave[i]);
      curerror += error[j];
    }
    base = 0;
    for (j = 0; j < 12; j++) {
      if (error[j] < curerror) {
        base = j * segsize;
        curerror = error[j];
      }
    }
    angle += base;
  }
  return (int)angle;
}
```