user: 请从给定的汇编指令推导出C源代码:

```asm
<parse_cmdline_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  movq   $0x0,-0x30(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0xa,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x8(%rbp)
L133:
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L138
  mov    -0x30(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x10(%rbp)
  jb     L75
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L33
  mov    -0x8(%rbp),%rax
  add    %rax,-0x30(%rbp)
  addq   $0x1,-0x30(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L103
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  jne    L103
  movq   $0x10,-0x28(%rbp)
  addq   $0x2,-0x30(%rbp)
  jmp    L107
L103:
  movq   $0xa,-0x28(%rbp)
L107:
  mov    -0x30(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x10(%rbp)
  jb     L152
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbq %al,%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x20,-0x18(%rbp)
  je     L16
  cmpq   $0x0,-0x18(%rbp)
  je     L16
  mov    -0x20(%rbp),%rax
  imul   -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  cmpq   $0x39,-0x18(%rbp)
  ja     L61
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  sub    $0x30,%rax
  mov    %rax,-0x20(%rbp)
  jmp    L118
L61:
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  sub    $0x57,%rax
  mov    %rax,-0x20(%rbp)
L118:
  addq   $0x1,-0x30(%rbp)
  jmp    L107
L152:
  nop
  jmp    L16
L33:
  addq   $0x1,-0x30(%rbp)
  jmp    L133
L138:
  nop
  jmp    L150
L75:
  nop
  jmp    L150
L16:
  nop
L150:
  mov    -0x20(%rbp),%rax
  leave
  ret
```

assistant: ```c
int parse_cmdline_int(char *cmdline, char *key) {
  uint32_t i = 0, digit = 0, base = 10;
  int32_t result = 0;
  uint32_t cmdline_len, key_len;
  cmdline_len = strlen(cmdline);
  key_len = strlen(key);
  while (1) {
    if (cmdline[i] == 0)
      break;
    if (i + key_len > cmdline_len)
      break;
    if (!strncmp(key, cmdline + i, key_len)) {
      i += key_len;
      i++;
      if ((cmdline[i] == '0') && (cmdline[i + 1] == 'x')) {
        base = 16;
        i += 2;
      } else {
        base = 10;
      }
      while (1) {
        if (i + key_len > cmdline_len)
          break;
        digit = cmdline[i];
        if ((digit == ' ') || (digit == 0))
          break;
        result *= base;
        if (digit <= '9')
          result += (digit - '0');
        else
          result += ((digit - 'a') + 10);
        i++;
      }
      break;
    }
    i++;
  }
  return result;
}
```