user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<get_global_flags_old>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xf8,%rsp
  mov    %rdi,%r15
  mov    %rsi,(%rsp)
  mov    %rdx,%r10
  mov    %rdx,0x10(%rsp)
  mov    %rcx,%rdi
  mov    %rcx,0x20(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %r9,0x18(%rsp)
  mov    0x130(%rsp),%rax
  mov    %rax,%rbx
  mov    %rax,0x28(%rsp)
  mov    0x138(%rsp),%eax
  mov    0x140(%rsp),%rdx
  mov    %fs:0x28,%rcx
  mov    %rcx,0xe8(%rsp)
  xor    %ecx,%ecx
  movb   $0x0,(%rbx)
  movq   $0x0,(%rdi)
  movq   $0x0,(%r10)
  movq   $0x0,(%r15)
  movq   $0x0,(%rsi)
  movq   $0x0,(%r8)
  movq   $0x0,(%r9)
  cmp    $0x1,%eax
  jle    L348
  lea    0x8(%rdx),%rbx
  lea    -0x2(%rax),%eax
  lea    0x10(%rdx,%rax,8),%r14
  lea    D185(%rip),%r13
  jmp    L376
L507:
  lea    0x38(%rsp),%rsi
  lea    0x44(%rsp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x38(%rsp),%rax
  movsbl (%rax),%esi
  lea    D233(%rip),%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L456
  lea    -0x1(%rbp),%eax
  cmp    $0x1f,%eax
  ja     L456
  lea    -0x1(%rbp),%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  or     %rax,(%r15)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
L422:
  add    $0x8,%rbx
  cmp    %rbx,%r14
  je     L348
L376:
  mov    %rbx,%r12
  lea    0x40(%rsp),%rbp
  mov    $0x20,%edx
  mov    (%rbx),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <strncpy2@plt>
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <strlower@plt>
  mov    $0x4,%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L507
  lea    0x40(%rsp),%rsi
  mov    $0x7,%edx
  lea    D140(%rip),%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L138
  lea    0x40(%rsp),%rsi
  mov    $0x6,%edx
  lea    D111(%rip),%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L64
  lea    0x40(%rsp),%rsi
  mov    $0x9,%edx
  lea    D105(%rip),%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L587
  lea    0x40(%rsp),%rsi
  lea    D253(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L87
  mov    0x10(%rsp),%rax
  orq    $0x10000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L456:
  lea    0x60(%rsp),%rbx
  mov    (%r12),%rdx
  lea    D43(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L138:
  lea    0x38(%rsp),%rsi
  lea    0x47(%rsp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x38(%rsp),%rax
  movsbl (%rax),%esi
  lea    D233(%rip),%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L101
  lea    -0x1(%rbp),%eax
  cmp    $0x1f,%eax
  ja     L101
  lea    -0x1(%rbp),%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  mov    (%rsp),%rcx
  or     %rax,(%rcx)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L101:
  lea    0x60(%rsp),%rbx
  mov    (%r12),%rdx
  lea    D230(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L64:
  lea    0x38(%rsp),%rsi
  lea    0x46(%rsp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x38(%rsp),%rax
  movsbl (%rax),%esi
  lea    D233(%rip),%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L210
  lea    -0x1(%rbp),%eax
  cmp    $0x1f,%eax
  ja     L210
  lea    -0x1(%rbp),%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  mov    0x8(%rsp),%rcx
  or     %rax,(%rcx)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L210:
  lea    0x60(%rsp),%rbx
  mov    (%r12),%rdx
  lea    D131(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L587:
  lea    0x38(%rsp),%rsi
  lea    0x49(%rsp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x38(%rsp),%rax
  movsbl (%rax),%esi
  lea    D233(%rip),%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L542
  lea    -0x1(%rbp),%eax
  cmp    $0x1f,%eax
  ja     L542
  lea    -0x1(%rbp),%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  mov    0x18(%rsp),%rcx
  or     %rax,(%rcx)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L542:
  lea    0x60(%rsp),%rbx
  mov    (%r12),%rdx
  lea    D30(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L87:
  lea    0x40(%rsp),%rsi
  lea    D59(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L225
  mov    0x20(%rsp),%rax
  orq    $0x10000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L225:
  lea    0x40(%rsp),%rsi
  lea    D229(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L572
  mov    0x10(%rsp),%rax
  orq    $0x20000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L572:
  lea    0x40(%rsp),%rsi
  lea    D207(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L179
  mov    0x20(%rsp),%rax
  orq    $0x20000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L179:
  lea    0x40(%rsp),%rsi
  lea    D38(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L49
  mov    0x10(%rsp),%rax
  orq    $0x200000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L49:
  lea    0x40(%rsp),%rsi
  lea    D147(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L609
  mov    0x20(%rsp),%rax
  orq    $0x200000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L609:
  lea    0x40(%rsp),%rsi
  lea    D4(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L349
  mov    0x10(%rsp),%rax
  orq    $0x40000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L349:
  lea    0x40(%rsp),%rsi
  lea    D151(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L162
  mov    0x20(%rsp),%rax
  orq    $0x40000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L162:
  lea    0x40(%rsp),%rsi
  lea    D28(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L160
  mov    0x20(%rsp),%rax
  orq    $0x140000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L160:
  lea    0x40(%rsp),%rsi
  lea    D53(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L530
  mov    0x10(%rsp),%rax
  orq    $0x140000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L530:
  lea    0x40(%rsp),%rsi
  lea    D152(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L446
  mov    0x10(%rsp),%rax
  orq    $0x100000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L446:
  lea    0x40(%rsp),%rsi
  lea    D254(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L625
  mov    0x20(%rsp),%rax
  orq    $0x100000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L625:
  lea    0x40(%rsp),%rsi
  lea    D79(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L435
  mov    0x10(%rsp),%rax
  orq    $0x80000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L435:
  lea    0x40(%rsp),%rsi
  lea    D93(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L558
  mov    0x20(%rsp),%rax
  orq    $0x80000,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L558:
  lea    0x40(%rsp),%rsi
  lea    D146(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L649
  mov    0x28(%rsp),%rax
  orb    $0x1,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L649:
  lea    0x40(%rsp),%rsi
  lea    D282(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L422
  mov    0x28(%rsp),%rax
  orb    $0x2,(%rax)
  mov    (%rbx),%rax
  movb   $0x0,(%rax)
  jmp    L422
L348:
  mov    0x10(%rsp),%rcx
  mov    (%rcx),%rax
  mov    0x20(%rsp),%rbx
  mov    %rax,%rdx
  or     (%rbx),%rdx
  test   $0x80000,%edx
  je     L455
  test   $0x140000,%eax
  jne    L455
  or     $0x40000,%rax
  mov    %rax,(%rcx)
L455:
  mov    (%r15),%rax
  mov    (%rsp),%rcx
  and    (%rcx),%rax
  jne    L596
  mov    0x8(%rsp),%rax
  mov    (%rax),%rax
  mov    0x18(%rsp),%rcx
  and    (%rcx),%rax
  jne    L168
  mov    0x10(%rsp),%rax
  mov    (%rax),%rax
  mov    0x20(%rsp),%rcx
  and    (%rcx),%rax
  jne    L68
  mov    0x28(%rsp),%rax
  cmpb   $0x3,(%rax)
  je     L334
  mov    $0x0,%eax
L106:
  mov    0xe8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L368
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L596:
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L168:
  lea    D268(%rip),%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L68:
  lea    D273(%rip),%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L334:
  lea    D189(%rip),%rdi
  mov    $0x0,%eax
  call   <store_error_message@plt>
  mov    $0xffffffff,%eax
  jmp    L106
L368:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D185
data_type: string
name: read_data
arguments: tag: D233
data_type: string
name: read_data
arguments: tag: D140
data_type: string
name: read_data
arguments: tag: D111
data_type: string
name: read_data
arguments: tag: D105
data_type: string
name: read_data
arguments: tag: D253
data_type: string
name: read_data
arguments: tag: D43
data_type: string
name: read_data
arguments: tag: D230
data_type: string
name: read_data
arguments: tag: D131
data_type: string
name: read_data
arguments: tag: D30
data_type: string
name: read_data
arguments: tag: D59
data_type: string
name: read_data
arguments: tag: D229
data_type: string
name: read_data
arguments: tag: D207
data_type: string
name: read_data
arguments: tag: D38
data_type: string
name: read_data
arguments: tag: D147
data_type: string
name: read_data
arguments: tag: D4
data_type: string
name: read_data
arguments: tag: D151
data_type: string
name: read_data
arguments: tag: D28
data_type: string
name: read_data
arguments: tag: D53
data_type: string
name: read_data
arguments: tag: D152
data_type: string
name: read_data
arguments: tag: D254
data_type: string
name: read_data
arguments: tag: D79
data_type: string
name: read_data
arguments: tag: D93
data_type: string
name: read_data
arguments: tag: D146
data_type: string
name: read_data
arguments: tag: D282
data_type: string
name: read_data
arguments: tag: D31
data_type: string
name: read_data
arguments: tag: D268
data_type: string
name: read_data
arguments: tag: D273
data_type: string
name: read_data
arguments: tag: D189
data_type: string

tool: D185: flag

tool: D233:  /t/n

tool: D140: notflag

tool: D111: czflag

tool: D105: notczflag

tool: D253: night

tool: D43: Invalid flag launch parameter '%s'

tool: D230: Invalid notflag launch parameter '%s'

tool: D131: Invalid cxflag launch parameter '%s'

tool: D30: Invalid notczflag launch parameter '%s'

tool: D59: notnight

tool: D229: dark

tool: D207: notdark

tool: D38: tamper

tool: D147: nottamper

tool: D4: armed

tool: D151: notarmed

tool: D28: disarmed

tool: D53: notdisarmed

tool: D152: armpending

tool: D254: notarmpending

tool: D79: home

tool: D93: away

tool: D146: continue

tool: D282: break

tool: D31: Conflicting common flag/notflag in launch conditions.

tool: D268: Conflicting czflag/notczflag in launch conditions.

tool: D273: Conflicting global flag/notflag in launch conditions.

tool: D189: Conflicting continue/break in launch conditions.

assistant: ```c
int get_global_flags_old(unsigned long *cflags, unsigned long *notcflags, unsigned long *sflags, unsigned long *notsflags, unsigned long *czflags, unsigned long *notczflags, unsigned char *scanmode, int tokc, char **tokv) {
  int k, flag;
  char *sp;
  char errmsg[128];
  char tbuf[32];
  *sflags = *notsflags = *scanmode = 0;
  for (k = 0; k < 1; k++) {
    cflags[k] = 0;
    notcflags[k] = 0;
  }
  for (k = 0; k < 1; k++) {
    czflags[k] = 0;
    notczflags[k] = 0;
  }
  for (k = 1; k < tokc; k++) {
    strncpy2(tbuf, tokv[k], (sizeof(tbuf)));
    strlower(tbuf);
    if (strncmp("flag", tbuf, 4) == 0) {
      flag = (int)strtol(tbuf + 4, &sp, 10);
      if (!strchr(" /t/n", *sp) || flag < 1 || flag > (32 * 1)) {
        sprintf(errmsg, "Invalid flag launch parameter '%s'", tokv[k]);
        store_error_message(errmsg);
        return -1;
      }
      cflags[(flag - 1) / 32] |= 1UL << ((flag - 1) % 32);
      *tokv[k] = '\0';
    } else if (strncmp("notflag", tbuf, 7) == 0) {
      flag = (int)strtol(tbuf + 7, &sp, 10);
      if (!strchr(" /t/n", *sp) || flag < 1 || flag > (32 * 1)) {
        sprintf(errmsg, "Invalid notflag launch parameter '%s'", tokv[k]);
        store_error_message(errmsg);
        return -1;
      }
      notcflags[(flag - 1) / 32] |= 1UL << ((flag - 1) % 32);
      *tokv[k] = '\0';
    } else if (strncmp("czflag", tbuf, 6) == 0) {
      flag = (int)strtol(tbuf + 6, &sp, 10);
      if (!strchr(" /t/n", *sp) || flag < 1 || flag > (32 * 1)) {
        sprintf(errmsg, "Invalid cxflag launch parameter '%s'", tokv[k]);
        store_error_message(errmsg);
        return -1;
      }
      czflags[(flag - 1) / 32] |= 1UL << ((flag - 1) % 32);
      *tokv[k] = '\0';
    } else if (strncmp("notczflag", tbuf, 9) == 0) {
      flag = (int)strtol(tbuf + 9, &sp, 10);
      if (!strchr(" /t/n", *sp) || flag < 1 || flag > (32 * 1)) {
        sprintf(errmsg, "Invalid notczflag launch parameter '%s'", tokv[k]);
        store_error_message(errmsg);
        return -1;
      }
      notczflags[(flag - 1) / 32] |= 1UL << ((flag - 1) % 32);
      *tokv[k] = '\0';
    } else if (strcmp("night", tbuf) == 0) {
      *sflags |= (0x01 << 16);
      *tokv[k] = '\0';
    } else if (strcmp("notnight", tbuf) == 0) {
      *notsflags |= (0x01 << 16);
      *tokv[k] = '\0';
    } else if (strcmp("dark", tbuf) == 0) {
      *sflags |= (0x02 << 16);
      *tokv[k] = '\0';
    } else if (strcmp("notdark", tbuf) == 0) {
      *notsflags |= (0x02 << 16);
      *tokv[k] = '\0';
    } else if (strcmp("tamper", tbuf) == 0) {
      *sflags |= (0x08 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("nottamper", tbuf) == 0) {
      *notsflags |= (0x08 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("armed", tbuf) == 0) {
      *sflags |= (0x01 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("notarmed", tbuf) == 0) {
      *notsflags |= (0x01 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("disarmed", tbuf) == 0) {
      *notsflags |= ((0x01 << 18) | (0x04 << 18));
      *tokv[k] = '\0';
    } else if (strcmp("notdisarmed", tbuf) == 0) {
      *sflags |= ((0x01 << 18) | (0x04 << 18));
      *tokv[k] = '\0';
    } else if (strcmp("armpending", tbuf) == 0) {
      *sflags |= (0x04 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("notarmpending", tbuf) == 0) {
      *notsflags |= (0x04 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("home", tbuf) == 0) {
      *sflags |= (0x02 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("away", tbuf) == 0) {
      *notsflags |= (0x02 << 18);
      *tokv[k] = '\0';
    } else if (strcmp("continue", tbuf) == 0) {
      *scanmode |= 1;
      *tokv[k] = '\0';
    } else if (strcmp("break", tbuf) == 0) {
      *scanmode |= 2;
      *tokv[k] = '\0';
    }
  }
  if (((*sflags | *notsflags) & (0x02 << 18)) && !(*sflags & ((0x01 << 18) | (0x04 << 18)))) {
    *sflags |= (0x01 << 18);
  }
  for (k = 0; k < 1; k++) {
    if (cflags[k] & notcflags[k]) {
      store_error_message("Conflicting common flag/notflag in launch conditions.");
      return -1;
    }
  }
  for (k = 0; k < 1; k++) {
    if (czflags[k] & notczflags[k]) {
      store_error_message("Conflicting czflag/notczflag in launch conditions.");
      return -1;
    }
  }
  if (*sflags & *notsflags) {
    store_error_message("Conflicting global flag/notflag in launch conditions.");
    return -1;
  }
  if (*scanmode == (1 | 2)) {
    store_error_message("Conflicting continue/break in launch conditions.");
    return -1;
  }
  return 0;
}
```