user: What is the c source code of the assembly code below?

```asm
<generate_heightmap>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  xor    %edi,%edi
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  movss  %xmm0,0x10(%rsp)
  mov    %edx,0x24(%rsp)
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  xor    %eax,%eax
  call   <rand@plt>
  movslq %eax,%rbp
  cltd
  imul   $0x68db8bad,%rbp,%rbp
  sar    $0x2b,%rbp
  sub    %edx,%ebp
  imul   $0x1388,%ebp,%edx
  sub    %edx,%eax
  mov    %eax,%ebp
  xor    %eax,%eax
  call   <rand@plt>
  movslq %eax,%r14
  cltd
  imul   $0x68db8bad,%r14,%r14
  sar    $0x2b,%r14
  sub    %edx,%r14d
  imul   $0x1388,%r14d,%edx
  sub    %edx,%eax
  mov    %eax,%r14d
  xor    %eax,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0x68db8bad,%rdx,%rdx
  sar    $0x2b,%rdx
  mov    %rdx,%rcx
  cltd
  sub    %edx,%ecx
  imul   $0x1388,%ecx,%edx
  sub    %edx,%eax
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <rand@plt>
  mov    %r13d,%ecx
  mov    %ebp,%esi
  lea    D2(%rip),%rdi
  movslq %eax,%rbx
  imul   $0x68db8bad,%rbx,%rbx
  sar    $0x2b,%rbx
  cltd
  sub    %edx,%ebx
  imul   $0x1388,%ebx,%edx
  sub    %edx,%eax
  mov    (%r15),%rdx
  mov    %eax,%ebx
  movslq %r12d,%rax
  shl    $0x2,%rax
  mov    %ebp,(%rdx)
  mov    %ebx,%r8d
  mov    %r14d,-0x4(%rdx,%rax,1)
  movslq 0x24(%rsp),%rdx
  mov    -0x8(%r15,%rdx,8),%rdx
  mov    %r13d,(%rdx)
  mov    %ebx,-0x4(%rdx,%rax,1)
  mov    %r14d,%edx
  call   <printf@plt>
  mov    0x24(%rsp),%edi
  lea    -0x1(%r12),%ecx
  mov    %ebp,%esi
  mov    %r12d,0x18(%rsp)
  mov    %ebx,%r8d
  lea    -0x1(%rdi),%eax
  mov    $0x4,%edi
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  mov    %ecx,%eax
  sar    %edx
  shr    $0x1f,%eax
  add    %ecx,%eax
  movslq %edx,%rdx
  mov    %r13d,%ecx
  mov    (%r15,%rdx,8),%rdx
  sar    %eax
  cltq
  lea    (%rdx,%rax,4),%r12
  mov    %r14d,%edx
  call   <average@plt>
  mov    0x18(%rsp),%edi
  mov    %eax,(%r12)
  mov    %edi,%r12d
  shr    $0x1f,%r12d
  mov    %r12d,%eax
  add    %edi,%eax
  sar    %eax
  mov    %eax,0x2c(%rsp)
  cmp    $0x1,%edi
  jle    L104
  mov    0x24(%rsp),%edi
  mov    %eax,%r14d
  mov    %edi,%eax
  shr    $0x1f,%eax
  add    %edi,%eax
  sar    %eax
  mov    %eax,0x28(%rsp)
  nopl   0x0(%rax)
L68:
  mov    0x28(%rsp),%eax
  cltd
  idiv   %r14d
  mov    %eax,0x20(%rsp)
  test   %eax,%eax
  jle    L51
  mov    0x2c(%rsp),%eax
  lea    (%r14,%r14,1),%ebx
  mov    %r14d,%r12d
  mov    %r14d,%ebp
  movl   $0x0,0x1c(%rsp)
  cltd
  mov    %ebx,0x8(%rsp)
  idiv   %r14d
  mov    0x24(%rsp),%r14d
  mov    %eax,0x14(%rsp)
  nopl   0x0(%rax,%rax,1)
L52:
  mov    0x14(%rsp),%eax
  mov    %ebp,%r13d
  xor    %ebx,%ebx
  test   %eax,%eax
  jle    L93
  mov    %ebx,%eax
  mov    %ebp,%ebx
  mov    %r13d,%ebp
  mov    %eax,%r13d
  nop
L76:
  movss  0x10(%rsp),%xmm0
  mov    0x18(%rsp),%esi
  mov    %ebp,%ecx
  mov    %ebx,%r9d
  mov    %r12d,%r8d
  mov    %r14d,%edx
  mov    %r15,%rdi
  add    $0x1,%r13d
  call   <diamond@plt>
  add    0x8(%rsp),%ebp
  cmp    0x14(%rsp),%r13d
  jne    L76
  mov    %ebx,%ebp
L93:
  addl   $0x1,0x1c(%rsp)
  add    0x8(%rsp),%r12d
  mov    0x1c(%rsp),%eax
  cmp    0x20(%rsp),%eax
  jne    L52
  mov    0x8(%rsp),%ebx
  mov    %ebp,%r14d
  mov    0x14(%rsp),%ebp
  xor    %r13d,%r13d
  mov    %r13d,0x14(%rsp)
  mov    %r15,0x8(%rsp)
  mov    %ebx,%r13d
  mov    %r14d,%r15d
  mov    %ebp,%r12d
  nopl   0x0(%rax,%rax,1)
L35:
  mov    %r15d,%ebp
  xor    %ebx,%ebx
  test   %r12d,%r12d
  jle    L33
  nopw   0x0(%rax,%rax,1)
L66:
  cmp    $0x1,%r15d
  je     L98
  movss  0x10(%rsp),%xmm0
  mov    0x8(%rsp),%rdi
  mov    %r15d,%ecx
  mov    %ebp,%esi
  mov    %r14d,%edx
  call   <square@plt>
L98:
  add    $0x1,%ebx
  add    %r13d,%ebp
  cmp    %r12d,%ebx
  jne    L66
L33:
  addl   $0x1,0x14(%rsp)
  add    %r13d,%r14d
  mov    0x14(%rsp),%eax
  cmp    0x20(%rsp),%eax
  jne    L35
  mov    %r15d,%r14d
  mov    0x8(%rsp),%r15
L51:
  cmp    $0x1,%r14d
  je     L104
  mov    %r14d,%eax
  shr    $0x1f,%eax
  add    %r14d,%eax
  sar    %eax
  sub    %eax,%r14d
  test   %r14d,%r14d
  jg     L68
L104:
  add    $0x38,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D2
type_infered: string

tool: D2: Seeds:
%d	%d
%d	%d


assistant: ```c
int **generate_heightmap(int **map, int width, int height, float roughness) {
  srand(time(NULL));
  int seed1, seed2, seed3, seed4;
  seed1 = rand() % 5000;
  seed2 = rand() % 5000;
  seed3 = rand() % 5000;
  seed4 = rand() % 5000;
  map[0][0] = seed1;
  map[0][width - 1] = seed2;
  map[height - 1][0] = seed3;
  map[height - 1][width - 1] = seed4;
  printf("Seeds:\n%d\t%d\n%d\t%d\n", seed1, seed2, seed3, seed4);
  map[(height - 1) / 2][(width - 1) / 2] = average(4, seed1, seed2, seed3, seed4);
  int length = width / 2;
  while (length > 0) {
    for (int y = 0; y < height / 2 / length; y++) {
      for (int x = 0; x < width / 2 / length; x++) {
        diamond(map, width, height, length + (x * 2 * length), length + (y * 2 * length), length, roughness);
      }
    }
    for (int y = 0; y < height / 2 / length; y++) {
      for (int x = 0; x < width / 2 / length; x++) {
        if (length > 1) {
          square(map, length + (x * 2 * length), length + (y * 2 * length), length, roughness);
        }
      }
    }
    if (length == 1)
      length = 0;
    length -= length / 2;
  }
  return map;
}
```