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

```asm
<main>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  cmp    $0x4,%edi
  je     L423
  mov    (%rsi),%rsi
  lea    D57(%rip),%rdi
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
L423:
  mov    0x10(%r15),%rdi
  call   <strlen@plt>
  mov    0x10(%r15),%rsi
  mov    %eax,%edx
  cmp    $0xb,%eax
  je     L157
  cmp    $0xc,%eax
  je     L267
  cmp    $0xd,%eax
  jne    L500
  cmpb   $0x2b,(%rsi)
  je     L44
L500:
  lea    D106(%rip),%rdi
  xor    %eax,%eax
  lea    0x2c(%rsp),%rbx
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
L426:
  lea    0x38(%rsp),%rbp
  mov    %rbx,%r12
  lea    D38(%rip),%r14
  lea    D67(%rip),%r13
  jmp    L130
  nopl   0x0(%rax,%rax,1)
L98:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <printf@plt>
L140:
  mov    $0xffffffff,%edi
  call   <exit@plt>
L78:
  add    $0x1,%r12
  cmp    %r12,%rbp
  je     L203
L130:
  movzbl (%r12),%esi
  lea    -0x30(%rsi),%eax
  cmp    $0x9,%al
  jbe    L78
  lea    -0x20(%rsi),%eax
  cmp    $0x5e,%al
  ja     L98
  movsbl %sil,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L140
  nopl   0x0(%rax,%rax,1)
L203:
  mov    0x18(%r15),%rdi
  call   <strlen@plt>
  mov    %eax,0x4(%rsp)
  cmp    $0xa0,%eax
  jg     L194
  mov    0x4(%rsp),%edx
  test   %edx,%edx
  jg     L89
  lea    D103(%rip),%rdi
  call   <puts@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
L89:
  mov    0x4(%rsp),%eax
  lea    0x0(,%rax,8),%r13d
  sub    %eax,%r13d
  mov    %r13d,%eax
  mov    %r13d,0x1c(%rsp)
  mov    %r13d,%edi
  test   $0x7,%al
  je     L171
  mov    $0x8,%ecx
  cltd
  idiv   %ecx
  sub    %edx,%ecx
  add    %ecx,%edi
  mov    %edi,0x1c(%rsp)
L171:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  lea    0x7(%rax),%r12d
  cmovns %eax,%r12d
  sar    $0x3,%r12d
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L43
L354:
  mov    %r12d,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  jle    L204
  movslq 0x4(%rsp),%r11
  xor    %ecx,%ecx
  xor    %r14d,%r14d
  mov    $0x1,%r9d
  jmp    L282
  cs nopw 0x0(%rax,%rax,1)
L250:
  lea    (%r9,%r9,1),%esi
L256:
  test   $0x4,%al
  je     L75
  movslq %r14d,%rax
  or     %r9b,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%eax
L75:
  cmp    $0x100,%esi
  je     L64
  lea    (%rsi,%rsi,1),%edi
L124:
  test   $0x8,%al
  je     L115
  movslq %r14d,%rax
  or     %sil,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%eax
L115:
  cmp    $0x100,%edi
  je     L474
  lea    (%rdi,%rdi,1),%esi
L132:
  test   $0x10,%al
  je     L456
  movslq %r14d,%rax
  or     %dil,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%eax
L456:
  cmp    $0x100,%esi
  je     L514
  lea    (%rsi,%rsi,1),%edi
L462:
  test   $0x20,%al
  je     L165
  movslq %r14d,%rax
  or     %sil,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%eax
L165:
  cmp    $0x100,%edi
  je     L340
  lea    (%rdi,%rdi,1),%r9d
  test   $0x40,%al
  je     L314
  movslq %r14d,%rax
  or     %dil,0x0(%r13,%rax,1)
L314:
  cmp    $0x100,%r9d
  jne    L240
  add    $0x1,%r14d
  mov    $0x1,%r9d
L240:
  add    $0x1,%rcx
  cmp    %rcx,%r11
  je     L204
L282:
  mov    0x18(%r15),%rax
  add    %rcx,%rax
  movzbl (%rax),%esi
  lea    -0x20(%rsi),%edi
  cmp    $0x5e,%dil
  ja     L93
L72:
  cmp    $0x24,%sil
  jne    L504
  movb   $0x2,(%rax)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%esi
L504:
  test   $0x1,%sil
  je     L220
  movslq %r14d,%rax
  or     %r9b,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%esi
L220:
  lea    (%r9,%r9,1),%edi
  shl    $0x2,%r9d
  cmp    $0x100,%edi
  jne    L212
  add    $0x1,%r14d
  mov    $0x2,%r9d
  mov    $0x1,%edi
L212:
  movzbl %sil,%eax
  and    $0x2,%esi
  je     L241
  movslq %r14d,%rax
  or     %dil,0x0(%r13,%rax,1)
  mov    0x18(%r15),%rax
  movzbl (%rax,%rcx,1),%eax
L241:
  cmp    $0x100,%r9d
  jne    L250
  add    $0x1,%r14d
  mov    $0x2,%esi
  mov    $0x1,%r9d
  jmp    L256
  nopl   0x0(%rax)
L340:
  add    $0x1,%r14d
  mov    $0x2,%r9d
  test   $0x40,%al
  je     L240
  movslq %r14d,%rax
  add    $0x1,%rcx
  orb    $0x1,0x0(%r13,%rax,1)
  cmp    %rcx,%r11
  jne    L282
L204:
  mov    0x8(%r15),%rdi
  lea    D144(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L92
L293:
  mov    %r14,%rcx
  mov    $0xb,%edx
  mov    $0x1,%esi
  lea    D33(%rip),%rdi
  lea    D44(%rip),%r15
  call   <fwrite@plt>
  mov    %r14,%rdi
  call   <fflush@plt>
  lea    0xe(%r12),%edx
  mov    %r14,%rdi
  xor    %eax,%eax
  lea    D108(%rip),%rsi
  call   <fprintf@plt>
  mov    %r14,%rdi
  call   <fflush@plt>
  mov    %r14,%rcx
  mov    $0xa,%edx
  mov    $0x1,%esi
  lea    D56(%rip),%rdi
  call   <fwrite@plt>
  nopl   0x0(%rax,%rax,1)
L273:
  movsbl (%rbx),%ecx
  movsbl 0x1(%rbx),%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x2,%rbx
  call   <fprintf@plt>
  cmp    %rbx,%rbp
  jne    L273
  mov    %r14,%rcx
  mov    $0x6,%edx
  mov    $0x1,%esi
  xor    %ebx,%ebx
  lea    D74(%rip),%rdi
  lea    D48(%rip),%rbp
  call   <fwrite@plt>
  mov    0x4(%rsp),%edx
  xor    %eax,%eax
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <fprintf@plt>
  cmpl   $0x7,0x1c(%rsp)
  jle    L167
  nopw   0x0(%rax,%rax,1)
L83:
  movzbl 0x0(%r13,%rbx,1),%edx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <fprintf@plt>
  cmp    %ebx,%r12d
  jg     L83
L167:
  mov    %r14,%rsi
  mov    $0x1a,%edi
  call   <fputc@plt>
  mov    %r14,%rdi
  call   <fflush@plt>
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L491
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L514:
  add    $0x1,%r14d
  mov    $0x2,%edi
  mov    $0x1,%esi
  jmp    L462
  nopl   0x0(%rax,%rax,1)
L64:
  add    $0x1,%r14d
  mov    $0x2,%edi
  mov    $0x1,%esi
  jmp    L124
  nopl   0x0(%rax,%rax,1)
L474:
  add    $0x1,%r14d
  mov    $0x2,%esi
  mov    $0x1,%edi
  jmp    L132
  nopl   0x0(%rax,%rax,1)
L93:
  lea    D153(%rip),%rdi
  xor    %eax,%eax
  mov    %r11,0x10(%rsp)
  mov    %r9d,0x18(%rsp)
  mov    %rcx,0x8(%rsp)
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  mov    0x8(%rsp),%rcx
  mov    0x18(%r15),%rax
  mov    0x10(%rsp),%r11
  mov    0x18(%rsp),%r9d
  add    %rcx,%rax
  movzbl (%rax),%esi
  jmp    L72
L157:
  cmpb   $0x30,(%rsi)
  jne    L500
  add    $0x1,%rsi
  lea    0x2e(%rsp),%rdi
  mov    $0xa,%edx
  movw   $0x3434,0x2c(%rsp)
  call   <memcpy@plt>
  lea    0x2c(%rsp),%rbx
  jmp    L426
L194:
  mov    $0xc,%esi
  lea    D158(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L89
L267:
  lea    0x2c(%rsp),%rbx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  jmp    L426
L92:
  lea    D89(%rip),%rdi
  call   <perror@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L293
L43:
  mov    %r12d,%esi
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L354
L44:
  lea    0x2c(%rsp),%rbx
  add    $0x1,%rsi
  mov    $0xc,%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  jmp    L426
L491:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D57
type_guessed: string
name: parse_data
arguments: label: D106
type_guessed: string
name: parse_data
arguments: label: D38
type_guessed: string
name: parse_data
arguments: label: D67
type_guessed: string
name: parse_data
arguments: label: D103
type_guessed: string
name: parse_data
arguments: label: D144
type_guessed: string
name: parse_data
arguments: label: D33
type_guessed: string
name: parse_data
arguments: label: D44
type_guessed: string
name: parse_data
arguments: label: D108
type_guessed: string
name: parse_data
arguments: label: D56
type_guessed: string
name: parse_data
arguments: label: D74
type_guessed: string
name: parse_data
arguments: label: D48
type_guessed: string
name: parse_data
arguments: label: D153
type_guessed: string
name: parse_data
arguments: label: D158
type_guessed: string
name: parse_data
arguments: label: D89
type_guessed: string
name: parse_data
arguments: label: D5
type_guessed: string

tool: D57: usage: %s </dev/device> <phone-no> <sms text>


tool: D106: Invalid length for phone number '%s': %i


tool: D38: Invalid char in phone number: '%c'


tool: D67: Invalid char in phone number: 0x'%.2X'


tool: D103: No text supplied for the SMS.

tool: D144: wb

tool: D33: AT+CMGF=0


tool: D44: %c%c

tool: D108: AT+CMGS=%i


tool: D56: 0011000C91

tool: D74: 0000AA

tool: D48: %.2X

tool: D153: Invalid character in text input: 0x'%.2X'


tool: D158: Text is too long at %i chars. Max is 160.


tool: D89: Unable to open output device

tool: D5: Unable to malloc '%i' bytes for variable 'sms_string'


assistant: ```c
int main(int argc, char **argv) {
  FILE *output_device;
  char target_phone[12];
  unsigned char *sms_string;
  int i, l, m, n;
  int intext_length, sms_string_length;
  if (argc != 4) {
    printf("usage: %s </dev/device> <phone-no> <sms text>\n", argv[0]);
    exit(-1);
  }
  i = strlen((argv[2]));
  if (i == 11 && (argv[2])[0] == '0') {
    target_phone[0] = '4';
    target_phone[1] = '4';
    memcpy(target_phone + 2, (argv[2]) + 1, 10);
  } else if (i == 12) {
    memcpy(target_phone, (argv[2]), 12);
  } else if (i == 13 && (argv[2])[0] == '+') {
    memcpy(target_phone, (argv[2]) + 1, 12);
  } else {
    printf("Invalid length for phone number '%s': %i\n", (argv[2]), i);
    exit(-1);
  }
  for (i = 0; i < 12; i++) {
    if (target_phone[i] < '0' || target_phone[i] > '9') {
      if (((unsigned char)target_phone[i]) < 32 || ((unsigned char)target_phone[i]) > 126)
        printf("Invalid char in phone number: 0x'%.2X'\n", (unsigned char)target_phone[i]);
      else
        printf("Invalid char in phone number: '%c'\n", target_phone[i]);
      exit(-1);
    }
  }
  intext_length = strlen((argv[3]));
  if (intext_length > 160) {
    printf("Text is too long at %i chars. Max is 160.\n", i);
    exit(-1);
  }
  if (intext_length < 1) {
    printf("No text supplied for the SMS.\n");
    exit(-1);
  }
  i = intext_length * 7;
  m = i % 8;
  if (m != 0)
    i += (8 - m);
  sms_string_length = i / 8;
  sms_string = malloc(sms_string_length);
  if (sms_string == NULL) {
    printf("Unable to malloc '%i' bytes for variable 'sms_string'\n", sms_string_length);
    exit(-1);
  }
  memset(sms_string, 0, sms_string_length);
  l = 1;
  m = 0;
  for (i = 0; i < intext_length; i++) {
    if (((unsigned char)(argv[3])[i]) < 32 || ((unsigned char)(argv[3])[i]) > 126) {
      printf("Invalid character in text input: 0x'%.2X'\n", (unsigned char)(argv[3])[i]);
      exit(-1);
    }
    if ((argv[3])[i] == '$') {
      (argv[3])[i] = 0x02;
    }
    for (n = 0; n < 7; n++) {
      if (((unsigned char)(argv[3])[i]) & (1 << n)) {
        sms_string[m] |= l;
      }
      l = l << 1;
      if (l == 256) {
        l = 1;
        m++;
      }
    }
  }
  output_device = fopen((argv[1]), "wb");
  if (output_device == NULL) {
    perror("Unable to open output device");
    exit(-1);
  }
  fprintf(output_device, "AT+CMGF=0\r\n");
  fflush(output_device);
  fprintf(output_device, "AT+CMGS=%i\r\n", 14 + sms_string_length);
  fflush(output_device);
  fprintf(output_device, "0011000C91");
  for (i = 0; i < 12; i += 2) {
    fprintf(output_device, "%c%c", target_phone[i + 1], target_phone[i]);
  }
  fprintf(output_device, "0000AA");
  fprintf(output_device, "%.2X", intext_length);
  for (i = 0; i < sms_string_length; i++)
    fprintf(output_device, "%.2X", sms_string[i]);
  fprintf(output_device, "%c", 0x1a);
  fflush(output_device);
  fclose(output_device);
  free(sms_string);
  return 0;
}
```