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

```asm
<isleap>:
  endbr64
  xor    %eax,%eax
  test   $0x3,%dil
  jne    L16
  imul   $0xc28f5c29,%edi,%edi
  mov    $0x1,%eax
  add    $0x51eb850,%edi
  mov    %edi,%edx
  ror    $0x2,%edx
  cmp    $0x28f5c28,%edx
  ja     L16
  ror    $0x4,%edi
  xor    %eax,%eax
  cmp    $0xa3d70a,%edi
  setbe  %al
L16:
  ret
```

assistant: ```c
int isleap(int year) {
  if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
    return 1;
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<isleap>:
  endbr64
  xor    %eax,%eax
  test   $0x3,%dil
  jne    L19
  imul   $0xc28f5c29,%edi,%edi
  mov    $0x1,%eax
  add    $0x51eb850,%edi
  mov    %edi,%edx
  ror    $0x2,%edx
  cmp    $0x28f5c28,%edx
  ja     L19
  ror    $0x4,%edi
  xor    %eax,%eax
  cmp    $0xa3d70a,%edi
  setbe  %al
L19:
  ret
```

assistant: ```c
int isleap(int year) {
  if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
    return 1;
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<read_value>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D11
data_type: string
name: retrieve_data
arguments: data_tag: D0
data_type: string
name: retrieve_data
arguments: data_tag: D21
data_type: string

tool: D11: Choose one:


tool: D0: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: 

tool: D21: %i

assistant: ```c
int read_value(void) {
  int value = 0;
  printf("Choose one:\n");
  printf("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ");
  scanf("%i", &value);
  return value;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<read_value>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  lea    D5(%rip),%rdi
  call   <printf@plt>
  lea    D9(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D15(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L4
  add    $0x18,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D5
data_type: string
name: read_data
arguments: tag: D9
data_type: string
name: read_data
arguments: tag: D15
data_type: string

tool: D5: Choose one:


tool: D9: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: 

tool: D15: %i

assistant: ```c
int read_value(void) {
  int value = 0;
  printf("Choose one:\n");
  printf("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ");
  scanf("%i", &value);
  return value;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<read_value>:
  endbr64
  sub    $0x18,%rsp
  lea    D7(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  call   <printf@plt>
  lea    D11(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D1(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D7
type: string
name: retrieve_data
arguments: data_tag: D11
type: string
name: retrieve_data
arguments: data_tag: D1
type: string

tool: D7: Choose one:


tool: D11: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: 

tool: D1: %i

assistant: ```c
int read_value(void) {
  int value = 0;
  printf("Choose one:\n");
  printf("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ");
  scanf("%i", &value);
  return value;
}
```
user: Translate the below assembly code into C programming language:

```asm
<read_value>:
  endbr64
  sub    $0x18,%rsp
  lea    D23(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  call   <printf@plt>
  lea    D22(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D16(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D23
type_guessed: string
name: extract_symbolic_data
arguments: label: D22
type_guessed: string
name: extract_symbolic_data
arguments: label: D16
type_guessed: string

tool: D23: Choose one:


tool: D22: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: 

tool: D16: %i

assistant: ```c
int read_value(void) {
  int value = 0;
  printf("Choose one:\n");
  printf("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ");
  scanf("%i", &value);
  return value;
}
```
user: What is the c source code of the assembly code below?

```asm
<cli_connect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rax
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  lea    -0x28(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  mov    -0x40(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <getaddrinfo@plt>
  test   %rax,%rax
  je     L53
  mov    $0xffffffff,%eax
  jmp    L15
L53:
  mov    -0x28(%rbp),%rax
  mov    0x8(%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    0xc(%rax),%ecx
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jns    L44
  mov    $0xffffffff,%eax
  jmp    L15
L44:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    0x4(%rax),%ecx
  mov    -0x2c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <connect@plt>
  test   %rax,%rax
  jns    L34
  mov    $0xffffffff,%eax
  jmp    L15
L34:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <freeaddrinfo@plt>
  mov    -0x2c(%rbp),%eax
L15:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L68
  call   <__stack_chk_fail@plt>
L68:
  leave
  ret
```

assistant: ```c
int cli_connect(char *address, char *port) {
  struct addrinfo hints;
  struct addrinfo *addr;
  int fd;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_NUMERICHOST;
  if (getaddrinfo(address, port, &hints, &addr) != 0)
    return -1;
  fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
  if (fd < 0)
    return -1;
  if (connect(fd, addr->ai_addr, addr->ai_addrlen) < 0)
    return -1;
  freeaddrinfo(addr);
  return fd;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<cli_connect>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x20(%rsp)
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  mov    D27(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x24(%rsp)
  lea    0x8(%rsp),%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <getaddrinfo@plt>
  test   %rax,%rax
  jne    L47
  mov    0x8(%rsp),%rax
  mov    0x8(%rax),%edx
  mov    0xc(%rax),%esi
  mov    0x10(%rax),%edi
  call   <socket@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  js     L40
  mov    0x8(%rsp),%rax
  mov    0x4(%rax),%esi
  mov    (%rax),%edx
  mov    %ebx,%edi
  call   <connect@plt>
  test   %rax,%rax
  js     L3
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
L5:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    %ebx,%eax
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L47:
  mov    $0xffffffff,%ebx
  jmp    L5
L40:
  mov    $0xffffffff,%ebx
  jmp    L5
L3:
  mov    $0xffffffff,%ebx
  jmp    L5
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cli_connect(char *address, char *port) {
  struct addrinfo hints;
  struct addrinfo *addr;
  int fd;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_NUMERICHOST;
  if (getaddrinfo(address, port, &hints, &addr) != 0)
    return -1;
  fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
  if (fd < 0)
    return -1;
  if (connect(fd, addr->ai_addr, addr->ai_addrlen) < 0)
    return -1;
  freeaddrinfo(addr);
  return fd;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<cli_connect>:
  endbr64
  push   %r13
  mov    $0x18,%edx
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r13
  mov    %r13,%rdi
  call   <memset@plt>
  lea    0x8(%rsp),%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    D13(%rip),%rax
  mov    %r12,%rdi
  mov    (%rax),%eax
  mov    %eax,0x20(%rsp)
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  mov    D15(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x24(%rsp)
  call   <getaddrinfo@plt>
  test   %rax,%rax
  jne    L29
  mov    0x8(%rsp),%rax
  mov    0x8(%rax),%edx
  mov    0xc(%rax),%esi
  mov    0x10(%rax),%edi
  call   <socket@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L29
  mov    0x8(%rsp),%rax
  mov    %r12d,%edi
  mov    0x4(%rax),%esi
  mov    (%rax),%edx
  call   <connect@plt>
  test   %rax,%rax
  js     L29
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
L11:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0x30,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L29:
  mov    $0xffffffff,%r12d
  jmp    L11
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cli_connect(char *address, char *port) {
  struct addrinfo hints;
  struct addrinfo *addr;
  int fd;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_NUMERICHOST;
  if (getaddrinfo(address, port, &hints, &addr) != 0)
    return -1;
  fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
  if (fd < 0)
    return -1;
  if (connect(fd, addr->ai_addr, addr->ai_addrlen) < 0)
    return -1;
  freeaddrinfo(addr);
  return fd;
}
```
user: Translate the below assembly code into C programming language:

```asm
<cli_connect>:
  endbr64
  push   %r13
  mov    $0x18,%edx
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r13
  mov    %r13,%rdi
  call   <memset@plt>
  lea    0x8(%rsp),%rcx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    D18(%rip),%rax
  mov    D3(%rip),%rdx
  mov    (%rax),%eax
  movd   (%rdx),%xmm0
  mov    %r13,%rdx
  movd   %eax,%xmm1
  mov    D24(%rip),%rax
  punpckldq %xmm1,%xmm0
  mov    (%rax),%eax
  movq   %xmm0,0x1c(%rsp)
  mov    %eax,0x24(%rsp)
  call   <getaddrinfo@plt>
  test   %rax,%rax
  jne    L21
  mov    0x8(%rsp),%rax
  mov    0x8(%rax),%edx
  mov    0xc(%rax),%esi
  mov    0x10(%rax),%edi
  call   <socket@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L21
  mov    0x8(%rsp),%rax
  mov    %r12d,%edi
  mov    0x4(%rax),%esi
  mov    (%rax),%edx
  call   <connect@plt>
  test   %rax,%rax
  js     L21
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
L30:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L47
  add    $0x30,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L21:
  mov    $0xffffffff,%r12d
  jmp    L30
L47:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cli_connect(char *address, char *port) {
  struct addrinfo hints;
  struct addrinfo *addr;
  int fd;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_NUMERICHOST;
  if (getaddrinfo(address, port, &hints, &addr) != 0)
    return -1;
  fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
  if (fd < 0)
    return -1;
  if (connect(fd, addr->ai_addr, addr->ai_addrlen) < 0)
    return -1;
  freeaddrinfo(addr);
  return fd;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<L1C_EnableCaches>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <__get_SCTLR@plt>
  or     $0x1004,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  mov    $0x0,%eax
  call   <__ISB@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void L1C_EnableCaches(void) {
  __set_SCTLR(__get_SCTLR() | (1U << 12U) | (1U << 2U));
  __ISB();
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<L1C_EnableCaches>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <__get_SCTLR@plt>
  or     $0x1004,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  mov    $0x0,%eax
  call   <__ISB@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void L1C_EnableCaches(void) {
  __set_SCTLR(__get_SCTLR() | (1U << 12U) | (1U << 2U));
  __ISB();
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<L1C_EnableCaches>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <__get_SCTLR@plt>
  or     $0x1004,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1090 <__ISB@plt>
```

assistant: ```c
void L1C_EnableCaches(void) {
  __set_SCTLR(__get_SCTLR() | (1U << 12U) | (1U << 2U));
  __ISB();
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<L1C_EnableCaches>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <__get_SCTLR@plt>
  or     $0x1004,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1090 <__ISB@plt>
```

assistant: ```c
void L1C_EnableCaches(void) {
  __set_SCTLR(__get_SCTLR() | (1U << 12U) | (1U << 2U));
  __ISB();
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<lengthOfLongestSubstringOn2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x140,%rsp
  mov    %rdi,-0x138(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x138(%rbp)
  jne    L66
  mov    $0x0,%eax
  jmp    L54
L66:
  movl   $0x0,-0x120(%rbp)
  movl   $0x0,-0x114(%rbp)
  lea    -0x110(%rbp),%rax
  mov    $0x100,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x11c(%rbp)
  movl   $0x0,-0x118(%rbp)
  mov    -0x118(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x138(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x122(%rbp)
  mov    -0x11c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x138(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x121(%rbp)
  jmp    L7
L9:
  movsbl -0x122(%rbp),%eax
  cltq
  movzbl -0x110(%rbp,%rax,1),%eax
  test   %al,%al
  je     L11
  mov    -0x118(%rbp),%eax
  sub    -0x11c(%rbp),%eax
  mov    %eax,-0x114(%rbp)
  mov    -0x120(%rbp),%edx
  mov    -0x114(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x120(%rbp)
  jmp    L68
L75:
  movsbl -0x121(%rbp),%eax
  cltq
  movb   $0x0,-0x110(%rbp,%rax,1)
  addl   $0x1,-0x11c(%rbp)
  mov    -0x11c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x138(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x121(%rbp)
L68:
  movzbl -0x121(%rbp),%eax
  cmp    -0x122(%rbp),%al
  jne    L75
  movsbl -0x121(%rbp),%eax
  cltq
  movb   $0x0,-0x110(%rbp,%rax,1)
  addl   $0x1,-0x11c(%rbp)
  mov    -0x11c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x138(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x121(%rbp)
L11:
  movsbl -0x122(%rbp),%eax
  cltq
  movb   $0x1,-0x110(%rbp,%rax,1)
  addl   $0x1,-0x118(%rbp)
  mov    -0x118(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x138(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x122(%rbp)
L7:
  cmpb   $0x0,-0x122(%rbp)
  jne    L9
  mov    -0x118(%rbp),%eax
  sub    -0x11c(%rbp),%eax
  mov    %eax,-0x114(%rbp)
  mov    -0x114(%rbp),%edx
  mov    -0x120(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
L54:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L30
  call   <__stack_chk_fail@plt>
L30:
  leave
  ret
```

assistant: ```c
int lengthOfLongestSubstringOn2(char *s) {
  if (!s)
    return 0;
  int len = 0, newLen = 0;
  char existed[256];
  memset(existed, 0, sizeof(char) * 256);
  int start = 0;
  int end = 0;
  char endC = *(s + end);
  char startC = *(s + start);
  while (endC) {
    if (existed[endC]) {
      newLen = end - start;
      len = len > newLen ? len : newLen;
      while (startC != endC) {
        existed[startC] = 0;
        start++;
        startC = *(s + start);
      }
      existed[startC] = 0;
      start++;
      startC = *(s + start);
    }
    existed[endC] = 1;
    end++;
    endC = *(s + end);
  }
  newLen = end - start;
  return len > newLen ? len : newLen;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<lengthOfLongestSubstringOn2>:
  endbr64
  push   %rbx
  sub    $0x110,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L42
  mov    %rdi,%rbx
  mov    %rsp,%rdi
  mov    $0x100,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  movzbl (%rbx),%ecx
  test   %cl,%cl
  je     L70
  mov    %ecx,%edx
  mov    $0x1,%esi
  mov    $0x0,%r8d
  mov    $0x0,%r10d
  jmp    L33
L80:
  mov    %edx,%ecx
L17:
  movsbq %cl,%rcx
  movb   $0x0,(%rsp,%rcx,1)
  add    $0x1,%r8d
  movslq %r8d,%rax
  movzbl (%rbx,%rax,1),%edx
L43:
  movslq %edi,%rax
  movb   $0x1,(%rsp,%rax,1)
  mov    %esi,%eax
  add    $0x1,%rsi
  movzbl -0x1(%rbx,%rsi,1),%ecx
  test   %cl,%cl
  je     L61
L33:
  lea    -0x1(%rsi),%eax
  movsbl %cl,%edi
  movsbq %cl,%r9
  cmpb   $0x0,(%rsp,%r9,1)
  je     L43
  sub    %r8d,%eax
  cmp    %eax,%r10d
  cmovl  %eax,%r10d
  cmp    %dl,%cl
  je     L80
  lea    0x1(%r8),%eax
  cltq
L20:
  movsbq %dl,%rdx
  movb   $0x0,(%rsp,%rdx,1)
  mov    %eax,%r8d
  add    $0x1,%rax
  movzbl -0x1(%rbx,%rax,1),%edx
  cmp    %cl,%dl
  jne    L20
  jmp    L17
L70:
  mov    $0x0,%eax
  mov    $0x0,%r8d
  mov    $0x0,%r10d
L61:
  sub    %r8d,%eax
  cmp    %r10d,%eax
  cmovl  %r10d,%eax
L42:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0x110,%rsp
  pop    %rbx
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int lengthOfLongestSubstringOn2(char *s) {
  if (!s)
    return 0;
  int len = 0, newLen = 0;
  char existed[256];
  memset(existed, 0, sizeof(char) * 256);
  int start = 0;
  int end = 0;
  char endC = *(s + end);
  char startC = *(s + start);
  while (endC) {
    if (existed[endC]) {
      newLen = end - start;
      len = len > newLen ? len : newLen;
      while (startC != endC) {
        existed[startC] = 0;
        start++;
        startC = *(s + start);
      }
      existed[startC] = 0;
      start++;
      startC = *(s + start);
    }
    existed[endC] = 1;
    end++;
    endC = *(s + end);
  }
  newLen = end - start;
  return len > newLen ? len : newLen;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<lengthOfLongestSubstringOn2>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbx
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L12
  mov    %rdi,%rbx
  mov    $0x100,%edx
  mov    %rsp,%rdi
  xor    %esi,%esi
  call   <memset@plt>
  movsbq (%rbx),%rax
  test   %al,%al
  je     L12
  mov    %eax,%ecx
  mov    $0x1,%esi
  xor    %edi,%edi
  xor    %r9d,%r9d
  jmp    L41
  nopl   0x0(%rax)
L57:
  mov    %esi,%edx
  add    $0x1,%rsi
  movb   $0x1,(%rsp,%r8,1)
  movzbl -0x1(%rbx,%rsi,1),%ecx
  test   %cl,%cl
  je     L2
L41:
  movsbq %cl,%r8
  lea    -0x1(%rsi),%edx
  cmpb   $0x0,(%rsp,%r8,1)
  je     L57
  sub    %edi,%edx
  cmp    %edx,%r9d
  cmovl  %edx,%r9d
  cmp    %al,%cl
  je     L59
  add    $0x1,%edi
  movslq %edi,%rdx
  nopl   (%rax)
L35:
  mov    %edx,%edi
  add    $0x1,%rdx
  movb   $0x0,(%rsp,%rax,1)
  movsbq -0x1(%rbx,%rdx,1),%rax
  cmp    %cl,%al
  jne    L35
L59:
  add    $0x1,%edi
  movb   $0x0,(%rsp,%r8,1)
  movslq %edi,%rax
  movsbq (%rbx,%rax,1),%rax
  jmp    L57
  xchg   %ax,%ax
L2:
  sub    %edi,%edx
  cmp    %r9d,%edx
  cmovge %edx,%r9d
  mov    %r9d,%r12d
L12:
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L85
  add    $0x118,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
L85:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int lengthOfLongestSubstringOn2(char *s) {
  if (!s)
    return 0;
  int len = 0, newLen = 0;
  char existed[256];
  memset(existed, 0, sizeof(char) * 256);
  int start = 0;
  int end = 0;
  char endC = *(s + end);
  char startC = *(s + start);
  while (endC) {
    if (existed[endC]) {
      newLen = end - start;
      len = len > newLen ? len : newLen;
      while (startC != endC) {
        existed[startC] = 0;
        start++;
        startC = *(s + start);
      }
      existed[startC] = 0;
      start++;
      startC = *(s + start);
    }
    existed[endC] = 1;
    end++;
    endC = *(s + end);
  }
  newLen = end - start;
  return len > newLen ? len : newLen;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<lengthOfLongestSubstringOn2>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbx
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L8
  mov    %rdi,%rbx
  mov    $0x100,%edx
  mov    %rsp,%rdi
  xor    %esi,%esi
  call   <memset@plt>
  movsbq (%rbx),%rax
  test   %al,%al
  je     L8
  mov    %eax,%ecx
  mov    $0x1,%esi
  xor    %edi,%edi
  xor    %r9d,%r9d
  jmp    L58
  nopl   0x0(%rax)
L82:
  mov    %esi,%edx
  add    $0x1,%rsi
  movb   $0x1,(%rsp,%r8,1)
  movzbl -0x1(%rbx,%rsi,1),%ecx
  test   %cl,%cl
  je     L38
L58:
  movsbq %cl,%r8
  lea    -0x1(%rsi),%edx
  cmpb   $0x0,(%rsp,%r8,1)
  je     L82
  sub    %edi,%edx
  cmp    %edx,%r9d
  cmovl  %edx,%r9d
  cmp    %al,%cl
  je     L51
  add    $0x1,%edi
  movslq %edi,%rdx
  nopl   (%rax)
L30:
  mov    %edx,%edi
  add    $0x1,%rdx
  movb   $0x0,(%rsp,%rax,1)
  movsbq -0x1(%rbx,%rdx,1),%rax
  cmp    %cl,%al
  jne    L30
L51:
  add    $0x1,%edi
  movb   $0x0,(%rsp,%r8,1)
  movslq %edi,%rax
  movsbq (%rbx,%rax,1),%rax
  jmp    L82
  xchg   %ax,%ax
L38:
  sub    %edi,%edx
  cmp    %r9d,%edx
  cmovge %edx,%r9d
  mov    %r9d,%r12d
L8:
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  add    $0x118,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
L53:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int lengthOfLongestSubstringOn2(char *s) {
  if (!s)
    return 0;
  int len = 0, newLen = 0;
  char existed[256];
  memset(existed, 0, sizeof(char) * 256);
  int start = 0;
  int end = 0;
  char endC = *(s + end);
  char startC = *(s + start);
  while (endC) {
    if (existed[endC]) {
      newLen = end - start;
      len = len > newLen ? len : newLen;
      while (startC != endC) {
        existed[startC] = 0;
        start++;
        startC = *(s + start);
      }
      existed[startC] = 0;
      start++;
      startC = *(s + start);
    }
    existed[endC] = 1;
    end++;
    endC = *(s + end);
  }
  newLen = end - start;
  return len > newLen ? len : newLen;
}
```