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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    0x8(%rsi),%rdi
  lea    D12(%rip),%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    $0x1,%eax
  test   %rbp,%rbp
  je     L117
  lea    D15(%rip),%r12
  xor    %eax,%eax
  mov    %rsp,%rdx
  mov    %rbp,%rdi
  mov    %r12,%rsi
  call   <fscanf@plt>
  test   %rax,%rax
  js     L147
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fscanf@plt>
  test   %rax,%rax
  js     L147
  mov    (%rsp),%edi
  imul   0x4(%rsp),%edi
  call   <malloc@plt>
  mov    (%rsp),%edi
  imul   0x4(%rsp),%edi
  mov    %rax,%r15
  call   <malloc@plt>
  mov    %rax,%r12
  test   %r15,%r15
  je     L138
  test   %rax,%rax
  je     L138
  xor    %eax,%eax
  mov    %r15,%rdx
  lea    D2(%rip),%rsi
  mov    %rbp,%rdi
  call   <fscanf@plt>
  test   %rax,%rax
  js     L202
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x18(%r13),%rdi
  call   <atoi@plt>
  mov    %r15,%rdi
  mov    %eax,%r14d
  call   <rle_decode@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L113
  mov    (%rsp),%eax
  imul   0x4(%rsp),%eax
  mov    $0x1,%ebx
  test   %eax,%eax
  jg     L157
  jmp    L205
  nopl   0x0(%rax,%rax,1)
L110:
  add    $0x1,%rbx
L157:
  movsbl -0x1(%rbp,%rbx,1),%edi
  call   <putchar@plt>
  mov    0x4(%rsp),%ecx
  mov    (%rsp),%edx
  mov    %ebx,%eax
  imul   %ecx,%edx
  cmp    %ebx,%edx
  jle    L205
  cltd
  idiv   %ecx
  test   %edx,%edx
  jne    L110
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L110
L147:
  mov    $0x2,%eax
L117:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L202:
  mov    $0x4,%eax
  jmp    L117
L205:
  mov    $0xa,%edi
  call   <putchar@plt>
  test   %r14d,%r14d
  jle    L101
  nopl   0x0(%rax,%rax,1)
L0:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x4(%rsp),%ecx
  mov    (%rsp),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <nextWorld@plt>
  mov    0x4(%rsp),%eax
  imul   (%rsp),%eax
  test   %eax,%eax
  jle    L35
  movsbl (%r12),%edi
  mov    $0x1,%ebx
  mov    %dil,0x0(%rbp)
  jmp    L49
L174:
  add    $0x1,%rbx
L49:
  call   <putchar@plt>
  mov    (%rsp),%edx
  imul   0x4(%rsp),%edx
  mov    %ebx,%eax
  cmp    %ebx,%edx
  jle    L35
  movsbl (%r12,%rbx,1),%edi
  cltd
  mov    %dil,0x0(%rbp,%rbx,1)
  idivl  0x4(%rsp)
  test   %edx,%edx
  jne    L174
  mov    $0xa,%edi
  call   <putchar@plt>
  movsbl 0x0(%rbp,%rbx,1),%edi
  jmp    L174
  nopl   0x0(%rax,%rax,1)
L35:
  mov    $0xa,%edi
  call   <putchar@plt>
  sub    $0x1,%r14d
  jne    L0
L101:
  mov    0x10(%r13),%rdi
  lea    D43(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L92
  mov    %rbp,%rdi
  call   <rle_encode@plt>
  mov    0x4(%rsp),%ecx
  mov    (%rsp),%edx
  mov    %r12,%rdi
  mov    %rax,%r8
  lea    D39(%rip),%rsi
  call   <fprintf@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
  jmp    L117
L138:
  mov    $0x3,%eax
  jmp    L117
L92:
  mov    $0x6,%eax
  jmp    L117
L113:
  mov    $0x5,%eax
  jmp    L117
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D12
datatype: string
name: retrieve_data
arguments: data_label: D15
datatype: string
name: retrieve_data
arguments: data_label: D2
datatype: string
name: retrieve_data
arguments: data_label: D43
datatype: string
name: retrieve_data
arguments: data_label: D39
datatype: string

tool: D12: r

tool: D15: %d

tool: D2: %s

tool: D43: w

tool: D39: %d %d
%s

assistant: ```c
int main(int argc, char **argv) {
  FILE *file = fopen(argv[1], "r");
  if (!file)
    return 1;
  int height, width;
  if (fscanf(file, "%d", &height) < 0)
    return 2;
  if (fscanf(file, "%d", &width) < 0)
    return 2;
  char *str = malloc(height * width * sizeof(char));
  char *tmpstr = malloc(height * width * sizeof(char));
  if (!str || !tmpstr)
    return 3;
  if (fscanf(file, "%s", str) < 0)
    return 4;
  fclose(file);
  int count = atoi(argv[3]);
  str = rle_decode(str);
  if (!str)
    return 5;
  if (!0) {
    for (int i = 0; i < height * width; i++) {
      if ((i % width == 0) && (i != 0))
        printf("\n");
      printf("%c", str[i]);
    }
    printf("\n");
  }
  while (count > 0) {
    if (!0)
      printf("\n");
    nextWorld(str, tmpstr, height, width);
    for (int i = 0; i < height * width; i++) {
      str[i] = tmpstr[i];
      if (!0 && (i % width == 0) && (i != 0))
        printf("\n");
      if (!0)
        printf("%c", str[i]);
    }
    if (!0)
      printf("\n");
    count--;
  }
  file = fopen(argv[2], "w");
  if (!file)
    return 6;
  fprintf(file, "%d %d\n%s", height, width, rle_encode(str));
  fclose(file);
  return 0;
}
```