ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<randomNumber>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  xor    %eax,%eax
  call   <rand@plt>
  cltd
  idiv   %ebx
  pop    %rbx
  mov    %edx,%eax
  ret
```

assistant: ```c
int randomNumber(int n) {
  srand(time(NULL));
  return rand() % n;
}
```
user: What is the c source code of the assembly code below:

```asm
<randomNumber>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  xor    %eax,%eax
  call   <rand@plt>
  cltd
  idiv   %ebx
  pop    %rbx
  mov    %edx,%eax
  ret
```

assistant: ```c
int randomNumber(int n) {
  srand(time(NULL));
  return rand() % n;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movabs $0x6d2065766f6c2049,%rax
  movabs $0x6172676f72702079,%rdx
  mov    %rax,-0x20(%rbp)
  mov    %rdx,-0x18(%rbp)
  movl   $0x72656d6d,-0x10(%rbp)
  movw   $0xa,-0xc(%rbp)
  lea    -0x20(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L27
L11:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
  addq   $0x1,-0x28(%rbp)
L27:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L11
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

assistant: ```c
int main() {
  char text[] = "I love my programmer\n";
  char *t;
  t = text;
  while (*t != '\0') {
    putchar(*t);
    t++;
  }
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movabs $0x6d2065766f6c2049,%rax
  movabs $0x6172676f72702079,%rdx
  mov    %rax,(%rsp)
  mov    %rdx,0x8(%rsp)
  movl   $0x72656d6d,0x10(%rsp)
  movw   $0xa,0x14(%rsp)
  mov    $0x49,%edi
  mov    %rsp,%rbx
L5:
  movsbl %dil,%edi
  call   <putchar@plt>
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L5
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  mov    $0x0,%eax
  add    $0x20,%rsp
  pop    %rbx
  ret
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  char text[] = "I love my programmer\n";
  char *t;
  t = text;
  while (*t != '\0') {
    putchar(*t);
    t++;
  }
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x49,%edi
  sub    $0x20,%rsp
  movdqa D2(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0xa,%eax
  movl   $0x72656d6d,0x10(%rsp)
  mov    %rsp,%rbx
  mov    %ax,0x14(%rsp)
  movaps %xmm0,(%rsp)
  nop
L2:
  call   <putchar@plt>
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L2
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbx
  ret
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D2
type_guessed: byte[16]

tool: {"D2": [0x49,0x20,0x6c,0x6f,0x76,0x65,0x20,0x6d,0x79,0x20,0x70,0x72,0x6f,0x67,0x72,0x61]}

assistant: ```c
int main() {
  char text[] = "I love my programmer\n";
  char *t;
  t = text;
  while (*t != '\0') {
    putchar(*t);
    t++;
  }
  return (0);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x49,%edi
  sub    $0x20,%rsp
  movdqa D1(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0xa,%eax
  movl   $0x72656d6d,0x10(%rsp)
  mov    %rsp,%rbx
  mov    %ax,0x14(%rsp)
  movaps %xmm0,(%rsp)
  nop
L0:
  call   <putchar@plt>
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L0
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbx
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D1
data_type: byte[16]

tool: {"D1": [0x49,0x20,0x6c,0x6f,0x76,0x65,0x20,0x6d,0x79,0x20,0x70,0x72,0x6f,0x67,0x72,0x61]}

assistant: ```c
int main() {
  char text[] = "I love my programmer\n";
  char *t;
  t = text;
  while (*t != '\0') {
    putchar(*t);
    t++;
  }
  return (0);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<disable_extended_io>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <tcgetattr@plt>
  mov    -0xc(%rbp),%edx
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%edx
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    D6(%rip),%rax
  mov    (%rax),%eax
  lea    -0x10(%rbp),%rdx
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <tcsetattr@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
void disable_extended_io(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~IEXTEN;
  term.c_oflag &= ~OPOST;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<disable_extended_io>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <tcgetattr@plt>
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %eax,0x4(%rsp)
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %eax,(%rsp)
  mov    %rbx,%rdx
  mov    D26(%rip),%rax
  mov    (%rax),%esi
  mov    $0x0,%edi
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x10,%rsp
  pop    %rbx
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_extended_io(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~IEXTEN;
  term.c_oflag &= ~OPOST;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<disable_extended_io>:
  endbr64
  push   %r12
  xor    %edi,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rsi
  call   <tcgetattr@plt>
  mov    D8(%rip),%rax
  xor    %edi,%edi
  mov    %r12,%rdx
  mov    (%rax),%eax
  not    %eax
  and    %eax,0x4(%rsp)
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %eax,(%rsp)
  mov    D20(%rip),%rax
  mov    (%rax),%esi
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x10,%rsp
  pop    %r12
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_extended_io(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~IEXTEN;
  term.c_oflag &= ~OPOST;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<disable_extended_io>:
  endbr64
  push   %r12
  xor    %edi,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rsi
  call   <tcgetattr@plt>
  mov    D13(%rip),%rax
  mov    D1(%rip),%rdx
  xor    %edi,%edi
  movq   (%rsp),%xmm1
  mov    (%rax),%eax
  movd   (%rdx),%xmm0
  mov    %r12,%rdx
  movd   %eax,%xmm2
  mov    D23(%rip),%rax
  punpckldq %xmm2,%xmm0
  mov    (%rax),%esi
  pandn  %xmm1,%xmm0
  movq   %xmm0,(%rsp)
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x10,%rsp
  pop    %r12
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_extended_io(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~IEXTEN;
  term.c_oflag &= ~OPOST;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<collision_radius_to_line_segment>:
  endbr64
  sub    $0x28,%rsp
  movss  %xmm0,0x14(%rsp)
  movss  %xmm1,0x18(%rsp)
  movss  %xmm2,0x4(%rsp)
  movss  %xmm3,0x8(%rsp)
  movaps %xmm4,%xmm9
  movss  %xmm4,0xc(%rsp)
  movaps %xmm5,%xmm8
  movss  %xmm5,0x10(%rsp)
  movaps %xmm6,%xmm7
  movss  %xmm6,0x1c(%rsp)
  addss  %xmm6,%xmm3
  movaps %xmm3,%xmm5
  addss  %xmm2,%xmm6
  movaps %xmm6,%xmm4
  movaps %xmm1,%xmm3
  subss  %xmm7,%xmm3
  movaps %xmm0,%xmm2
  subss  %xmm7,%xmm2
  movaps %xmm8,%xmm1
  movaps %xmm9,%xmm0
  call   <point_in_rectangle_full@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L49
L53:
  add    $0x28,%rsp
  ret
L49:
  movss  0x4(%rsp),%xmm3
  movss  0x14(%rsp),%xmm5
  subss  %xmm5,%xmm3
  movss  0x8(%rsp),%xmm4
  movss  0x18(%rsp),%xmm6
  subss  %xmm6,%xmm4
  movaps %xmm3,%xmm2
  mulss  %xmm3,%xmm2
  movaps %xmm4,%xmm0
  mulss  %xmm4,%xmm0
  addss  %xmm0,%xmm2
  movss  0xc(%rsp),%xmm0
  subss  %xmm5,%xmm0
  movss  0x10(%rsp),%xmm5
  subss  %xmm6,%xmm5
  movaps %xmm3,%xmm1
  mulss  %xmm0,%xmm1
  movaps %xmm4,%xmm6
  mulss  %xmm5,%xmm6
  addss  %xmm6,%xmm1
  divss  %xmm2,%xmm1
  pxor   %xmm6,%xmm6
  comiss %xmm1,%xmm6
  jae    L51
  comiss D3(%rip),%xmm1
  jb     L35
  movss  0xc(%rsp),%xmm1
  subss  0x4(%rsp),%xmm1
  movss  0x10(%rsp),%xmm0
  subss  0x8(%rsp),%xmm0
  mulss  %xmm1,%xmm1
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm1
  jmp    L3
L51:
  mulss  %xmm0,%xmm0
  mulss  %xmm5,%xmm5
  movaps %xmm0,%xmm1
  addss  %xmm5,%xmm1
L3:
  movss  0x1c(%rsp),%xmm0
  mulss  %xmm0,%xmm0
  comiss %xmm1,%xmm0
  seta   %al
  movzbl %al,%eax
  jmp    L53
L35:
  movss  0xc(%rsp),%xmm0
  mulss  %xmm4,%xmm0
  movss  0x10(%rsp),%xmm1
  mulss  %xmm3,%xmm1
  subss  %xmm1,%xmm0
  movss  0x8(%rsp),%xmm1
  mulss  0x14(%rsp),%xmm1
  subss  %xmm1,%xmm0
  movss  0x4(%rsp),%xmm1
  mulss  0x18(%rsp),%xmm1
  addss  %xmm1,%xmm0
  mulss  %xmm0,%xmm0
  movaps %xmm0,%xmm1
  divss  %xmm2,%xmm1
  jmp    L3
```

tool_calls: name: disassemble_data
arguments: label: D3
data_type: f32

tool: D3: 1

assistant: ```c
int collision_radius_to_line_segment(float x1, float y1, float x2, float y2, float px, float py, float radius) {
  if (point_in_rectangle_full(px, py, x1 - radius, y1 - radius, x2 + radius, y2 + radius)) {
    float dx = x2 - x1;
    float dy = y2 - y1;
    float d2 = dx * dx + dy * dy;
    float ex = px - x1;
    float ey = py - y1;
    float scale = (dx * ex + dy * ey) / d2;
    float dist2;
    if (scale <= 0.0) {
      dist2 = ex * ex + ey * ey;
    } else if (scale >= 1.0) {
      float fx = px - x2;
      float fy = py - y2;
      dist2 = fx * fx + fy * fy;
    } else {
      float temp = dy * px - dx * py - x1 * y2 + x2 * y1;
      dist2 = temp * temp / d2;
    }
    return dist2 < radius * radius;
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<collision_radius_to_line_segment>:
  endbr64
  sub    $0x28,%rsp
  movaps %xmm0,%xmm9
  movaps %xmm4,%xmm0
  movaps %xmm6,%xmm4
  movaps %xmm5,%xmm7
  movaps %xmm3,%xmm5
  movss  %xmm3,0x1c(%rsp)
  addss  %xmm2,%xmm4
  movss  %xmm2,0x18(%rsp)
  movaps %xmm1,%xmm3
  movaps %xmm9,%xmm2
  addss  %xmm6,%xmm5
  subss  %xmm6,%xmm3
  movss  %xmm1,0x14(%rsp)
  movaps %xmm7,%xmm1
  subss  %xmm6,%xmm2
  movss  %xmm9,0x10(%rsp)
  movss  %xmm6,0xc(%rsp)
  movss  %xmm7,0x8(%rsp)
  movss  %xmm0,0x4(%rsp)
  call   <point_in_rectangle_full@plt>
  movss  0x4(%rsp),%xmm0
  movss  0x8(%rsp),%xmm7
  mov    %rax,%r8
  xor    %eax,%eax
  movss  0xc(%rsp),%xmm6
  movss  0x10(%rsp),%xmm9
  test   %r8,%r8
  movss  0x14(%rsp),%xmm8
  movss  0x18(%rsp),%xmm10
  movss  0x1c(%rsp),%xmm11
  jne    L33
  add    $0x28,%rsp
  ret
  nop
L33:
  movaps %xmm10,%xmm4
  movaps %xmm11,%xmm5
  movaps %xmm7,%xmm12
  subss  %xmm9,%xmm4
  subss  %xmm8,%xmm5
  subss  %xmm8,%xmm12
  movaps %xmm4,%xmm2
  movaps %xmm5,%xmm1
  movaps %xmm4,%xmm3
  mulss  %xmm5,%xmm1
  movaps %xmm5,%xmm13
  mulss  %xmm4,%xmm2
  mulss  %xmm12,%xmm13
  addss  %xmm1,%xmm2
  movaps %xmm0,%xmm1
  subss  %xmm9,%xmm1
  mulss  %xmm1,%xmm3
  addss  %xmm13,%xmm3
  pxor   %xmm13,%xmm13
  divss  %xmm2,%xmm3
  comiss %xmm3,%xmm13
  jae    L41
  comiss D4(%rip),%xmm3
  jb     L29
  subss  %xmm10,%xmm0
  subss  %xmm11,%xmm7
  mulss  %xmm7,%xmm7
  movaps %xmm0,%xmm1
  mulss  %xmm0,%xmm1
  addss  %xmm7,%xmm1
L6:
  mulss  %xmm6,%xmm6
  xor    %eax,%eax
  comiss %xmm1,%xmm6
  seta   %al
  add    $0x28,%rsp
  ret
  nopl   0x0(%rax)
L29:
  mulss  %xmm5,%xmm0
  mulss  %xmm4,%xmm7
  mulss  %xmm9,%xmm11
  mulss  %xmm8,%xmm10
  subss  %xmm7,%xmm0
  subss  %xmm11,%xmm0
  movaps %xmm0,%xmm1
  addss  %xmm10,%xmm1
  mulss  %xmm1,%xmm1
  divss  %xmm2,%xmm1
  jmp    L6
  nopl   (%rax)
L41:
  mulss  %xmm1,%xmm1
  mulss  %xmm12,%xmm12
  addss  %xmm12,%xmm1
  jmp    L6
```

tool_calls: name: read_data
arguments: data_tag: D4
data_type: f32

tool: D4: 1

assistant: ```c
int collision_radius_to_line_segment(float x1, float y1, float x2, float y2, float px, float py, float radius) {
  if (point_in_rectangle_full(px, py, x1 - radius, y1 - radius, x2 + radius, y2 + radius)) {
    float dx = x2 - x1;
    float dy = y2 - y1;
    float d2 = dx * dx + dy * dy;
    float ex = px - x1;
    float ey = py - y1;
    float scale = (dx * ex + dy * ey) / d2;
    float dist2;
    if (scale <= 0.0) {
      dist2 = ex * ex + ey * ey;
    } else if (scale >= 1.0) {
      float fx = px - x2;
      float fy = py - y2;
      dist2 = fx * fx + fy * fy;
    } else {
      float temp = dy * px - dx * py - x1 * y2 + x2 * y1;
      dist2 = temp * temp / d2;
    }
    return dist2 < radius * radius;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<collision_radius_to_line_segment>:
  endbr64
  sub    $0x28,%rsp
  movaps %xmm0,%xmm9
  movaps %xmm4,%xmm0
  movaps %xmm6,%xmm4
  movaps %xmm5,%xmm7
  movaps %xmm3,%xmm5
  movss  %xmm3,0x1c(%rsp)
  addss  %xmm2,%xmm4
  movss  %xmm2,0x18(%rsp)
  movaps %xmm1,%xmm3
  movaps %xmm9,%xmm2
  addss  %xmm6,%xmm5
  subss  %xmm6,%xmm3
  movss  %xmm1,0x14(%rsp)
  movaps %xmm7,%xmm1
  subss  %xmm6,%xmm2
  movss  %xmm9,0x10(%rsp)
  movss  %xmm6,0xc(%rsp)
  movss  %xmm7,0x8(%rsp)
  movss  %xmm0,0x4(%rsp)
  call   <point_in_rectangle_full@plt>
  movss  0x4(%rsp),%xmm0
  movss  0x8(%rsp),%xmm7
  mov    %rax,%r8
  xor    %eax,%eax
  movss  0xc(%rsp),%xmm6
  movss  0x10(%rsp),%xmm9
  test   %r8,%r8
  movss  0x14(%rsp),%xmm8
  movss  0x18(%rsp),%xmm10
  movss  0x1c(%rsp),%xmm11
  jne    L31
  add    $0x28,%rsp
  ret
  nop
L31:
  movaps %xmm10,%xmm4
  movaps %xmm11,%xmm5
  movaps %xmm7,%xmm12
  subss  %xmm9,%xmm4
  subss  %xmm8,%xmm5
  subss  %xmm8,%xmm12
  movaps %xmm4,%xmm2
  movaps %xmm5,%xmm1
  movaps %xmm4,%xmm3
  mulss  %xmm5,%xmm1
  movaps %xmm5,%xmm13
  mulss  %xmm4,%xmm2
  mulss  %xmm12,%xmm13
  addss  %xmm1,%xmm2
  movaps %xmm0,%xmm1
  subss  %xmm9,%xmm1
  mulss  %xmm1,%xmm3
  addss  %xmm13,%xmm3
  pxor   %xmm13,%xmm13
  divss  %xmm2,%xmm3
  comiss %xmm3,%xmm13
  jae    L38
  comiss D3(%rip),%xmm3
  jb     L43
  subss  %xmm10,%xmm0
  subss  %xmm11,%xmm7
  mulss  %xmm7,%xmm7
  movaps %xmm0,%xmm1
  mulss  %xmm0,%xmm1
  addss  %xmm7,%xmm1
L17:
  mulss  %xmm6,%xmm6
  xor    %eax,%eax
  comiss %xmm1,%xmm6
  seta   %al
  add    $0x28,%rsp
  ret
  nopl   0x0(%rax)
L43:
  mulss  %xmm5,%xmm0
  mulss  %xmm4,%xmm7
  mulss  %xmm9,%xmm11
  mulss  %xmm8,%xmm10
  subss  %xmm7,%xmm0
  subss  %xmm11,%xmm0
  movaps %xmm0,%xmm1
  addss  %xmm10,%xmm1
  mulss  %xmm1,%xmm1
  divss  %xmm2,%xmm1
  jmp    L17
  nopl   (%rax)
L38:
  mulss  %xmm1,%xmm1
  mulss  %xmm12,%xmm12
  addss  %xmm12,%xmm1
  jmp    L17
```

tool_calls: name: extract_symbolic_data
arguments: tag: D3
type_infered: f32

tool: D3: 1

assistant: ```c
int collision_radius_to_line_segment(float x1, float y1, float x2, float y2, float px, float py, float radius) {
  if (point_in_rectangle_full(px, py, x1 - radius, y1 - radius, x2 + radius, y2 + radius)) {
    float dx = x2 - x1;
    float dy = y2 - y1;
    float d2 = dx * dx + dy * dy;
    float ex = px - x1;
    float ey = py - y1;
    float scale = (dx * ex + dy * ey) / d2;
    float dist2;
    if (scale <= 0.0) {
      dist2 = ex * ex + ey * ey;
    } else if (scale >= 1.0) {
      float fx = px - x2;
      float fy = py - y2;
      dist2 = fx * fx + fy * fy;
    } else {
      float temp = dy * px - dx * py - x1 * y2 + x2 * y1;
      dist2 = temp * temp / d2;
    }
    return dist2 < radius * radius;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<contaminar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rax
  lea    -0x194(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  test   %eax,%eax
  jne    L4
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rax
  lea    -0x194(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  movl   $0x3,(%rdx,%rax,4)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x4(%rbp)
L4:
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  test   %eax,%eax
  jne    L26
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  movl   $0x3,(%rdx,%rax,4)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x4(%rbp)
L26:
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  test   %eax,%eax
  jne    L13
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movl   $0x3,(%rdx,%rax,4)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x4(%rbp)
L13:
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  test   %eax,%eax
  jne    L0
  mov    -0x1c(%rbp),%eax
  cltq
  imul   $0x194,%rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  cltq
  movl   $0x3,(%rdx,%rax,4)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x4(%rbp)
L0:
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int contaminar(int matr[101][101], int a, int b, int *limp) {
  int retorno = 0;
  if (matr[a - 1][b] == 0) {
    matr[a - 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a + 1][b] == 0) {
    matr[a + 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b - 1] == 0) {
    matr[a][b - 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b + 1] == 0) {
    matr[a][b + 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  return retorno;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<contaminar>:
  endbr64
  mov    %rdi,%rax
  movslq %esi,%rsi
  imul   $0x194,%rsi,%rsi
  lea    -0x194(%rdi,%rsi,1),%r8
  movslq %edx,%r9
  mov    $0x0,%edi
  cmpl   $0x0,(%r8,%r9,4)
  jne    L31
  movl   $0x3,(%r8,%r9,4)
  subl   $0x1,(%rcx)
  mov    $0x1,%edi
L31:
  lea    0x194(%rax,%rsi,1),%r8
  movslq %edx,%r9
  cmpl   $0x0,(%r8,%r9,4)
  jne    L37
  movl   $0x3,(%r8,%r9,4)
  subl   $0x1,(%rcx)
  mov    $0x1,%edi
L37:
  movslq %edx,%rdx
  lea    (%rsi,%rdx,4),%rdx
  add    %rdx,%rax
  cmpl   $0x0,-0x4(%rax)
  jne    L7
  movl   $0x3,-0x4(%rax)
  subl   $0x1,(%rcx)
  mov    $0x1,%edi
L7:
  cmpl   $0x0,0x4(%rax)
  jne    L8
  movl   $0x3,0x4(%rax)
  subl   $0x1,(%rcx)
  mov    $0x1,%edi
L8:
  mov    %edi,%eax
  ret
```

assistant: ```c
int contaminar(int matr[101][101], int a, int b, int *limp) {
  int retorno = 0;
  if (matr[a - 1][b] == 0) {
    matr[a - 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a + 1][b] == 0) {
    matr[a + 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b - 1] == 0) {
    matr[a][b - 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b + 1] == 0) {
    matr[a][b + 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  return retorno;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<contaminar>:
  endbr64
  movslq %esi,%rsi
  movslq %edx,%rdx
  mov    %rdi,%rax
  xor    %r8d,%r8d
  imul   $0x194,%rsi,%rsi
  shl    $0x2,%rdx
  lea    -0x194(%rsi,%rdx,1),%rdi
  add    %rax,%rdi
  mov    (%rdi),%r10d
  test   %r10d,%r10d
  jne    L39
  movl   $0x3,(%rdi)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L39:
  lea    0x194(%rsi,%rdx,1),%rdi
  add    %rax,%rdi
  mov    (%rdi),%r9d
  test   %r9d,%r9d
  jne    L14
  movl   $0x3,(%rdi)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L14:
  add    %rdx,%rsi
  add    %rsi,%rax
  mov    -0x4(%rax),%esi
  test   %esi,%esi
  jne    L10
  movl   $0x3,-0x4(%rax)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L10:
  mov    0x4(%rax),%edx
  test   %edx,%edx
  jne    L15
  movl   $0x3,0x4(%rax)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L15:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int contaminar(int matr[101][101], int a, int b, int *limp) {
  int retorno = 0;
  if (matr[a - 1][b] == 0) {
    matr[a - 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a + 1][b] == 0) {
    matr[a + 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b - 1] == 0) {
    matr[a][b - 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b + 1] == 0) {
    matr[a][b + 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  return retorno;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<contaminar>:
  endbr64
  movslq %esi,%rsi
  movslq %edx,%rdx
  mov    %rdi,%rax
  xor    %r8d,%r8d
  imul   $0x194,%rsi,%rsi
  shl    $0x2,%rdx
  lea    -0x194(%rsi,%rdx,1),%rdi
  add    %rax,%rdi
  mov    (%rdi),%r10d
  test   %r10d,%r10d
  jne    L21
  movl   $0x3,(%rdi)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L21:
  lea    0x194(%rsi,%rdx,1),%rdi
  add    %rax,%rdi
  mov    (%rdi),%r9d
  test   %r9d,%r9d
  jne    L16
  movl   $0x3,(%rdi)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L16:
  add    %rdx,%rsi
  add    %rsi,%rax
  mov    -0x4(%rax),%esi
  test   %esi,%esi
  jne    L2
  movl   $0x3,-0x4(%rax)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L2:
  mov    0x4(%rax),%edx
  test   %edx,%edx
  jne    L32
  movl   $0x3,0x4(%rax)
  mov    $0x1,%r8d
  subl   $0x1,(%rcx)
L32:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int contaminar(int matr[101][101], int a, int b, int *limp) {
  int retorno = 0;
  if (matr[a - 1][b] == 0) {
    matr[a - 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a + 1][b] == 0) {
    matr[a + 1][b] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b - 1] == 0) {
    matr[a][b - 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  if (matr[a][b + 1] == 0) {
    matr[a][b + 1] = 3;
    *limp -= 1;
    retorno = 1;
  }
  return retorno;
}
```