user: Translate the below assembly code into C programming language:

```asm
<psg_kernel_adi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x138,%rsp
  mov    %edi,0xf0(%rsp)
  mov    %esi,0x64(%rsp)
  mov    %rdx,0x88(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x128(%rsp)
  xor    %eax,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  movsd  D36(%rip),%xmm2
  movapd %xmm2,%xmm1
  divsd  %xmm0,%xmm1
  pxor   %xmm3,%xmm3
  cvtsi2sd %edi,%xmm3
  movapd %xmm2,%xmm0
  divsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm1
  movapd %xmm0,%xmm3
  addsd  %xmm0,%xmm3
  divsd  %xmm1,%xmm3
  divsd  %xmm1,%xmm0
  movq   D40(%rip),%xmm1
  movapd %xmm3,%xmm5
  xorpd  %xmm1,%xmm5
  movsd  D21(%rip),%xmm4
  mulsd  %xmm4,%xmm5
  movsd  %xmm5,0x8(%rsp)
  addsd  %xmm2,%xmm3
  movsd  %xmm3,0x18(%rsp)
  xorpd  %xmm0,%xmm1
  mulsd  %xmm4,%xmm1
  movsd  %xmm1,0x10(%rsp)
  addsd  %xmm2,%xmm0
  movsd  %xmm0,0x20(%rsp)
  test   %edi,%edi
  jle    L19
  mov    %rdx,%rbx
  mov    %rcx,%r10
  mov    %r9,%r14
  lea    -0x1(%rsi),%r9d
  mov    %r9d,0x3c(%rsp)
  mov    %edi,%eax
  shr    $0x1f,%eax
  add    %edi,%eax
  sar    %eax
  mov    %eax,0xf4(%rsp)
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x38(%rsp)
  mov    %esi,%eax
  movslq %esi,%rcx
  lea    0x0(,%rcx,8),%rdi
  mov    %rdi,0x40(%rsp)
  lea    (%r8,%rdi,1),%rsi
  mov    %rsi,0xa0(%rsp)
  lea    (%r14,%rdi,1),%rsi
  mov    %rsi,0xa8(%rsp)
  lea    0x8(%rdx,%rdi,1),%rsi
  mov    %rsi,0xd8(%rsp)
  mov    %eax,%esi
  lea    -0x3(%rax),%r11d
  mov    %r11,0x78(%rsp)
  lea    (%rcx,%r11,1),%rax
  lea    0x8(%r8,%rax,8),%rax
  mov    %rax,0xe0(%rsp)
  mov    %esi,%eax
  imul   %r9d,%eax
  cltq
  lea    0x8(%r10,%rax,8),%rdx
  mov    %rdx,0xe8(%rsp)
  lea    (%r10,%rax,8),%rdx
  mov    %rdx,0x80(%rsp)
  mov    %esi,%edx
  neg    %edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  mov    %rdx,0x28(%rsp)
  lea    -0x2(%rsi),%edx
  imul   %esi,%edx
  movslq %edx,%rdx
  sub    %rax,%rdx
  mov    %rdx,0xd0(%rsp)
  mov    %rbx,%rdx
  add    %rdi,%rdx
  mov    %rdx,0xb8(%rsp)
  mov    %rcx,%rax
  neg    %rax
  shl    $0x3,%rax
  mov    %rax,0x68(%rsp)
  mov    %esi,%eax
  add    %eax,%eax
  mov    %eax,0x98(%rsp)
  cltq
  shl    $0x3,%rax
  mov    %rax,0xc0(%rsp)
  lea    0x2(%rcx,%r11,1),%rax
  shl    $0x3,%rax
  mov    %rax,0xc8(%rsp)
  movl   $0x1,0x9c(%rsp)
  mov    $0x8,%eax
  sub    %rbx,%rax
  mov    %rax,0x90(%rsp)
  mov    %r10,%r15
  mov    %r8,0xf8(%rsp)
  mov    %r14,0xb0(%rsp)
  jmp    L20
L92:
  mov    %rax,%r9
L227:
  movsd  %xmm6,0x8(%r15,%r9,8)
  mov    %r10,%r8
  movq   $0x0,(%r10)
  movsd  0x8(%r15,%r9,8),%xmm0
  mov    %r11,%r13
  movsd  %xmm0,(%r11)
  mov    %r11,%rcx
  mov    %rbx,%rdx
  mov    %r10,%rax
L124:
  movsd  0x8(%rsp),%xmm8
  movapd %xmm8,%xmm1
  mulsd  (%rax),%xmm1
  addsd  0x18(%rsp),%xmm1
  movapd %xmm5,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rax)
  movapd %xmm4,%xmm0
  mulsd  -0x8(%rdx),%xmm0
  movapd %xmm3,%xmm2
  mulsd  (%rdx),%xmm2
  addsd  %xmm2,%xmm0
  movsd  0x10(%rsp),%xmm2
  mulsd  0x8(%rdx),%xmm2
  subsd  %xmm2,%xmm0
  movapd %xmm8,%xmm2
  mulsd  (%rcx),%xmm2
  subsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rcx)
  add    $0x8,%rax
  add    %rdi,%rdx
  add    $0x8,%rcx
  cmp    %rsi,%rax
  jne    L124
  mov    0x80(%rsp),%rax
  movsd  %xmm7,0x8(%rax,%r9,8)
  test   %r12d,%r12d
  jle    L216
  movslq %r12d,%rax
  mov    %rbp,%rdx
L96:
  movsd  (%r8,%rax,8),%xmm0
  mulsd  (%rdx),%xmm0
  addsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%r14,8)
  sub    $0x1,%rax
  add    0x28(%rsp),%rdx
  test   %eax,%eax
  jg     L96
L216:
  lea    0x1(%r9),%rax
  add    %rdi,%r10
  add    %rdi,%r11
  add    $0x8,%rbx
  add    %rdi,%rsi
  add    $0x8,%rbp
  cmp    0x78(%rsp),%r9
  jne    L92
  movsd  0x8(%rsp),%xmm6
  movapd %xmm6,%xmm3
  addsd  %xmm6,%xmm3
  addsd  D36(%rip),%xmm3
  mov    0xc8(%rsp),%rsi
  mov    0xc0(%rsp),%rbx
  mov    0x68(%rsp),%rax
  mov    %rax,0x50(%rsp)
  mov    0x64(%rsp),%eax
  mov    %eax,0x60(%rsp)
  mov    0xa8(%rsp),%r10
  mov    0xa0(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xb8(%rsp),%r9
  movq   $0x0,0x58(%rsp)
  mov    $0x1,%r11d
  movsd  D36(%rip),%xmm7
  movsd  0x10(%rsp),%xmm5
  xorpd  D40(%rip),%xmm5
  xorpd  D40(%rip),%xmm6
  movapd %xmm6,%xmm4
  movapd %xmm7,%xmm6
  mov    %r12d,0x74(%rsp)
  mov    %rbx,0x30(%rsp)
  mov    0x9c(%rsp),%ebx
  mov    0xf8(%rsp),%r13
  mov    0xb0(%rsp),%r14
  mov    0xf4(%rsp),%ebp
  jmp    L129
L189:
  movsd  (%rdi,%rax,8),%xmm0
  mulsd  0x8(%rdx,%rax,8),%xmm0
  addsd  (%r8,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  sub    $0x1,%rax
  test   %eax,%eax
  jle    L85
L132:
  cmp    %ebx,%ebp
  jne    L189
  cmp    %eax,0x38(%rsp)
  jne    L189
  test   %cl,%cl
  je     L189
  mov    0x70(%rsp),%r12d
  add    %eax,%r12d
  movslq %r12d,%r12
  movsd  0x80(%r14,%r12,8),%xmm0
  movsd  %xmm0,(%r14,%r12,8)
  jmp    L189
L85:
  add    $0x1,%r11d
  mov    0x40(%rsp),%rax
  add    %rax,%r9
  add    %rax,0x48(%rsp)
  add    %rax,%r10
  mov    0x68(%rsp),%rcx
  add    %rcx,0x50(%rsp)
  add    %rax,0x58(%rsp)
  add    %rax,0x30(%rsp)
  add    %rax,%rsi
  cmp    0x3c(%rsp),%r11d
  je     L34
L129:
  mov    %r9,%rdx
  movsd  %xmm7,(%r9)
  mov    0x48(%rsp),%rax
  mov    %rax,%rdi
  movq   $0x0,(%rax)
  movsd  (%r9),%xmm0
  mov    %r10,%r8
  movsd  %xmm0,(%r10)
  mov    0x60(%rsp),%eax
  mov    %eax,0x70(%rsp)
  sub    0x64(%rsp),%eax
  add    0x98(%rsp),%eax
  mov    %eax,0x60(%rsp)
  mov    0x90(%rsp),%rax
  add    %r9,%rax
  mov    0x50(%rsp),%rcx
  mov    %rcx,%r12
  add    0x58(%rsp),%r12
  add    %r15,%r12
  add    0x30(%rsp),%rcx
  add    %r15,%rcx
L170:
  movsd  0x10(%rsp),%xmm9
  movapd %xmm9,%xmm1
  mulsd  -0x8(%r13,%rax,1),%xmm1
  addsd  0x20(%rsp),%xmm1
  movapd %xmm5,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%r13,%rax,1)
  movapd %xmm4,%xmm0
  mulsd  (%r12,%rax,1),%xmm0
  movapd %xmm3,%xmm2
  mulsd  (%r15,%rax,1),%xmm2
  addsd  %xmm2,%xmm0
  movsd  0x8(%rsp),%xmm2
  mulsd  (%rcx,%rax,1),%xmm2
  subsd  %xmm2,%xmm0
  movapd %xmm9,%xmm2
  mulsd  -0x8(%r14,%rax,1),%xmm2
  subsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%r14,%rax,1)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L170
  mov    0x88(%rsp),%rax
  mov    0x30(%rsp),%rcx
  movsd  %xmm6,-0x8(%rax,%rcx,1)
  mov    0x74(%rsp),%eax
  test   %eax,%eax
  jle    L85
  cmp    %r11d,0x38(%rsp)
  sete   %cl
  cltq
  jmp    L132
L34:
  lea    0x100(%rsp),%rbx
  mov    0x9c(%rsp),%edx
  lea    D39(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  lea    D45(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  lea    D57(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    0x64(%rsp),%r14d
  test   %r14d,%r14d
  jle    L6
  mov    0xb0(%rsp),%r12
  mov    $0x0,%r13d
  mov    %r15,0x30(%rsp)
L141:
  mov    0x3c(%rsp),%r15d
  mov    $0x0,%ebx
L164:
  movsd  (%r12,%rbx,8),%xmm0
  mov    %ebx,%ecx
  mov    %r13d,%edx
  lea    D88(%rip),%rsi
  mov    %rbp,%rdi
  call   <fprintf@plt>
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmp    %r15,%rax
  jne    L164
  add    $0x1,%r13d
  add    0x40(%rsp),%r12
  cmp    %r13d,%r14d
  jne    L141
  mov    0x30(%rsp),%r15
L6:
  mov    %rbp,%rdi
  call   <fclose@plt>
  addl   $0x1,0x9c(%rsp)
  mov    0x9c(%rsp),%eax
  cmp    %eax,0xf0(%rsp)
  jl     L19
L20:
  cmpl   $0x1,0x3c(%rsp)
  jle    L34
  mov    0xe8(%rsp),%rbp
  mov    0xe0(%rsp),%rsi
  mov    0xd8(%rsp),%rbx
  mov    0xa8(%rsp),%r11
  mov    0xa0(%rsp),%r10
  mov    $0x0,%r9d
  movsd  D36(%rip),%xmm6
  movsd  0x10(%rsp),%xmm7
  movapd %xmm7,%xmm3
  addsd  %xmm7,%xmm3
  addsd  %xmm6,%xmm3
  movsd  0x8(%rsp),%xmm5
  xorpd  D40(%rip),%xmm5
  xorpd  D40(%rip),%xmm7
  movapd %xmm7,%xmm4
  movapd %xmm6,%xmm7
  mov    0x64(%rsp),%eax
  lea    -0x2(%rax),%r12d
  mov    0xd0(%rsp),%r14
  mov    0x40(%rsp),%rdi
  jmp    L227
L19:
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L146
  add    $0x138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L146:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D36
type_infered: f64
name: disassemble_data
arguments: data_label: D40
type_infered: f32[4]
name: disassemble_data
arguments: data_label: D21
type_infered: f32[2]
name: disassemble_data
arguments: data_label: D39
type_infered: string
name: disassemble_data
arguments: data_label: D45
type_infered: string
name: disassemble_data
arguments: data_label: D57
type_infered: string
name: disassemble_data
arguments: data_label: D88
type_infered: string

tool: D36: 1

tool: {"D40": [0.0,-0.0,0.0,0.0]}

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

tool: D39: %d

tool: D45: _simData_q.dat

tool: D57: wb

tool: D88: %d %d %lf


assistant: ```c
void psg_kernel_adi(int tsteps, int n, double *u, double *v, double *p, double *q) {
  double *q1;
  FILE *fp_u;
  FILE *fp_v;
  FILE *fp_p;
  FILE *fp_q;
  int t, i, j;
  double DX, DY, DT;
  double B1, B2;
  double mul1, mul2;
  double a, b, c, d, e, f;
#pragma scop
  DX = 1.0 / (double)n;
  DY = 1.0 / (double)n;
  DT = 1.0 / (double)tsteps;
  B1 = 2.0;
  B2 = 1.0;
  mul1 = B1 * DT / (DX * DX);
  mul2 = B2 * DT / (DY * DY);
  a = -mul1 / 2.0;
  b = 1.0 + mul1;
  c = a;
  d = -mul2 / 2.0;
  e = 1.0 + mul2;
  f = d;
  for (t = 1; t <= tsteps; t++) {
    for (i = 1; i < n - 1; i++) {
      v[i] = 1.0;
      p[i * n] = 0.0;
      q[i * n] = v[i];
      for (j = 1; j < n - 1; j++) {
        p[i * n + j] = -c / (a * p[i * n + (j - 1)] + b);
        q[i * n + j] = (-d * u[j * n + (i - 1)] + (1.0 + 2.0 * d) * u[j * n + i] - f * u[j * n + (i + 1)] - a * q[i * n + (j - 1)]) / (a * p[i * n + (j - 1)] + b);
      }
      v[n * (n - 1) + i] = 1.0;
      for (j = n - 2; j >= 1; j--) {
        v[j * n + i] = p[i * n + j] * v[(j + 1) * n + i] + q[i * n + j];
      }
    }
    for (i = 1; i < n - 1; i++) {
      u[i * n] = 1.0;
      p[i * n] = 0.0;
      q[i * n] = u[i * n];
      for (j = 1; j < n - 1; j++) {
        p[i * n + j] = -f / (d * p[i * n + (j - 1)] + e);
        q[i * n + j] = (-a * v[(i - 1) * n + j] + (1.0 + 2.0 * a) * v[i * n + j] - c * v[(i + 1) * n + j] - d * q[i * n + (j - 1)]) / (d * p[i * n + (j - 1)] + e);
      }
      u[i * n + (n - 1)] = 1.0;
      for (j = n - 2; j >= 1; j--) {
        if (t == tsteps / 2 && i == n / 2 && j == n / 2) {
          q1 = q + 16;
          q[i * n + j] = q1[i * n + j];
        }
        u[i * n + j] = p[i * n + j] * u[i * n + (j + 1)] + q[i * n + j];
      }
    }
    char buffer_q[40];
    sprintf(buffer_q, "%d", t);
    strcat(buffer_q, "_simData_q.dat");
    fp_q = fopen(buffer_q, "wb");
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        fprintf(fp_q, "%d %d %lf\n", i, j, q[i * n + j]);
      }
    }
    fclose(fp_q);
  }
#pragma endscop
}
```