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

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x4,%esi
  mov    $0x400000,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x400000,%edi
  mov    %rax,0x10(%rsp)
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x400000,%edi
  mov    %rax,0x18(%rsp)
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x400000,%edi
  mov    %rax,0x28(%rsp)
  mov    %rax,%r12
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x400000,%edi
  mov    %rax,0x30(%rsp)
  mov    %rax,%r13
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x400000,%edi
  mov    %rax,0x38(%rsp)
  mov    %rax,%r15
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x201804,%edi
  mov    %rax,0x20(%rsp)
  mov    %rax,%r14
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    $0x201804,%edi
  mov    %rax,%rbp
  call   <calloc@plt>
  mov    %r13,%r9
  mov    %r12,%r8
  mov    $0x800,%esi
  mov    %rax,0x8(%rsp)
  mov    %rax,%rbx
  mov    $0x800,%edi
  movss  D183(%rip),%xmm4
  push   %r14
  movss  D66(%rip),%xmm2
  push   %r15
  movss  D216(%rip),%xmm3
  movaps %xmm4,%xmm0
  mov    0x28(%rsp),%rcx
  mov    0x20(%rsp),%rdx
  movaps %xmm2,%xmm1
  call   <fill_coeffs@plt>
  lea    0x806010(%rbx),%rax
  pop    %rdx
  pop    %rcx
  cmp    %rax,%rbp
  jae    L48
  lea    0x806010(%rbp),%rdx
  cmp    %rdx,%rbx
  jb     L88
L48:
  mov    $0x806010,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    0x8(%rsp),%rdi
  mov    $0x806010,%edx
  xor    %esi,%esi
  call   <memset@plt>
L139:
  mov    $0x800,%edx
  mov    $0x800,%esi
  lea    D60(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%esi
  lea    D209(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  call   <StartTimer@plt>
  push   %rbp
  push   0x10(%rsp)
  mov    0x28(%rsp),%r13
  mov    0x20(%rsp),%rbx
  mov    0x48(%rsp),%r15
  mov    0x40(%rsp),%r14
  mov    %r13,%rsi
  mov    0x38(%rsp),%r12
  mov    0x30(%rsp),%r9
  mov    %rbx,%rdi
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %r12,%rdx
  call   <red_kernel@plt>
  pxor   %xmm0,%xmm0
  pxor   %xmm4,%xmm4
  mov    %r13,%rsi
  cvtsi2ss %rax,%xmm0
  mov    %rbx,%rdi
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    $0x1,%r13d
  lea    D187(%rip),%rbx
  addss  %xmm4,%xmm0
  movss  %xmm0,0x10(%rsp)
  push   0x18(%rsp)
  push   %rbp
  mov    0x40(%rsp),%r9
  call   <black_kernel@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  addss  0x20(%rsp),%xmm0
  add    $0x20,%rsp
  mulss  D211(%rip),%xmm0
  call   <sqrt@plt>
  mov    %r13d,%eax
  mov    %rbp,%r13
  movaps %xmm0,%xmm1
  mov    %eax,%ebp
L125:
  movss  D29(%rip),%xmm7
  comiss %xmm1,%xmm7
  ja     L137
L85:
  add    $0x1,%ebp
  cmp    $0xf4241,%ebp
  je     L137
  push   %r13
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    %r12,%rdx
  push   0x10(%rsp)
  mov    0x30(%rsp),%r9
  mov    0x28(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  call   <red_kernel@plt>
  pxor   %xmm0,%xmm0
  pxor   %xmm6,%xmm6
  mov    %r15,%r8
  cvtsi2ss %rax,%xmm0
  mov    %r14,%rcx
  mov    %r12,%rdx
  addss  %xmm6,%xmm0
  movss  %xmm0,0x10(%rsp)
  push   0x18(%rsp)
  push   %r13
  mov    0x40(%rsp),%r9
  mov    0x38(%rsp),%rsi
  mov    0x30(%rsp),%rdi
  call   <black_kernel@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  addss  0x20(%rsp),%xmm0
  add    $0x20,%rsp
  mulss  D211(%rip),%xmm0
  call   <sqrt@plt>
  imul   $0xc28f5c29,%ebp,%eax
  movaps %xmm0,%xmm1
  ror    $0x2,%eax
  cmp    $0x28f5c28,%eax
  ja     L125
  mov    %ebp,%esi
  mov    %rbx,%rdi
  mov    $0x1,%eax
  movss  %xmm1,(%rsp)
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  movss  (%rsp),%xmm1
  movss  D29(%rip),%xmm7
  comiss %xmm1,%xmm7
  jbe    L85
L137:
  mov    %ebp,%eax
  mov    %r13,%rbp
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <GetTimer@plt>
  lea    D149(%rip),%rdi
  movsd  %xmm0,(%rsp)
  call   <puts@plt>
  mov    %r13d,%esi
  lea    D182(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  movsd  (%rsp),%xmm0
  lea    D54(%rip),%rdi
  divsd  D215(%rip),%xmm0
  call   <printf@plt>
  lea    D141(%rip),%rsi
  lea    D157(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L25
  mov    %rax,%rcx
  mov    $0xd,%edx
  mov    $0x1,%esi
  mov    $0x1,%r14d
  lea    D2(%rip),%rdi
  lea    D50(%rip),%rbx
  mov    %r14d,%r12d
  call   <fwrite@plt>
L120:
  lea    -0x1(%r12),%eax
  pxor   %xmm1,%xmm1
  mov    $0x402,%r14d
  mov    $0x1,%r15d
  cvtsi2ss %eax,%xmm1
  mulss  D66(%rip),%xmm1
  mov    %r14d,%eax
  mov    %r12d,%r14d
  addss  D148(%rip),%xmm1
  mov    %eax,%r12d
  cvtss2sd %xmm1,%xmm1
  jmp    L109
  nopl   (%rax)
L107:
  and    $0x1,%eax
  pxor   %xmm2,%xmm2
  add    %r14d,%eax
  sar    %eax
  add    %r12d,%eax
  cltq
  cvtss2sd 0x0(%rbp,%rax,4),%xmm2
L116:
  mov    %rbx,%rsi
  mov    %r13,%rdi
  mov    $0x3,%eax
  movsd  %xmm1,(%rsp)
  call   <fprintf@plt>
  add    $0x402,%r12d
  movsd  (%rsp),%xmm1
  cmp    $0x801,%r15d
  je     L24
L109:
  mov    %r15d,%eax
  pxor   %xmm0,%xmm0
  add    $0x1,%r15d
  lea    -0x1(%rax),%ecx
  cvtsi2ss %ecx,%xmm0
  mulss  D66(%rip),%xmm0
  lea    (%r14,%rax,1),%ecx
  addss  D148(%rip),%xmm0
  and    $0x1,%ecx
  cvtss2sd %xmm0,%xmm0
  je     L107
  mov    %r15d,%eax
  mov    0x8(%rsp),%rdx
  pxor   %xmm2,%xmm2
  and    $0x1,%eax
  add    %r14d,%eax
  sar    %eax
  add    %r12d,%eax
  cltq
  cvtss2sd (%rdx,%rax,4),%xmm2
  jmp    L116
L24:
  mov    %r14d,%r12d
  mov    %r13,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  add    $0x1,%r12d
  cmp    $0x801,%r12d
  jne    L120
L25:
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    0x8(%rsp),%rcx
  mov    %rbp,%rax
  sub    %rbp,%rcx
L31:
  movl   $0x0,(%rax)
  movl   $0x0,(%rcx,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L31
  jmp    L139
```

tool_calls: name: disassemble_data
arguments: data_tag: D183
datatype: f32
name: disassemble_data
arguments: data_tag: D66
datatype: byte[4]
name: disassemble_data
arguments: data_tag: D216
datatype: f32
name: disassemble_data
arguments: data_tag: D60
datatype: string
name: disassemble_data
arguments: data_tag: D209
datatype: string
name: disassemble_data
arguments: data_tag: D187
datatype: string
name: disassemble_data
arguments: data_tag: D211
datatype: byte[4]
name: disassemble_data
arguments: data_tag: D29
datatype: byte[4]
name: disassemble_data
arguments: data_tag: D149
datatype: string
name: disassemble_data
arguments: data_tag: D182
datatype: string
name: disassemble_data
arguments: data_tag: D54
datatype: string
name: disassemble_data
arguments: data_tag: D215
datatype: byte[8]
name: disassemble_data
arguments: data_tag: D141
datatype: string
name: disassemble_data
arguments: data_tag: D157
datatype: string
name: disassemble_data
arguments: data_tag: D2
datatype: string
name: disassemble_data
arguments: data_tag: D50
datatype: string
name: disassemble_data
arguments: data_tag: D148
datatype: byte[4]

tool: D183: 1

tool: {"D66": [0x00,0x00,0x00,0x3a]}

tool: D216: 0.01

tool: D60: Problem size: %d x %d 


tool: D209: Max threads: %d


tool: D187: %5d, %0.6f


tool: {"D211": [0x00,0x00,0x80,0x34]}

tool: {"D29": [0xbd,0x37,0x86,0x35]}

tool: D149: CPU

tool: D182: Iterations: %i


tool: D54: Total time: %f s


tool: {"D215": [0x00,0x00,0x00,0x00,0x00,0x40,0x8f,0x40]}

tool: D141: w

tool: D157: temp_cpu.dat

tool: D2: #x	y	temp(K)


tool: D50: %f	%f	%f


tool: {"D148": [0x00,0x00,0x80,0x39]}

assistant: ```c
int main(void) {
  float L = 1.0;
  float H = 1.0;
  float width = 0.01;
  float th_cond = 1.0;
  float TN = 1.0;
  float tol = 1.e-6;
  int num_rows = (2048 / 2) + 2;
  int num_cols = 2048 + 2;
  int size_temp = num_rows * num_cols;
  int size = 2048 * 2048;
  float dx = L / 2048;
  float dy = H / 2048;
  int iter;
  int it_max = 1e6;
  float *restrict aP, *restrict aW, *restrict aE, *restrict aS, *restrict aN, *restrict b;
  float *restrict temp_red, *restrict temp_black;
  aP = (float *)calloc(size, sizeof(float));
  aW = (float *)calloc(size, sizeof(float));
  aE = (float *)calloc(size, sizeof(float));
  aS = (float *)calloc(size, sizeof(float));
  aN = (float *)calloc(size, sizeof(float));
  b = (float *)calloc(size, sizeof(float));
  temp_red = (float *)calloc(size_temp, sizeof(float));
  temp_black = (float *)calloc(size_temp, sizeof(float));
  fill_coeffs(2048, 2048, th_cond, dx, dy, width, TN, aP, aW, aE, aS, aN, b);
  int i;
  for (i = 0; i < size_temp; ++i) {
    temp_red[i] = 0.0f;
    temp_black[i] = 0.0f;
  }
  printf("Problem size: %d x %d \n", 2048, 2048);
  printf("Max threads: %d\n", 1);
  StartTimer();
#pragma acc data copyin(aP [0:SIZE], aW [0:SIZE], aE [0:SIZE], aS [0:SIZE], aN [0:SIZE], b [0:SIZE]) copy(temp_red [0:SIZET], temp_black [0:SIZET])
  for (iter = 1; iter <= it_max; ++iter) {
    float norm_L2 = 0.0f;
    norm_L2 += red_kernel(aP, aW, aE, aS, aN, b, temp_black, temp_red);
    norm_L2 += black_kernel(aP, aW, aE, aS, aN, b, temp_red, temp_black);
    norm_L2 = sqrt(norm_L2 / ((float)size));
    if (iter % 100 == 0)
      printf("%5d, %0.6f\n", iter, norm_L2);
    if (norm_L2 < tol) {
      break;
    }
  }
  double runtime = GetTimer();
  printf("CPU\n");
  printf("Iterations: %i\n", iter);
  printf("Total time: %f s\n", runtime / 1000);
  FILE *pfile;
  pfile = fopen("temp_cpu.dat", "w");
  if (pfile != NULL) {
    fprintf(pfile, "#x\ty\ttemp(K)\n");
    int row, col;
    for (row = 1; row < 2048 + 1; ++row) {
      for (col = 1; col < 2048 + 1; ++col) {
        float x_pos = (col - 1) * dx + (dx / 2);
        float y_pos = (row - 1) * dy + (dy / 2);
        if ((row + col) % 2 == 0) {
          int ind = col * num_rows + (row + (col % 2)) / 2;
          fprintf(pfile, "%f\t%f\t%f\n", x_pos, y_pos, temp_red[ind]);
        } else {
          int ind = col * num_rows + (row + ((col + 1) % 2)) / 2;
          fprintf(pfile, "%f\t%f\t%f\n", x_pos, y_pos, temp_black[ind]);
        }
      }
      fprintf(pfile, "\n");
    }
  }
  fclose(pfile);
  free(aP);
  free(aW);
  free(aE);
  free(aS);
  free(aN);
  free(b);
  free(temp_red);
  free(temp_black);
  return 0;
}
```