ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<roll_check>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L129
L32:
  movl   $0x0,-0x28(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L53
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
  mov    %eax,-0x28(%rbp)
  jmp    L111
L53:
  mov    -0x34(%rbp),%edx
  movslq %edx,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%ecx
  add    %ecx,%ecx
  add    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  test   %eax,%eax
  je     L111
  mov    -0x34(%rbp),%edx
  movslq %edx,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%ecx
  add    %ecx,%ecx
  add    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %eax,%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <randval@plt>
  add    $0x1,%eax
  mov    %eax,-0x28(%rbp)
L111:
  cmpl   $0x2,-0x2c(%rbp)
  jg     L52
  mov    -0x2c(%rbp),%eax
  cltq
  mov    -0x28(%rbp),%edx
  mov    %edx,-0x14(%rbp,%rax,4)
  jmp    L121
L52:
  movl   $0x0,-0x24(%rbp)
  jmp    L25
L123:
  mov    -0x24(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%eax
  cmp    %eax,-0x28(%rbp)
  jle    L58
  mov    -0x24(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  mov    -0x28(%rbp),%edx
  mov    %edx,-0x14(%rbp,%rax,4)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x28(%rbp)
L58:
  addl   $0x1,-0x24(%rbp)
L25:
  cmpl   $0x2,-0x24(%rbp)
  jle    L123
L121:
  addl   $0x1,-0x2c(%rbp)
L129:
  mov    -0x1c(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jge    L32
  movl   $0x0,-0x20(%rbp)
  jmp    L97
L81:
  mov    -0x20(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%eax
  add    %eax,-0x30(%rbp)
  addl   $0x1,-0x20(%rbp)
L97:
  cmpl   $0x2,-0x20(%rbp)
  jle    L81
  mov    -0x30(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L43
  call   <__stack_chk_fail@plt>
L43:
  leave
  ret
```

assistant: ```c
int roll_check(int skill) {
  int dice = skill / 3;
  int total = 0;
  int roll[3] = {0, 0, 0};
  for (int i = 0; i < dice + 1; i++) {
    int newroll = 0;
    if (i < dice)
      newroll = randval(6) + 1;
    else if (skill % 3)
      newroll = randval((skill % 3) * 2 + 1) + 1;
    if (i < 3)
      roll[i] = newroll;
    else
      for (int j = 0; j < 3; j++)
        if (newroll > roll[j]) {
          int temp = roll[j];
          roll[j] = newroll;
          newroll = temp;
        }
  }
  for (int i = 0; i < 3; i++)
    total += roll[i];
  return total;
}
```
user: What is the c source code of the assembly code below?

```asm
<roll_check>:
  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
  movslq %edi,%rbp
  imul   $0x55555556,%rbp,%rbp
  shr    $0x20,%rbp
  mov    %edi,%eax
  sar    $0x1f,%eax
  sub    %eax,%ebp
  movl   $0x0,0xc(%rsp)
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0x14(%rsp)
  cmp    $0xfffffffe,%edi
  jl     L79
  movslq %edi,%r12
  imul   $0x55555556,%r12,%r12
  shr    $0x20,%r12
  mov    %edi,%eax
  sar    $0x1f,%eax
  sub    %eax,%r12d
  lea    (%r12,%r12,2),%eax
  sub    %eax,%edi
  mov    %edi,%r12d
  lea    0x1(%rdi,%rdi,1),%r14d
  mov    $0x0,%ebx
  mov    %edi,%r13d
  jmp    L83
L13:
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
L22:
  lea    0xc(%rsp),%rdx
  lea    0x18(%rsp),%r8
  cmp    $0x2,%r15d
  jg     L33
  mov    %eax,0xc(%rsp,%rbx,4)
L16:
  add    $0x1,%rbx
  cmp    %ebx,%ebp
  jl     L79
L83:
  mov    %ebx,%r15d
  cmp    %ebx,%ebp
  jg     L13
  mov    %r13d,%eax
  test   %r12d,%r12d
  je     L22
  mov    %r14d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  jmp    L22
L104:
  mov    %edi,(%rsi)
  add    $0x4,%rdx
  cmp    %rdx,%r8
  je     L16
L33:
  mov    %rdx,%rsi
  mov    (%rdx),%ecx
  mov    %ecx,%edi
  cmp    %eax,%ecx
  jge    L104
  mov    %eax,%edi
  mov    %ecx,%eax
  jmp    L104
L79:
  mov    0x10(%rsp),%eax
  add    0xc(%rsp),%eax
  add    0x14(%rsp),%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L107
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L107:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int roll_check(int skill) {
  int dice = skill / 3;
  int total = 0;
  int roll[3] = {0, 0, 0};
  for (int i = 0; i < dice + 1; i++) {
    int newroll = 0;
    if (i < dice)
      newroll = randval(6) + 1;
    else if (skill % 3)
      newroll = randval((skill % 3) * 2 + 1) + 1;
    if (i < 3)
      roll[i] = newroll;
    else
      for (int j = 0; j < 3; j++)
        if (newroll > roll[j]) {
          int temp = roll[j];
          roll[j] = newroll;
          newroll = temp;
        }
  }
  for (int i = 0; i < 3; i++)
    total += roll[i];
  return total;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<roll_check>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  movslq %edi,%rbp
  push   %rbx
  mov    %rbp,%r12
  imul   $0x55555556,%rbp,%rbp
  sub    $0x28,%rsp
  shr    $0x20,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %r12d,%eax
  movl   $0x0,0x14(%rsp)
  movq   $0x0,0xc(%rsp)
  sar    $0x1f,%eax
  sub    %eax,%ebp
  xor    %eax,%eax
  cmp    $0xfffffffe,%r12d
  jl     L49
  lea    0x0(%rbp,%rbp,2),%eax
  xor    %ebx,%ebx
  sub    %eax,%r12d
  lea    0x1(%r12,%r12,1),%r13d
L54:
  cmp    %ebx,%ebp
  jg     L26
  xor    %eax,%eax
  test   %r12d,%r12d
  jne    L106
L0:
  cmp    $0x2,%rbx
  ja     L40
L25:
  mov    %eax,0xc(%rsp,%rbx,4)
L56:
  add    $0x1,%rbx
  cmp    %ebx,%ebp
  jge    L54
  mov    0x10(%rsp),%eax
  add    0xc(%rsp),%eax
  add    0x14(%rsp),%eax
L49:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L17
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L26:
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
  cmp    $0x2,%rbx
  jbe    L25
L40:
  mov    0xc(%rsp),%edx
  cmp    %edx,%eax
  jg     L94
  mov    %edx,%ecx
  mov    %eax,%edx
  mov    %ecx,%eax
L94:
  mov    0x10(%rsp),%ecx
  mov    %eax,0xc(%rsp)
  cmp    %ecx,%edx
  jg     L51
  mov    %ecx,%eax
  mov    %edx,%ecx
  mov    %eax,%edx
L51:
  mov    0x14(%rsp),%eax
  mov    %edx,0x10(%rsp)
  cmp    %ecx,%eax
  cmovl  %ecx,%eax
  mov    %eax,0x14(%rsp)
  jmp    L56
  cs nopw 0x0(%rax,%rax,1)
L106:
  mov    %r13d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  jmp    L0
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int roll_check(int skill) {
  int dice = skill / 3;
  int total = 0;
  int roll[3] = {0, 0, 0};
  for (int i = 0; i < dice + 1; i++) {
    int newroll = 0;
    if (i < dice)
      newroll = randval(6) + 1;
    else if (skill % 3)
      newroll = randval((skill % 3) * 2 + 1) + 1;
    if (i < 3)
      roll[i] = newroll;
    else
      for (int j = 0; j < 3; j++)
        if (newroll > roll[j]) {
          int temp = roll[j];
          roll[j] = newroll;
          newroll = temp;
        }
  }
  for (int i = 0; i < 3; i++)
    total += roll[i];
  return total;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<destroy_tests>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <builtins_destroy@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int destroy_tests(void) {
  builtins_destroy();
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<destroy_tests>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <builtins_destroy@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int destroy_tests(void) {
  builtins_destroy();
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<destroy_tests>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <builtins_destroy@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int destroy_tests(void) {
  builtins_destroy();
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<destroy_tests>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <builtins_destroy@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int destroy_tests(void) {
  builtins_destroy();
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <InitSystemClock@plt>
  mov    $0x0,%eax
  call   <InitPortsIO@plt>
  mov    $0x0,%eax
  call   <InitTimers@plt>
  mov    $0x0,%eax
  call   <EnableInterrupts@plt>
L7:
  jmp    L7
```

assistant: ```c
void main() {
  InitSystemClock();
  InitPortsIO();
  InitTimers();
  EnableInterrupts();
  while (1) {
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <InitSystemClock@plt>
  mov    $0x0,%eax
  call   <InitPortsIO@plt>
  mov    $0x0,%eax
  call   <InitTimers@plt>
  mov    $0x0,%eax
  call   <EnableInterrupts@plt>
L1:
  jmp    L1
```

assistant: ```c
void main() {
  InitSystemClock();
  InitPortsIO();
  InitTimers();
  EnableInterrupts();
  while (1) {
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <InitSystemClock@plt>
  xor    %eax,%eax
  call   <InitPortsIO@plt>
  xor    %eax,%eax
  call   <InitTimers@plt>
  xor    %eax,%eax
  call   <EnableInterrupts@plt>
L8:
  jmp    L8
```

assistant: ```c
void main() {
  InitSystemClock();
  InitPortsIO();
  InitTimers();
  EnableInterrupts();
  while (1) {
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <InitSystemClock@plt>
  xor    %eax,%eax
  call   <InitPortsIO@plt>
  xor    %eax,%eax
  call   <InitTimers@plt>
  xor    %eax,%eax
  call   <EnableInterrupts@plt>
L9:
  jmp    L9
```

assistant: ```c
void main() {
  InitSystemClock();
  InitPortsIO();
  InitTimers();
  EnableInterrupts();
  while (1) {
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<uncomp_mode_type>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0xb0020,-0x18(%rbp)
  je     L125
  cmpq   $0xb0020,-0x18(%rbp)
  jg     L107
  cmpq   $0xa0040,-0x18(%rbp)
  je     L258
  cmpq   $0xa0040,-0x18(%rbp)
  jg     L107
  cmpq   $0x90080,-0x18(%rbp)
  je     L239
  cmpq   $0x90080,-0x18(%rbp)
  jg     L107
  cmpq   $0x80100,-0x18(%rbp)
  je     L231
  cmpq   $0x80100,-0x18(%rbp)
  jg     L107
  cmpq   $0x70200,-0x18(%rbp)
  je     L313
  cmpq   $0x70200,-0x18(%rbp)
  jg     L107
  cmpq   $0x60400,-0x18(%rbp)
  je     L192
  cmpq   $0x60400,-0x18(%rbp)
  jg     L107
  cmpq   $0x50800,-0x18(%rbp)
  je     L138
  cmpq   $0x50800,-0x18(%rbp)
  jg     L107
  cmpq   $0x41000,-0x18(%rbp)
  je     L1
  cmpq   $0x41000,-0x18(%rbp)
  jg     L107
  cmpq   $0x32000,-0x18(%rbp)
  je     L100
  cmpq   $0x32000,-0x18(%rbp)
  jg     L107
  cmpq   $0x18000,-0x18(%rbp)
  je     L59
  cmpq   $0x24000,-0x18(%rbp)
  je     L194
  jmp    L107
L59:
  mov    $0x2,%eax
  jmp    L275
L194:
  mov    $0x3,%eax
  jmp    L275
L100:
  mov    $0x4,%eax
  jmp    L275
L1:
  mov    $0x5,%eax
  jmp    L275
L138:
  mov    $0x6,%eax
  jmp    L275
L192:
  mov    $0x7,%eax
  jmp    L275
L313:
  mov    $0x8,%eax
  jmp    L275
L231:
  mov    $0x9,%eax
  jmp    L275
L239:
  mov    $0xa,%eax
  jmp    L275
L258:
  mov    $0xb,%eax
  jmp    L275
L125:
  mov    $0xc,%eax
  jmp    L275
L107:
  mov    -0x18(%rbp),%rax
  mov    %ax,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  sar    $0x10,%rax
  and    $0xf,%eax
  mov    %ax,-0x2(%rbp)
  cmpw   $0x0,-0x4(%rbp)
  jne    L20
  cmpw   $0xa,-0x2(%rbp)
  jle    L294
L20:
  mov    $0xe,%eax
  jmp    L275
L294:
  mov    $0xffffffff,%eax
L275:
  pop    %rbp
  ret
```

assistant: ```c
short uncomp_mode_type(prefix)
long prefix;
{
  short code;
  short len;
  switch (prefix) {
  case 0x18000L:
    return (2);
  case 0x24000L:
    return (3);
  case 0x32000L:
    return (4);
  case 0x41000L:
    return (5);
  case 0x50800L:
    return (6);
  case 0x60400L:
    return (7);
  case 0x70200L:
    return (8);
  case 0x80100L:
    return (9);
  case 0x90080L:
    return (10);
  case 0xA0040L:
    return (11);
  case 0xB0020L:
    return (12);
  }
  code = prefix & 0xffffL;
  len = (prefix >> 16) & 0xf;
  return ((code || len > 10) ? 14 : -1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<uncomp_mode_type>:
  endbr64
  cmp    $0x60400,%rdi
  je     L89
  jle    L56
  cmp    $0x90080,%rdi
  je     L69
  jle    L126
  mov    $0xb,%eax
  cmp    $0xa0040,%rdi
  je     L37
  cmp    $0xb0020,%rdi
  jne    L38
  mov    $0xc,%eax
  ret
L56:
  cmp    $0x32000,%rdi
  je     L77
  jle    L112
  mov    $0x5,%eax
  cmp    $0x41000,%rdi
  je     L37
  cmp    $0x50800,%rdi
  jne    L38
  mov    $0x6,%eax
  ret
L112:
  mov    $0x2,%eax
  cmp    $0x18000,%rdi
  je     L37
  cmp    $0x24000,%rdi
  jne    L38
  mov    $0x3,%eax
  ret
L126:
  mov    $0x8,%eax
  cmp    $0x70200,%rdi
  je     L37
  cmp    $0x80100,%rdi
  jne    L38
  mov    $0x9,%eax
  ret
L38:
  mov    %rdi,%rax
  sar    $0x10,%rax
  and    $0xf,%eax
  cmp    $0xa,%ax
  jg     L152
  test   %di,%di
  je     L18
L152:
  mov    $0xe,%eax
L37:
  ret
L18:
  mov    $0xffffffff,%eax
  ret
L89:
  mov    $0x7,%eax
  ret
L77:
  mov    $0x4,%eax
  ret
L69:
  mov    $0xa,%eax
  ret
```

assistant: ```c
short uncomp_mode_type(prefix)
long prefix;
{
  short code;
  short len;
  switch (prefix) {
  case 0x18000L:
    return (2);
  case 0x24000L:
    return (3);
  case 0x32000L:
    return (4);
  case 0x41000L:
    return (5);
  case 0x50800L:
    return (6);
  case 0x60400L:
    return (7);
  case 0x70200L:
    return (8);
  case 0x80100L:
    return (9);
  case 0x90080L:
    return (10);
  case 0xA0040L:
    return (11);
  case 0xB0020L:
    return (12);
  }
  code = prefix & 0xffffL;
  len = (prefix >> 16) & 0xf;
  return ((code || len > 10) ? 14 : -1);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<uncomp_mode_type>:
  endbr64
  cmp    $0x60400,%rdi
  je     L158
  jle    L79
  cmp    $0x90080,%rdi
  je     L41
  jle    L2
  mov    $0xb,%eax
  cmp    $0xa0040,%rdi
  je     L117
  cmp    $0xb0020,%rdi
  jne    L82
  mov    $0xc,%eax
  ret
  nop
L79:
  cmp    $0x32000,%rdi
  je     L134
  jle    L105
  mov    $0x5,%eax
  cmp    $0x41000,%rdi
  je     L117
  cmp    $0x50800,%rdi
  jne    L82
  mov    $0x6,%eax
  ret
L82:
  mov    %rdi,%rax
  sar    $0x10,%rax
  and    $0xf,%eax
  cmp    $0xa,%ax
  jle    L125
L92:
  mov    $0xe,%eax
L117:
  ret
  nopw   0x0(%rax,%rax,1)
L2:
  mov    $0x8,%eax
  cmp    $0x70200,%rdi
  je     L117
  cmp    $0x80100,%rdi
  jne    L82
  mov    $0x9,%eax
  ret
  nopl   (%rax)
L105:
  mov    $0x2,%eax
  cmp    $0x18000,%rdi
  je     L117
  cmp    $0x24000,%rdi
  jne    L82
  mov    $0x3,%eax
  ret
  nopl   (%rax)
L41:
  mov    $0xa,%eax
  ret
  xchg   %ax,%ax
L134:
  mov    $0x4,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L158:
  mov    $0x7,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L125:
  test   %di,%di
  jne    L92
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
short uncomp_mode_type(prefix)
long prefix;
{
  short code;
  short len;
  switch (prefix) {
  case 0x18000L:
    return (2);
  case 0x24000L:
    return (3);
  case 0x32000L:
    return (4);
  case 0x41000L:
    return (5);
  case 0x50800L:
    return (6);
  case 0x60400L:
    return (7);
  case 0x70200L:
    return (8);
  case 0x80100L:
    return (9);
  case 0x90080L:
    return (10);
  case 0xA0040L:
    return (11);
  case 0xB0020L:
    return (12);
  }
  code = prefix & 0xffffL;
  len = (prefix >> 16) & 0xf;
  return ((code || len > 10) ? 14 : -1);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<uncomp_mode_type>:
  endbr64
  cmp    $0x60400,%rdi
  je     L8
  jle    L3
  cmp    $0x90080,%rdi
  je     L4
  jle    L153
  mov    $0xb,%eax
  cmp    $0xa0040,%rdi
  je     L16
  cmp    $0xb0020,%rdi
  jne    L159
  mov    $0xc,%eax
  ret
  nop
L3:
  cmp    $0x32000,%rdi
  je     L112
  jle    L46
  mov    $0x5,%eax
  cmp    $0x41000,%rdi
  je     L16
  cmp    $0x50800,%rdi
  jne    L159
  mov    $0x6,%eax
  ret
L159:
  mov    %rdi,%rax
  sar    $0x10,%rax
  and    $0xf,%eax
  cmp    $0xa,%ax
  jle    L156
L96:
  mov    $0xe,%eax
L16:
  ret
  nopw   0x0(%rax,%rax,1)
L153:
  mov    $0x8,%eax
  cmp    $0x70200,%rdi
  je     L16
  cmp    $0x80100,%rdi
  jne    L159
  mov    $0x9,%eax
  ret
  nopl   (%rax)
L46:
  mov    $0x2,%eax
  cmp    $0x18000,%rdi
  je     L16
  cmp    $0x24000,%rdi
  jne    L159
  mov    $0x3,%eax
  ret
  nopl   (%rax)
L4:
  mov    $0xa,%eax
  ret
  xchg   %ax,%ax
L112:
  mov    $0x4,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L8:
  mov    $0x7,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L156:
  test   %di,%di
  jne    L96
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
short uncomp_mode_type(prefix)
long prefix;
{
  short code;
  short len;
  switch (prefix) {
  case 0x18000L:
    return (2);
  case 0x24000L:
    return (3);
  case 0x32000L:
    return (4);
  case 0x41000L:
    return (5);
  case 0x50800L:
    return (6);
  case 0x60400L:
    return (7);
  case 0x70200L:
    return (8);
  case 0x80100L:
    return (9);
  case 0x90080L:
    return (10);
  case 0xA0040L:
    return (11);
  case 0xB0020L:
    return (12);
  }
  code = prefix & 0xffffL;
  len = (prefix >> 16) & 0xf;
  return ((code || len > 10) ? 14 : -1);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Get_File_Spec>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x48(%rbp)
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,-0x4c(%rbp)
  lea    -0x4c(%rbp),%rax
  mov    %rax,%rdi
  call   <localtime@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    0x14(%rax),%edi
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%esi
  mov    -0x40(%rbp),%rax
  mov    0xc(%rax),%r9d
  mov    -0x40(%rbp),%rax
  mov    0x8(%rax),%r8d
  mov    -0x40(%rbp),%rax
  mov    0x4(%rax),%eax
  lea    0x1(%rax),%ecx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%edx
  lea    -0x30(%rbp),%rax
  push   %rdi
  push   %rsi
  lea    D2(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  add    $0x10,%rsp
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x38(%rbp)
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  movb   $0x0,(%rax)
  lea    -0x30(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x48(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L4
  call   <__stack_chk_fail@plt>
L4:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D2
type_guessed: string
name: extract_symbolic_data
arguments: label: D16
type_guessed: string

tool: D2: %02d-%02d-%02d.%02d%02d%02d.

tool: D16: USER

assistant: ```c
char *Get_File_Spec() {
  struct tm *local;
  time_t t;
  char *user;
  char time_stmp[19];
  char *file_spec = 0;
  t = time(NULL);
  local = localtime(&t);
  sprintf(time_stmp, "%02d-%02d-%02d.%02d%02d%02d.", local->tm_year, (local->tm_mon + 1), local->tm_mday, local->tm_hour, local->tm_min, local->tm_sec);
  user = getenv("USER");
  file_spec = (char *)malloc(sizeof(char) * (strlen(time_stmp) + strlen(user) + 1));
  file_spec[0] = '\0';
  strcat(file_spec, time_stmp);
  strcat(file_spec, user);
  return file_spec;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<Get_File_Spec>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,0xc(%rsp)
  lea    0xc(%rsp),%rdi
  call   <localtime@plt>
  mov    0xc(%rax),%r9d
  mov    0x8(%rax),%r8d
  mov    0x4(%rax),%ecx
  add    $0x1,%ecx
  lea    0x10(%rsp),%r12
  mov    0x14(%rax),%edx
  push   %rdx
  mov    0x10(%rax),%edx
  push   %rdx
  mov    (%rax),%edx
  lea    D5(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  lea    D10(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rbp
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x1(%rbx,%rax,1),%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  movb   $0x0,(%rax)
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  add    $0x10,%rsp
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  mov    %rbx,%rax
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D5
type: string
name: unpack_data
arguments: data_tag: D10
type: string

tool: D5: %02d-%02d-%02d.%02d%02d%02d.

tool: D10: USER

assistant: ```c
char *Get_File_Spec() {
  struct tm *local;
  time_t t;
  char *user;
  char time_stmp[19];
  char *file_spec = 0;
  t = time(NULL);
  local = localtime(&t);
  sprintf(time_stmp, "%02d-%02d-%02d.%02d%02d%02d.", local->tm_year, (local->tm_mon + 1), local->tm_mday, local->tm_hour, local->tm_min, local->tm_sec);
  user = getenv("USER");
  file_spec = (char *)malloc(sizeof(char) * (strlen(time_stmp) + strlen(user) + 1));
  file_spec[0] = '\0';
  strcat(file_spec, time_stmp);
  strcat(file_spec, user);
  return file_spec;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<Get_File_Spec>:
  endbr64
  push   %r13
  xor    %edi,%edi
  push   %r12
  push   %rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r13
  call   <time@plt>
  lea    0xc(%rsp),%rdi
  mov    %eax,0xc(%rsp)
  call   <localtime@plt>
  lea    D9(%rip),%rsi
  mov    %r13,%rdi
  mov    0x14(%rax),%edx
  mov    0xc(%rax),%r9d
  mov    0x8(%rax),%r8d
  mov    0x4(%rax),%ecx
  push   %rdx
  mov    0x10(%rax),%edx
  add    $0x1,%ecx
  push   %rdx
  mov    (%rax),%edx
  call   <sprintf@plt>
  lea    D2(%rip),%rdi
  call   <getenv@plt>
  mov    %r13,%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  lea    0x1(%r12,%rax,1),%edi
  call   <malloc@plt>
  mov    %r13,%rsi
  movb   $0x0,(%rax)
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  pop    %rax
  pop    %rdx
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x30,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D9
type_infered: string
name: disassemble_data
arguments: label: D2
type_infered: string

tool: D9: %02d-%02d-%02d.%02d%02d%02d.

tool: D2: USER

assistant: ```c
char *Get_File_Spec() {
  struct tm *local;
  time_t t;
  char *user;
  char time_stmp[19];
  char *file_spec = 0;
  t = time(NULL);
  local = localtime(&t);
  sprintf(time_stmp, "%02d-%02d-%02d.%02d%02d%02d.", local->tm_year, (local->tm_mon + 1), local->tm_mday, local->tm_hour, local->tm_min, local->tm_sec);
  user = getenv("USER");
  file_spec = (char *)malloc(sizeof(char) * (strlen(time_stmp) + strlen(user) + 1));
  file_spec[0] = '\0';
  strcat(file_spec, time_stmp);
  strcat(file_spec, user);
  return file_spec;
}
```