user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0x1,%r14d
  lea    D109(%rip),%rbp
  jmp    L78
L48:
  test   %ebx,%ebx
  js     L367
  mov    %r15d,%edx
  mov    %r14d,%esi
  lea    D14(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L258:
  add    $0x1,%r14d
L78:
  lea    0x10(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  test   %rax,%rax
  je     L268
  mov    0x10(%rsp),%esi
  test   %esi,%esi
  je     L268
  mov    $0x0,%ebx
  mov    $0x1,%r12d
  jle    L249
L164:
  lea    0x14(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  add    0x14(%rsp),%ebx
  add    $0x1,%r12d
  mov    0x10(%rsp),%esi
  cmp    %r12d,%esi
  jge    L164
L249:
  mov    %ebx,%r12d
  neg    %r12d
  cmovs  %ebx,%r12d
  mov    %r12d,%edi
  call   <isdivisable@plt>
  mov    %eax,%ecx
  test   %eax,%eax
  je     L209
  mov    %r12d,%eax
  cltd
  idiv   %ecx
  mov    %eax,%r12d
  mov    0x10(%rsp),%eax
  cltd
  idiv   %ecx
  mov    %eax,0x10(%rsp)
L209:
  mov    %r12d,%eax
  cltd
  idivl  0x10(%rsp)
  mov    %edx,0x8(%rsp)
  mov    %eax,%r15d
  mov    %eax,%edi
  call   <countchar@plt>
  mov    %eax,0x4(%rsp)
  mov    0x10(%rsp),%edi
  call   <countchar@plt>
  mov    %eax,%r13d
  mov    0x8(%rsp),%edi
  call   <countchar@plt>
  mov    %eax,0xc(%rsp)
  mov    0x10(%rsp),%eax
  cmp    $0x1,%eax
  je     L48
  cmp    %r12d,%eax
  jge    L298
  mov    0x4(%rsp),%eax
  lea    (%rax,%r13,1),%r12d
  test   %ebx,%ebx
  jg     L329
  jns    L258
  mov    %r14d,%esi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  sub    0xc(%rsp),%r12d
  cmp    $0xffffffff,%r12d
  jl     L380
  mov    $0x0,%ebx
L75:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %ebx,%eax
  add    $0x1,%ebx
  cmp    %eax,%r12d
  jge    L75
L380:
  mov    0x8(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r15d,%esi
  lea    D33(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L66
  mov    $0x0,%ebx
L134:
  mov    $0x2d,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L134
L66:
  mov    $0xa,%edi
  call   <putchar@plt>
  cmpl   $0xffffffff,0x4(%rsp)
  jl     L128
  mov    $0x0,%ebx
L371:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %ebx,%eax
  add    $0x1,%ebx
  cmp    %eax,0x4(%rsp)
  jge    L371
L128:
  mov    0x10(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L258
L367:
  mov    %r15d,%edx
  mov    %r14d,%esi
  lea    D66(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L258
L329:
  mov    %r14d,%esi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  sub    0xc(%rsp),%r12d
  test   %r12d,%r12d
  jle    L229
  mov    $0x0,%ebx
L136:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %r12d,%ebx
  jne    L136
L229:
  mov    0x8(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r15d,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L288
  mov    $0x0,%ebx
L142:
  mov    $0x2d,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L142
L288:
  mov    $0xa,%edi
  call   <putchar@plt>
  cmpl   $0x0,0x4(%rsp)
  jle    L364
  mov    $0x0,%ebx
L262:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %ebx,0x4(%rsp)
  jne    L262
L364:
  mov    0x10(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L258
L298:
  jle    L258
  test   %ebx,%ebx
  jg     L160
  jns    L258
  mov    %r14d,%esi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13d,%r12d
  sub    0xc(%rsp),%r12d
  cmp    $0xffffffff,%r12d
  jl     L233
  mov    $0x0,%ebx
L315:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %ebx,%eax
  add    $0x1,%ebx
  cmp    %eax,%r12d
  jge    L315
L233:
  mov    0x8(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D3(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L6
  mov    $0x0,%ebx
L279:
  mov    $0x2d,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L279
L6:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    0x10(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L258
L160:
  mov    %r14d,%esi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13d,%r12d
  sub    0xc(%rsp),%r12d
  test   %r12d,%r12d
  jle    L59
  mov    $0x0,%ebx
L84:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %r12d,%ebx
  jne    L84
L59:
  mov    0x8(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r13d,%r13d
  jle    L181
  mov    $0x0,%ebx
L248:
  mov    $0x2d,%edi
  call   <putchar@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L248
L181:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x10(%rsp),%esi
  lea    D87(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L258
L268:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L176
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L176:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D109
type_infered: string
name: disassemble_data
arguments: tag: D14
type_infered: string
name: disassemble_data
arguments: tag: D32
type_infered: string
name: disassemble_data
arguments: tag: D87
type_infered: string
name: disassemble_data
arguments: tag: D33
type_infered: string
name: disassemble_data
arguments: tag: D66
type_infered: string
name: disassemble_data
arguments: tag: D3
type_infered: string

tool: D109: %d

tool: D14: Case %d:
%d


tool: D32: Case %d:


tool: D87: %d


tool: D33: - %d

tool: D66: Case %d:
- %d


tool: D3: - 

assistant: ```c
int main() {
  int n, i, j, k, l = 1, m, p, a, b, c, in_avg, rest, total;
  while (scanf("%d", &n) && n) {
    b = 0, m = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a);
      b = b + a;
    }
    c = abs(b);
    m = isdivisable(c, n);
    if (m != 0) {
      c = c / m;
      n = n / m;
    }
    in_avg = c / n;
    rest = c - in_avg * n;
    j = countchar(in_avg);
    k = countchar(n);
    p = countchar(rest);
    total = j + k;
    if (n == 1) {
      if (b < 0) {
        printf("Case %d:\n- %d\n", l, in_avg);
      } else {
        printf("Case %d:\n%d\n", l, in_avg);
      }
    } else if (c > n) {
      if (b > 0) {
        printf("Case %d:\n", l);
        for (i = 0; i < total - p; i++) {
          printf(" ");
        }
        printf("%d\n", rest);
        printf("%d", in_avg);
        for (i = 0; i < total - j; i++) {
          printf("-");
        }
        printf("\n");
        for (i = 0; i < total - k; i++) {
          printf(" ");
        }
        printf("%d\n", n);
      } else if (b < 0) {
        printf("Case %d:\n", l);
        for (i = 0; i < total - p + 2; i++) {
          printf(" ");
        }
        printf("%d\n", rest);
        printf("- %d", in_avg);
        for (i = 0; i < total - j; i++) {
          printf("-");
        }
        printf("\n");
        for (i = 0; i < total - k + 2; i++) {
          printf(" ");
        }
        printf("%d\n", n);
      }
    } else if (c < n) {
      if (b > 0) {
        printf("Case %d:\n", l);
        for (i = 0; i < k - p; i++) {
          printf(" ");
        }
        printf("%d\n", rest);
        for (i = 0; i < k; i++) {
          printf("-");
        }
        printf("\n");
        printf("%d\n", n);
      } else if (b < 0) {
        printf("Case %d:\n", l);
        for (i = 0; i < k - p + 2; i++) {
          printf(" ");
        }
        printf("%d\n", rest);
        printf("- ");
        for (i = 0; i < k; i++) {
          printf("-");
        }
        printf("\n");
        for (i = 0; i < 2; i++) {
          printf(" ");
        }
        printf("%d\n", n);
      }
    }
    l++;
  }
  return 0;
}
```