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

```asm
<SetUp3>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %r9,0x60(%rsp)
  mov    0xf0(%rsp),%rbp
  lea    0x70(%rsp),%r14
  lea    0x90(%rsp),%r13
  mov    %edi,0x18(%rsp)
  mov    0xf8(%rsp),%rbx
  mov    %r14,%r9
  mov    %r13,%r14
  mov    %rdx,0x20(%rsp)
  mov    %rbp,%r13
  mov    %rbx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  lea    0x90(%rcx),%rax
  mov    %rsi,0x50(%rsp)
  mov    %rcx,0x48(%rsp)
  mov    %r8,0x58(%rsp)
  mov    %rax,0x68(%rsp)
L24:
  mov    0x48(%rsp),%rdx
  mov    0x58(%rsp),%rcx
  xor    %eax,%eax
L18:
  movsd  D36(%rip),%xmm0
  divsd  (%rdx,%rax,1),%xmm0
  movsd  %xmm0,(%r9,%rax,1)
  mulsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%r14,%rax,1)
  add    $0x8,%rax
  cmp    $0x18,%rax
  jne    L18
  mov    0x50(%rsp),%rax
  mov    (%rax),%edi
  mov    0x4(%rax),%esi
  mov    %edi,0x1c(%rsp)
  mov    %esi,0x2c(%rsp)
  cmp    %esi,%edi
  jg     L46
  movslq %edi,%rcx
  lea    0x1(%rsi),%eax
  movslq %esi,%rdx
  mov    %r14,%r11
  mov    %rcx,%rbx
  mov    %eax,0x28(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %rbp,%r14
  shl    $0x10,%rbx
  add    0x60(%rsp),%rbx
  mov    %r13,%rbp
  lea    0x8(%rbx,%rax,8),%r15
  mov    0x18(%rsp),%eax
  mov    %rbx,%r13
  sub    $0x2,%eax
  sub    %esi,%eax
  add    %rdx,%rax
  lea    0x8(%rbx,%rax,8),%r12
  lea    0x0(,%rdx,8),%rax
  mov    %rcx,%rbx
  mov    %rax,0x40(%rsp)
  mov    %esi,%eax
  sub    %edi,%eax
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x38(%rsp)
  lea    0x0(,%rcx,8),%rax
  mov    %rax,0x30(%rsp)
  nopl   0x0(%rax)
L39:
  mov    0x1c(%rsp),%edx
  mov    %r13,%rax
  pxor   %xmm0,%xmm0
  test   %edx,%edx
  jle    L78
  nopw   0x0(%rax,%rax,1)
L62:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %r15,%rax
  jne    L62
L78:
  mov    0x28(%rsp),%ecx
  cmp    %ecx,0x18(%rsp)
  jle    L97
  mov    0x40(%rsp),%rax
  add    %r13,%rax
  nop
L105:
  addsd  0x8(%rax),%xmm0
  add    $0x8,%rax
  cmp    %r12,%rax
  jne    L105
L97:
  movsd  D2(%rip),%xmm2
  mov    0x20(%rsp),%rax
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm2
  subsd  (%rax,%rbx,8),%xmm1
  andpd  D22(%rip),%xmm1
  comisd %xmm2,%xmm1
  ja     L89
  mov    0x30(%rsp),%rax
  mov    0x38(%rsp),%rdx
  xor    %esi,%esi
  mov    %r9,0x10(%rsp)
  xorpd  D24(%rip),%xmm0
  mov    %r11,0x8(%rsp)
  lea    (%rax,%r13,1),%rdi
  movsd  %xmm0,(%rsp)
  call   <memset@plt>
  movsd  (%rsp),%xmm0
  xor    %eax,%eax
  mov    0x8(%rsp),%r11
  mov    0x10(%rsp),%r9
  lea    0x0(,%rbx,8),%rdx
L31:
  movsd  (%r9,%rax,1),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp,%rdx,1)
  movsd  (%r11,%rax,1),%xmm1
  add    $0x8,%rax
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%r14,%rdx,1)
  add    $0x10000,%rdx
  cmp    $0x18,%rax
  jne    L31
  add    $0x1,%rbx
  add    $0x10000,%r13
  add    $0x10000,%r15
  add    $0x10000,%r12
  cmp    %ebx,0x2c(%rsp)
  jge    L39
  mov    %rbp,%r13
  mov    %r14,%rbp
  mov    %r11,%r14
L46:
  addq   $0x18,0x48(%rsp)
  mov    0x48(%rsp),%rax
  addq   $0x8,0x50(%rsp)
  addq   $0x18,0x58(%rsp)
  cmp    0x68(%rsp),%rax
  jne    L24
  mov    $0x1,%eax
  jmp    L117
L89:
  lea    D18(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
L117:
  mov    0xa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L118
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L118:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D36
data_type: f64
name: disassemble_data
arguments: data_label: D2
data_type: byte[8]
name: disassemble_data
arguments: data_label: D22
data_type: qword[2]
name: disassemble_data
arguments: data_label: D24
data_type: f32[4]
name: disassemble_data
arguments: data_label: D18
data_type: string

tool: D36: 1

tool: {"D2": [0x95,0xd6,0x26,0xe8,0x0b,0x2e,0x01,0x3e]}

tool: {"D22": [0x7fffffffffffffff,0x0000000000000000]}

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

tool: D18: Total form factor is too far from unity.

assistant: ```c
SetUp3(npatch, loop, area, rho, emiss, coeff, diag, rhs) int npatch, loop[][2];
double area[], rho[][3], emiss[][3], coeff[][8192], diag[][8192], rhs[][8192];
{
  int j, iface, ipatch, jpatch;
  double tmp1, vtmp1[3], vtmp2[3];
  for (iface = 0; iface < 6; iface++) {
    for (j = 0; j < 3; j++) {
      vtmp1[j] = 1.0 / rho[iface][j];
      vtmp2[j] = emiss[iface][j] * vtmp1[j];
    }
    for (ipatch = loop[iface][0]; ipatch <= loop[iface][1]; ipatch++) {
      tmp1 = 0.0;
      for (jpatch = 0; jpatch < loop[iface][0]; jpatch++) {
        tmp1 += coeff[ipatch][jpatch];
      }
      for (jpatch = loop[iface][1] + 1; jpatch < npatch; jpatch++) {
        tmp1 += coeff[ipatch][jpatch];
      }
      if (fabs(tmp1 - area[ipatch]) > (0.5e-9 * tmp1)) {
        printf("Total form factor is too far from unity.\n");
        return ((1 == 0));
      }
      tmp1 = -tmp1;
      for (jpatch = loop[iface][0]; jpatch <= loop[iface][1]; jpatch++) {
        coeff[ipatch][jpatch] = 0.0;
      }
      for (j = 0; j < 3; j++) {
        diag[j][ipatch] = vtmp1[j] * tmp1;
        rhs[j][ipatch] = vtmp2[j] * tmp1;
      }
    }
  }
  return ((!(1 == 0)));
}
```