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

```asm
<do_math>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    D7(%rip),%rbx
  mov    %rbx,%rdi
  call   <uart_puts@plt>
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  test   %r12d,%r12d
  jle    L16
  mov    %rbp,%rbx
  lea    -0x1(%r12),%eax
  lea    0x1(%rbp,%rax,1),%r12
  mov    $0x0,%ecx
  mov    $0x0,%ebp
  lea    0x2e(%rsp),%r13
  jmp    L155
L64:
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  movslq %ebp,%rax
  lea    -0x2(%rsp),%rdx
  mov    %edx,(%rsp,%rax,4)
  mov    $0xa,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <reset_string@plt>
  add    $0x1,%ebp
  mov    $0x0,%ecx
  jmp    L107
L30:
  cmp    $0x2b,%esi
  jne    L154
  movslq %ebp,%rax
  movl   $0x2b,(%rsp,%rax,4)
L107:
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L42
L155:
  movzbl (%rbx),%eax
  movzbl %al,%esi
  cmp    $0x20,%al
  je     L64
  movzbl %al,%edx
  sub    $0x31,%edx
  cmp    $0x7,%edx
  ja     L30
  movslq %ecx,%rdx
  add    %al,0x2e(%rsp,%rdx,1)
  add    $0x1,%ecx
  jmp    L107
L42:
  test   %ebp,%ebp
  jle    L123
  mov    %rsp,%rbx
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  lea    D24(%rip),%r14
L97:
  cmpl   $0x2b,0x4(%rbx)
  je     L10
L27:
  add    $0x3,%r12d
  add    $0xc,%rbx
  cmp    %r12d,%ebp
  jg     L97
L28:
  lea    D3(%rip),%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  lea    0x30(%r13),%edi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  mov    $0x1,%eax
L131:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L68
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L10:
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <uart_puts@plt>
  mov    0x8(%rbx),%r13d
  add    (%rbx),%r13d
  jmp    L27
L16:
  mov    $0x0,%r13d
  jmp    L28
L123:
  mov    $0x0,%r13d
  jmp    L28
L154:
  mov    $0x0,%eax
  jmp    L131
L68:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D7
type: string
name: read_data
arguments: tag: D24
type: string
name: read_data
arguments: tag: D3
type: string

tool: D7: 


tool: D24: Adding 

tool: D3: Result is 

assistant: ```c
int do_math(unsigned char instr[], int array_size) {
  int i = 0;
  int j = 0;
  int k = 0;
  int nums[10];
  int res = 0;
  int l;
  char cur_str[10];
  uart_puts("\r\n");
  uart_puts(instr);
  uart_puts("\r\n");
  while (i < array_size) {
    l = (int)instr[i];
    if (l == 32) {
      uart_puts(cur_str);
      nums[j] = cur_str - '0';
      reset_string(cur_str, 10);
      k = 0;
      j++;
    } else if (l > 48 & l < 57) {
      cur_str[k] += instr[i];
      k++;
    } else if (l == 43) {
      nums[j] = 43;
    } else {
      return 0;
    }
    i++;
  }
  i = 0;
  int n1;
  int n2;
  while (i < j) {
    if (nums[i + 1] == 43) {
      uart_puts("Adding ");
      n1 = nums[i];
      n2 = nums[i + 2];
      res = n1 + n2;
    }
    i += 3;
  }
  uart_puts("Result is ");
  uart_puts(res + '0');
  uart_puts("\r\n");
  return 1;
}
```