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

```asm
<bl2_long4_cvt>:
  endbr64
  mov    %rdi,%rdx
  movzbl %dil,%ecx
  movzbl %dh,%eax
  shl    $0x8,%ecx
  add    %eax,%ecx
  mov    %rdi,%rax
  shr    $0x18,%edx
  sar    $0x10,%rax
  shl    $0x10,%ecx
  movzbl %al,%eax
  shl    $0x8,%eax
  add    %edx,%eax
  add    %ecx,%eax
  ret
```

assistant: ```c
unsigned int bl2_long4_cvt(long val) {
  int val4;
  unsigned int res;
  res = ((val & 255) * 256) + ((val >> 8) & 255);
  res = (res << 16) + (((val >> 16) & 255) * 256) + ((val >> 24) & 255);
  return res;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<bl2_long4_cvt>:
  endbr64
  mov    %rdi,%rdx
  movzbl %dil,%ecx
  movzbl %dh,%eax
  shl    $0x8,%ecx
  add    %eax,%ecx
  mov    %rdi,%rax
  shr    $0x18,%edx
  sar    $0x10,%rax
  shl    $0x10,%ecx
  movzbl %al,%eax
  shl    $0x8,%eax
  add    %edx,%eax
  add    %ecx,%eax
  ret
```

assistant: ```c
unsigned int bl2_long4_cvt(long val) {
  int val4;
  unsigned int res;
  res = ((val & 255) * 256) + ((val >> 8) & 255);
  res = (res << 16) + (((val >> 16) & 255) * 256) + ((val >> 24) & 255);
  return res;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<sread>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    D24(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x14(%rbp)
  nop
L41:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0xffffffff,-0xc(%rbp)
  je     L65
  cmpl   $0x0,-0xc(%rbp)
  je     L22
  jmp    L20
L65:
  mov    D12(%rip),%rax
  mov    (%rax),%edx
  mov    D21(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L44
  mov    $0xffffffff,%eax
  jmp    L33
L22:
  mov    -0x8(%rbp),%rax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  jmp    L33
L20:
  mov    -0xc(%rbp),%eax
  cltq
  sub    %rax,-0x28(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  add    %rax,-0x20(%rbp)
  jmp    L72
L44:
  nop
L72:
  cmpq   $0x0,-0x28(%rbp)
  jne    L41
  mov    -0x8(%rbp),%rax
L33:
  leave
  ret
```

assistant: ```c
ssize_t sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__))) {
  ssize_t rv;
  size_t rn = n;
  if (fd == STDIN_FILENO)
    goto nocheck;
nocheck:
  do
    switch ((rv = read(fd, buf, n))) {
    case -1:
      if (errno == EINTR)
        continue;
      return -1;
    case 0:
      return rn - n;
    default:
      n -= rv;
      buf = ((char *)buf) + rv;
      break;
    }
  while (n > 0);
  return rn;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<sread>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbp
  mov    %rdx,%r13
  mov    %rdx,%rbx
  jmp    L46
L57:
  mov    D9(%rip),%rcx
  mov    D18(%rip),%rdx
  mov    (%rdx),%esi
  cmp    %esi,(%rcx)
  jne    L48
L66:
  test   %rbx,%rbx
  je     L25
L46:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  cmp    $0xffffffff,%eax
  je     L57
  test   %eax,%eax
  je     L45
  cltq
  sub    %rax,%rbx
  add    %rax,%rbp
  jmp    L66
L45:
  mov    %r13d,%eax
  sub    %ebx,%eax
L48:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L25:
  mov    %r13d,%eax
  jmp    L48
```

assistant: ```c
ssize_t sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__))) {
  ssize_t rv;
  size_t rn = n;
  if (fd == STDIN_FILENO)
    goto nocheck;
nocheck:
  do
    switch ((rv = read(fd, buf, n))) {
    case -1:
      if (errno == EINTR)
        continue;
      return -1;
    case 0:
      return rn - n;
    default:
      n -= rv;
      buf = ((char *)buf) + rv;
      break;
    }
  while (n > 0);
  return rn;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<sread>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
L21:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <read@plt>
  cmp    $0xffffffff,%eax
  je     L38
  test   %eax,%eax
  je     L7
  cltq
  sub    %rax,%rbx
  add    %rax,%rbp
L44:
  test   %rbx,%rbx
  jne    L21
  mov    %r12d,%eax
L2:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L38:
  mov    D3(%rip),%rdx
  mov    D9(%rip),%rcx
  mov    (%rdx),%esi
  cmp    %esi,(%rcx)
  je     L44
  jmp    L2
  cs nopw 0x0(%rax,%rax,1)
L7:
  add    $0x8,%rsp
  mov    %r12d,%eax
  sub    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
ssize_t sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__))) {
  ssize_t rv;
  size_t rn = n;
  if (fd == STDIN_FILENO)
    goto nocheck;
nocheck:
  do
    switch ((rv = read(fd, buf, n))) {
    case -1:
      if (errno == EINTR)
        continue;
      return -1;
    case 0:
      return rn - n;
    default:
      n -= rv;
      buf = ((char *)buf) + rv;
      break;
    }
  while (n > 0);
  return rn;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<sread>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
L13:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <read@plt>
  cmp    $0xffffffff,%eax
  je     L40
  test   %eax,%eax
  je     L4
  cltq
  sub    %rax,%rbx
  add    %rax,%rbp
L48:
  test   %rbx,%rbx
  jne    L13
  mov    %r12d,%eax
L42:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L40:
  mov    D19(%rip),%rdx
  mov    D4(%rip),%rcx
  mov    (%rdx),%esi
  cmp    %esi,(%rcx)
  je     L48
  jmp    L42
  cs nopw 0x0(%rax,%rax,1)
L4:
  add    $0x8,%rsp
  mov    %r12d,%eax
  sub    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
ssize_t sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__))) {
  ssize_t rv;
  size_t rn = n;
  if (fd == STDIN_FILENO)
    goto nocheck;
nocheck:
  do
    switch ((rv = read(fd, buf, n))) {
    case -1:
      if (errno == EINTR)
        continue;
      return -1;
    case 0:
      return rn - n;
    default:
      n -= rv;
      buf = ((char *)buf) + rv;
      break;
    }
  while (n > 0);
  return rn;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<shuffle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  movabs $0x100000000,%rax
  mov    %rax,-0x20(%rbp)
  movq   $0x19660d,-0x18(%rbp)
  movq   $0x3c6ef35f,-0x10(%rbp)
  movq   $0x2a,-0x28(%rbp)
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  jmp    L1
L20:
  mov    -0x18(%rbp),%rax
  imul   -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x30(%rbp),%eax
  add    $0x1,%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  cqto
  idiv   %rcx
  mov    %rdx,%rax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  je     L3
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x30(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
L3:
  subl   $0x1,-0x30(%rbp)
L1:
  cmpl   $0x0,-0x30(%rbp)
  jne    L20
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void shuffle(void **data, int n) {
  int i, j;
  char *t;
  long long m = (1L << 32), a = 1664525, c = 1013904223, randomValue = 42;
  for (i = n - 1; i != 0; --i) {
    randomValue = (a * randomValue + c) % m;
    j = randomValue % (i + 1);
    if (j != i) {
      t = data[i];
      data[i] = data[j];
      data[j] = t;
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<shuffle>:
  endbr64
  mov    %rdi,%r8
  sub    $0x1,%esi
  je     L4
  movslq %esi,%rsi
  mov    $0x2a,%ecx
  jmp    L45
L29:
  sub    $0x1,%rsi
  test   %esi,%esi
  je     L4
L45:
  imul   $0x19660d,%rcx,%rcx
  add    $0x3c6ef35f,%rcx
  mov    %rcx,%rax
  sar    $0x3f,%rax
  shr    $0x20,%rax
  lea    (%rcx,%rax,1),%ecx
  sub    %rax,%rcx
  lea    0x1(%rsi),%rdi
  mov    %rcx,%rax
  cqto
  idiv   %rdi
  cmp    %esi,%edx
  je     L29
  mov    (%r8,%rsi,8),%rdi
  movslq %edx,%rdx
  lea    (%r8,%rdx,8),%rax
  mov    (%rax),%rdx
  mov    %rdx,(%r8,%rsi,8)
  mov    %rdi,(%rax)
  jmp    L29
L4:
  ret
```

assistant: ```c
void shuffle(void **data, int n) {
  int i, j;
  char *t;
  long long m = (1L << 32), a = 1664525, c = 1013904223, randomValue = 42;
  for (i = n - 1; i != 0; --i) {
    randomValue = (a * randomValue + c) % m;
    j = randomValue % (i + 1);
    if (j != i) {
      t = data[i];
      data[i] = data[j];
      data[j] = t;
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<shuffle>:
  endbr64
  mov    %rdi,%r8
  sub    $0x1,%esi
  je     L11
  movslq %esi,%rsi
  mov    $0x2a,%ecx
  nopl   0x0(%rax)
L3:
  imul   $0x19660d,%rcx,%rcx
  lea    0x1(%rsi),%rdi
  add    $0x3c6ef35f,%rcx
  mov    %rcx,%rax
  sar    $0x3f,%rax
  shr    $0x20,%rax
  add    %eax,%ecx
  mov    %ecx,%ecx
  sub    %rax,%rcx
  mov    %rcx,%rax
  cqto
  idiv   %rdi
  cmp    %edx,%esi
  je     L0
  lea    (%r8,%rdx,8),%rax
  mov    (%r8,%rsi,8),%rdi
  mov    (%rax),%rdx
  mov    %rdx,(%r8,%rsi,8)
  mov    %rdi,(%rax)
L0:
  sub    $0x1,%rsi
  test   %esi,%esi
  jne    L3
L11:
  ret
```

assistant: ```c
void shuffle(void **data, int n) {
  int i, j;
  char *t;
  long long m = (1L << 32), a = 1664525, c = 1013904223, randomValue = 42;
  for (i = n - 1; i != 0; --i) {
    randomValue = (a * randomValue + c) % m;
    j = randomValue % (i + 1);
    if (j != i) {
      t = data[i];
      data[i] = data[j];
      data[j] = t;
    }
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<shuffle>:
  endbr64
  mov    %rdi,%r8
  sub    $0x1,%esi
  je     L7
  movslq %esi,%rsi
  mov    $0x2a,%ecx
  nopl   0x0(%rax)
L5:
  imul   $0x19660d,%rcx,%rcx
  lea    0x1(%rsi),%rdi
  add    $0x3c6ef35f,%rcx
  mov    %rcx,%rax
  sar    $0x3f,%rax
  shr    $0x20,%rax
  add    %eax,%ecx
  mov    %ecx,%ecx
  sub    %rax,%rcx
  mov    %rcx,%rax
  cqto
  idiv   %rdi
  cmp    %esi,%edx
  je     L0
  lea    (%r8,%rdx,8),%rax
  mov    (%r8,%rsi,8),%rdi
  mov    (%rax),%rdx
  mov    %rdx,(%r8,%rsi,8)
  mov    %rdi,(%rax)
L0:
  sub    $0x1,%rsi
  test   %esi,%esi
  jne    L5
L7:
  ret
```

assistant: ```c
void shuffle(void **data, int n) {
  int i, j;
  char *t;
  long long m = (1L << 32), a = 1664525, c = 1013904223, randomValue = 42;
  for (i = n - 1; i != 0; --i) {
    randomValue = (a * randomValue + c) % m;
    j = randomValue % (i + 1);
    if (j != i) {
      t = data[i];
      data[i] = data[j];
      data[j] = t;
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<getSign>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jns    L42
  cmpq   $0x0,-0x10(%rbp)
  jg     L26
L42:
  cmpq   $0x0,-0x8(%rbp)
  jle    L23
  cmpq   $0x0,-0x10(%rbp)
  jns    L23
L26:
  mov    $0x1,%eax
  jmp    L14
L23:
  mov    $0x0,%eax
L14:
  pop    %rbp
  ret
```

assistant: ```c
int getSign(long a, long b) {
  if ((a < 0 && b > 0) || (a > 0 && b < 0))
    return 1;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<getSign>:
  endbr64
  test   %rdi,%rdi
  jns    L6
  mov    $0x1,%eax
  test   %rsi,%rsi
  jg     L3
L6:
  test   %rdi,%rdi
  setg   %al
  shr    $0x3f,%rsi
  and    %esi,%eax
L3:
  ret
```

assistant: ```c
int getSign(long a, long b) {
  if ((a < 0 && b > 0) || (a > 0 && b < 0))
    return 1;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<getSign>:
  endbr64
  test   %rdi,%rdi
  jns    L4
  mov    $0x1,%eax
  test   %rsi,%rsi
  jle    L4
  ret
  nopl   0x0(%rax)
L4:
  test   %rdi,%rdi
  setg   %al
  shr    $0x3f,%rsi
  and    %esi,%eax
  ret
```

assistant: ```c
int getSign(long a, long b) {
  if ((a < 0 && b > 0) || (a > 0 && b < 0))
    return 1;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<getSign>:
  endbr64
  test   %rdi,%rdi
  jns    L13
  mov    $0x1,%eax
  test   %rsi,%rsi
  jle    L13
  ret
  nopl   0x0(%rax)
L13:
  test   %rdi,%rdi
  setg   %al
  shr    $0x3f,%rsi
  and    %esi,%eax
  ret
```

assistant: ```c
int getSign(long a, long b) {
  if ((a < 0 && b > 0) || (a > 0 && b < 0))
    return 1;
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<send_udp_datagram>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8d,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x14(%rbp),%rax
  mov    $0xc,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    %eax,-0x10(%rbp)
  mov    D14(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <gethostbyname2@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L15
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    0x4(%rax),%ecx
  lea    -0x14(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memmove@plt>
  lea    -0x14(%rbp),%rcx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rsi
  mov    -0x30(%rbp),%eax
  mov    $0xc,%r9d
  mov    %rcx,%r8
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <sendto@plt>
  cmp    $0xffffffff,%eax
  jmp    L18
L15:
  nop
L18:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L19
  call   <__stack_chk_fail@plt>
L19:
  leave
  ret
```

assistant: ```c
void send_udp_datagram(void *buf, int len, int socket, char *target_host, int target_port) {
  struct sockaddr_in target_si;
  struct hostent *he;
  memset((char *)&target_si, 0, sizeof(target_si));
  target_si.sin_family = AF_INET;
  target_si.sin_port = htons(target_port);
  if (!(he = gethostbyname2(target_host, AF_INET)))
    return;
  memmove(&target_si.sin_addr.s_addr, he->h_addr, he->h_length);
  if (sendto(socket, (const char *)buf, len, 0, (struct sockaddr *)&target_si, sizeof(target_si)) == -1)
    return;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<send_udp_datagram>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %esi,%r13d
  mov    %edx,%ebp
  mov    %rcx,%rbx
  mov    %r8d,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rdi
  mov    $0xc,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    D3(%rip),%r15
  mov    (%r15),%eax
  mov    %eax,0x14(%rsp)
  mov    %r14d,%edi
  call   <htons@plt>
  mov    %eax,0x10(%rsp)
  mov    (%r15),%esi
  mov    %rbx,%rdi
  call   <gethostbyname2@plt>
  test   %rax,%rax
  je     L15
  mov    0x4(%rax),%esi
  lea    0xc(%rsp),%rbx
  mov    (%rax),%edx
  mov    %rbx,%rdi
  call   <memmove@plt>
  mov    $0xc,%r9d
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <sendto@plt>
L15:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void send_udp_datagram(void *buf, int len, int socket, char *target_host, int target_port) {
  struct sockaddr_in target_si;
  struct hostent *he;
  memset((char *)&target_si, 0, sizeof(target_si));
  target_si.sin_family = AF_INET;
  target_si.sin_port = htons(target_port);
  if (!(he = gethostbyname2(target_host, AF_INET)))
    return;
  memmove(&target_si.sin_addr.s_addr, he->h_addr, he->h_length);
  if (sendto(socket, (const char *)buf, len, 0, (struct sockaddr *)&target_si, sizeof(target_si)) == -1)
    return;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<send_udp_datagram>:
  endbr64
  push   %r15
  mov    %r8d,%r15d
  push   %r14
  mov    %esi,%r14d
  xor    %esi,%esi
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edx,0xc(%rsp)
  lea    0x1c(%rsp),%rbx
  mov    $0xc,%edx
  mov    %rbx,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  mov    D4(%rip),%r12
  mov    %r15d,%edi
  mov    (%r12),%eax
  mov    %eax,0x24(%rsp)
  call   <htons@plt>
  mov    (%r12),%esi
  mov    %rbp,%rdi
  mov    %eax,0x20(%rsp)
  call   <gethostbyname2@plt>
  test   %rax,%rax
  je     L14
  mov    0x4(%rax),%esi
  mov    (%rax),%edx
  mov    %rbx,%rdi
  call   <memmove@plt>
  mov    0xc(%rsp),%edi
  mov    %rbx,%r8
  xor    %ecx,%ecx
  mov    $0xc,%r9d
  mov    %r14d,%edx
  mov    %r13,%rsi
  call   <sendto@plt>
L14:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L10:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void send_udp_datagram(void *buf, int len, int socket, char *target_host, int target_port) {
  struct sockaddr_in target_si;
  struct hostent *he;
  memset((char *)&target_si, 0, sizeof(target_si));
  target_si.sin_family = AF_INET;
  target_si.sin_port = htons(target_port);
  if (!(he = gethostbyname2(target_host, AF_INET)))
    return;
  memmove(&target_si.sin_addr.s_addr, he->h_addr, he->h_length);
  if (sendto(socket, (const char *)buf, len, 0, (struct sockaddr *)&target_si, sizeof(target_si)) == -1)
    return;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<send_udp_datagram>:
  endbr64
  push   %r15
  mov    %r8d,%r15d
  push   %r14
  mov    %esi,%r14d
  xor    %esi,%esi
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edx,0xc(%rsp)
  lea    0x1c(%rsp),%rbx
  mov    $0xc,%edx
  mov    %rbx,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  mov    D0(%rip),%r12
  mov    %r15d,%edi
  mov    (%r12),%eax
  mov    %eax,0x24(%rsp)
  call   <htons@plt>
  mov    (%r12),%esi
  mov    %rbp,%rdi
  mov    %eax,0x20(%rsp)
  call   <gethostbyname2@plt>
  test   %rax,%rax
  je     L9
  mov    0x4(%rax),%esi
  mov    (%rax),%edx
  mov    %rbx,%rdi
  call   <memmove@plt>
  mov    0xc(%rsp),%edi
  mov    %rbx,%r8
  xor    %ecx,%ecx
  mov    $0xc,%r9d
  mov    %r14d,%edx
  mov    %r13,%rsi
  call   <sendto@plt>
L9:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void send_udp_datagram(void *buf, int len, int socket, char *target_host, int target_port) {
  struct sockaddr_in target_si;
  struct hostent *he;
  memset((char *)&target_si, 0, sizeof(target_si));
  target_si.sin_family = AF_INET;
  target_si.sin_port = htons(target_port);
  if (!(he = gethostbyname2(target_host, AF_INET)))
    return;
  memmove(&target_si.sin_addr.s_addr, he->h_addr, he->h_length);
  if (sendto(socket, (const char *)buf, len, 0, (struct sockaddr *)&target_si, sizeof(target_si)) == -1)
    return;
}
```
user: What is the c source code of the assembly code below?

```asm
<display_keyfixed>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L69
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L69
  cmpl   $0x1b,-0x4(%rbp)
  je     L69
  cmpl   $0x51,-0x4(%rbp)
  je     L69
  cmpl   $0xa,-0x4(%rbp)
  je     L69
  cmpl   $0xd,-0x4(%rbp)
  je     L69
  mov    D44(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L69
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L69
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L69
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  jne    L59
L69:
  mov    $0x1,%eax
  jmp    L28
L59:
  mov    $0x0,%eax
L28:
  pop    %rbp
  ret
```

assistant: ```c
int display_keyfixed(int i) {
  if (i == 0 || i == KEY_RESIZE || i == 27 || i == 'Q' || i == '\n' || i == '\r' || i == KEY_UP || i == KEY_DOWN || i == KEY_LEFT || i == KEY_RIGHT)
    return 1;
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<display_keyfixed>:
  endbr64
  cmp    $0x1b,%edi
  ja     L74
  mov    $0x1,%eax
  mov    $0x8002401,%edx
  bt     %rdi,%rdx
  jae    L74
L12:
  ret
L74:
  mov    $0x1,%eax
  mov    D20(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L12
  cmp    $0x51,%edi
  je     L12
  mov    D35(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L12
  mov    D42(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L12
  mov    D49(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L12
  mov    D12(%rip),%rax
  cmp    %edi,(%rax)
  sete   %al
  movzbl %al,%eax
  jmp    L12
```

assistant: ```c
int display_keyfixed(int i) {
  if (i == 0 || i == KEY_RESIZE || i == 27 || i == 'Q' || i == '\n' || i == '\r' || i == KEY_UP || i == KEY_DOWN || i == KEY_LEFT || i == KEY_RIGHT)
    return 1;
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<display_keyfixed>:
  endbr64
  cmp    $0x1b,%edi
  jbe    L43
  mov    D38(%rip),%rdx
  mov    $0x1,%eax
  cmp    %edi,(%rdx)
  je     L76
  cmp    $0x51,%edi
  je     L53
L56:
  mov    D0(%rip),%rdx
  mov    $0x1,%eax
  cmp    %edi,(%rdx)
  je     L53
  mov    D28(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L53
  mov    D14(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L53
  mov    D57(%rip),%rax
  cmp    %edi,(%rax)
  sete   %al
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L42:
  mov    D38(%rip),%rdx
  cmp    (%rdx),%edi
  jne    L56
L53:
  ret
  nopl   0x0(%rax)
L43:
  mov    $0xfffffffff7ffdbfe,%rax
  bt     %rdi,%rax
  mov    $0x1,%eax
  jb     L42
  ret
  nopl   0x0(%rax,%rax,1)
L76:
  ret
```

assistant: ```c
int display_keyfixed(int i) {
  if (i == 0 || i == KEY_RESIZE || i == 27 || i == 'Q' || i == '\n' || i == '\r' || i == KEY_UP || i == KEY_DOWN || i == KEY_LEFT || i == KEY_RIGHT)
    return 1;
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<display_keyfixed>:
  endbr64
  cmp    $0x1b,%edi
  jbe    L55
  mov    D51(%rip),%rdx
  mov    $0x1,%eax
  cmp    %edi,(%rdx)
  je     L66
  cmp    $0x51,%edi
  je     L69
L10:
  mov    D17(%rip),%rdx
  mov    $0x1,%eax
  cmp    %edi,(%rdx)
  je     L69
  mov    D53(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L69
  mov    D20(%rip),%rdx
  cmp    %edi,(%rdx)
  je     L69
  mov    D19(%rip),%rax
  cmp    %edi,(%rax)
  sete   %al
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L9:
  mov    D51(%rip),%rdx
  cmp    (%rdx),%edi
  jne    L10
L69:
  ret
  nopl   0x0(%rax)
L55:
  mov    $0xfffffffff7ffdbfe,%rax
  bt     %rdi,%rax
  mov    $0x1,%eax
  jb     L9
  ret
  nopl   0x0(%rax,%rax,1)
L66:
  ret
```

assistant: ```c
int display_keyfixed(int i) {
  if (i == 0 || i == KEY_RESIZE || i == 27 || i == 'Q' || i == '\n' || i == '\r' || i == KEY_UP || i == KEY_DOWN || i == KEY_LEFT || i == KEY_RIGHT)
    return 1;
  return 0;
}
```