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

```asm
<CreateTestImage>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,(%rsp)
  mov    %esi,%r13d
  mov    %edx,%r15d
  cmp    $0x2,%ecx
  je     L349
  jg     L55
  test   %ecx,%ecx
  je     L70
  cmp    $0x1,%ecx
  jne    L252
  test   %edx,%edx
  jle    L252
  mov    (%rsp),%rsi
  mov    %rsi,%rcx
  lea    -0x1(%rdx),%eax
  lea    0x8(%rsi,%rax,8),%rdi
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%rsi
  jmp    L46
L55:
  cmp    $0x3,%ecx
  jne    L252
  test   %edx,%edx
  jle    L246
  mov    (%rsp),%rsi
  mov    %rsi,%rcx
  lea    -0x1(%rdx),%eax
  lea    0x8(%rsi,%rax,8),%rdi
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%rsi
  jmp    L193
L349:
  test   %edx,%edx
  jle    L252
  mov    (%rsp),%r9
  lea    0x1(%rdx),%r10d
  mov    $0x1,%edi
  jmp    L300
L70:
  test   %edx,%edx
  jle    L252
  mov    (%rsp),%rsi
  mov    %rsi,%rcx
  lea    -0x1(%rdx),%eax
  lea    0x8(%rsi,%rax,8),%rdi
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%rsi
  jmp    L265
L175:
  mov    (%rcx),%rdx
  movl   $0x0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rsi
  jne    L175
L168:
  add    $0x8,%rcx
  cmp    %rcx,%rdi
  je     L252
L265:
  mov    $0x0,%eax
  test   %r13d,%r13d
  jg     L175
  jmp    L168
L331:
  mov    (%rcx),%rdx
  movl   $0x1,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L331
L7:
  add    $0x8,%rcx
  cmp    %rdi,%rcx
  je     L252
L46:
  mov    $0x0,%eax
  test   %r13d,%r13d
  jg     L331
  jmp    L7
L363:
  add    $0x1,%ecx
  mov    (%r9),%r8
  mov    %ecx,%eax
  cltd
  idiv   %edi
  mov    %edx,(%r8,%rsi,1)
  add    $0x4,%rsi
  cmp    %r13d,%ecx
  jne    L363
L237:
  add    $0x1,%rdi
  add    $0x8,%r9
  cmp    %r10,%rdi
  je     L252
L300:
  mov    $0x0,%esi
  mov    $0x0,%ecx
  test   %r13d,%r13d
  jg     L363
  jmp    L237
L250:
  mov    (%rcx),%rdx
  movl   $0x0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L250
L155:
  add    $0x8,%rcx
  cmp    %rdi,%rcx
  je     L246
L193:
  mov    $0x0,%eax
  test   %r13d,%r13d
  jg     L250
  jmp    L155
L246:
  mov    %r15d,%eax
  imul   %r13d,%eax
  movslq %eax,%rbp
  imul   $0x66666667,%rbp,%rbp
  sar    $0x22,%rbp
  cltd
  sub    %edx,%ebp
  cmp    $0x9,%eax
  jle    L49
  mov    $0x0,%ebx
L140:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %r13d
  mov    %edx,%r12d
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %r15d
  movslq %edx,%rax
  movslq %r12d,%rdx
  mov    (%rsp),%rsi
  mov    (%rsi,%rax,8),%rax
  addl   $0x1,(%rax,%rdx,4)
  add    $0x1,%ebx
  cmp    %ebp,%ebx
  jl     L140
L49:
  movl   $0xa,0xc(%rsp)
  jmp    L278
L371:
  cltq
  movslq %ebx,%rbx
  mov    (%rsp),%rdi
  mov    (%rdi,%rax,8),%rax
  addl   $0x1,(%rax,%rbx,4)
L39:
  sub    $0x1,%ebp
  je     L8
L334:
  mov    $0x0,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x4,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x1e,%edx,%edx
  sub    %edx,%eax
  lea    -0xf(%r12,%rax,1),%ebx
  mov    $0x0,%eax
  call   <rand@plt>
  test   %ebx,%ebx
  js     L39
  cmp    %ebx,%r13d
  jle    L39
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x4,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x1e,%edx,%edx
  sub    %edx,%eax
  lea    -0xf(%r14,%rax,1),%eax
  test   %eax,%eax
  js     L39
  cmp    %eax,%r15d
  jg     L371
  jmp    L39
L8:
  subl   $0x1,0xc(%rsp)
  je     L252
L278:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %r13d
  mov    %edx,%r12d
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %r15d
  mov    %edx,%r14d
  mov    $0xfa,%ebp
  jmp    L334
L252:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void CreateTestImage(int **img, int w, int h, int mode) {
  int x, y;
  switch (mode) {
  case 0:
    for (y = 0; y < h; y++) {
      for (x = 0; x < w; x++) {
        img[y][x] = 0;
      }
    }
    break;
  case 1:
    for (y = 0; y < h; y++) {
      for (x = 0; x < w; x++) {
        img[y][x] = 1;
      }
    }
    break;
  case 2:
    for (y = 0; y < h; y++) {
      for (x = 0; x < w; x++) {
        img[y][x] = (x + 1) % (y + 1);
      }
    }
    break;
  case 3:
    for (y = 0; y < h; y++) {
      for (x = 0; x < w; x++) {
        img[y][x] = 0;
      }
    }
    for (int i = 0; i < w * h / 10; i++) {
      x = rand() % w;
      y = rand() % h;
      img[y][x] += 1;
    }
    for (int i = 0; i < 10; i++) {
      x = rand() % w;
      y = rand() % h;
      for (int j = 0; j < 250; j++) {
        int xs = x + rand() % 30 - 15;
        int ys = y + rand() % 30 - 15;
        if (xs < 0 || xs >= w || ys < 0 || ys >= h)
          continue;
        img[ys][xs] += 1;
      }
    }
  }
}
```