ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below?

```asm
<xor_cipher>:
  endbr64
  mov    %rdi,%r9
  mov    %rsi,%r10
  test   %rdx,%rdx
  je     L11
  xor    %eax,%eax
  xor    %edi,%edi
  xor    %r11d,%r11d
  cs nopw 0x0(%rax,%rax,1)
L14:
  movzbl (%rcx,%rax,1),%esi
  add    $0x1,%rax
  xor    (%r10),%sil
  cmp    %r8,%rax
  mov    %sil,(%r9)
  cmove  %r11,%rax
  add    $0x1,%rdi
  cmp    %rdi,%rdx
  jne    L14
L11:
  ret
```

assistant: ```c
void xor_cipher(char *des, char *src, size_t n, char *key, size_t kn) {
  for (size_t i = 0, j = 0; i < n; i++) {
    *des = key[j] ^ (*src);
    if (++j == kn) {
      j = 0;
    }
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<xor_cipher>:
  endbr64
  mov    %rdi,%r10
  test   %rdx,%rdx
  je     L48
  xor    %eax,%eax
  xor    %r9d,%r9d
  nopl   0x0(%rax)
L12:
  movzbl (%rcx,%rax,1),%edi
  add    $0x1,%rax
  xor    (%rsi),%dil
  add    $0x1,%r9
  mov    %dil,(%r10)
  cmp    %r8,%rax
  je     L0
  cmp    %r9,%rdx
  jne    L12
  ret
  nopl   (%rax)
L0:
  cmp    %r9,%rdx
  je     L13
  xor    %eax,%eax
  jmp    L12
  nopl   0x0(%rax)
L48:
  ret
  nopl   0x0(%rax)
L13:
  ret
```

assistant: ```c
void xor_cipher(char *des, char *src, size_t n, char *key, size_t kn) {
  for (size_t i = 0, j = 0; i < n; i++) {
    *des = key[j] ^ (*src);
    if (++j == kn) {
      j = 0;
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L7:
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D68(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc(%rbp),%eax
  cmp    $0x4,%eax
  je     L56
  cmp    $0x4,%eax
  jg     L17
  cmp    $0x3,%eax
  je     L82
  cmp    $0x3,%eax
  jg     L17
  cmp    $0x1,%eax
  je     L18
  cmp    $0x2,%eax
  je     L41
  jmp    L17
L18:
  mov    $0x0,%eax
  call   <insert@plt>
  jmp    L47
L41:
  mov    $0x0,%eax
  call   <delete@plt>
  jmp    L47
L82:
  mov    $0x0,%eax
  call   <display@plt>
  jmp    L47
L56:
  mov    $0x1,%edi
  call   <exit@plt>
L17:
  lea    D32(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L47:
  jmp    L7
```

tool_calls: name: parse_data
arguments: tag: D4
data_type: string
name: parse_data
arguments: tag: D60
data_type: string
name: parse_data
arguments: tag: D36
data_type: string
name: parse_data
arguments: tag: D24
data_type: string
name: parse_data
arguments: tag: D10
data_type: string
name: parse_data
arguments: tag: D68
data_type: string
name: parse_data
arguments: tag: D32
data_type: string

tool: D4: 1.Insert element to queue 


tool: D60: 2.Delete element from queue 


tool: D36: 3.Display all elements of queue 


tool: D24: 4.Quit 


tool: D10: Enter your choice : 

tool: D68: %d

tool: D32: Wrong choice 


assistant: ```c
int main() {
  int choice;
  while (1) {
    printf("1.Insert element to queue \n");
    printf("2.Delete element from queue \n");
    printf("3.Display all elements of queue \n");
    printf("4.Quit \n");
    printf("Enter your choice : ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      exit(1);
    default:
      printf("Wrong choice \n");
    }
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D45(%rip),%r13
  lea    D3(%rip),%r12
  lea    D28(%rip),%rbp
  lea    D49(%rip),%rbx
  jmp    L64
L1:
  cmp    $0x4,%eax
  jne    L72
  mov    $0x1,%edi
  call   <exit@plt>
L72:
  lea    D36(%rip),%rdi
  call   <printf@plt>
L64:
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D62(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D17(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x3,%eax
  je     L55
  jg     L1
  cmp    $0x1,%eax
  je     L65
  cmp    $0x2,%eax
  jne    L72
  mov    $0x0,%eax
  call   <delete@plt>
  jmp    L64
L65:
  mov    $0x0,%eax
  call   <insert@plt>
  jmp    L64
L55:
  mov    $0x0,%eax
  call   <display@plt>
  jmp    L64
```

tool_calls: name: unpack_data
arguments: data_tag: D45
type: string
name: unpack_data
arguments: data_tag: D3
type: string
name: unpack_data
arguments: data_tag: D28
type: string
name: unpack_data
arguments: data_tag: D49
type: string
name: unpack_data
arguments: data_tag: D36
type: string
name: unpack_data
arguments: data_tag: D62
type: string
name: unpack_data
arguments: data_tag: D17
type: string

tool: D45: 1.Insert element to queue 


tool: D3: 2.Delete element from queue 


tool: D28: 3.Display all elements of queue 


tool: D49: 4.Quit 


tool: D36: Wrong choice 


tool: D62: Enter your choice : 

tool: D17: %d

assistant: ```c
int main() {
  int choice;
  while (1) {
    printf("1.Insert element to queue \n");
    printf("2.Delete element from queue \n");
    printf("3.Display all elements of queue \n");
    printf("4.Quit \n");
    printf("Enter your choice : ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      exit(1);
    default:
      printf("Wrong choice \n");
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %r15
  lea    D18(%rip),%r15
  push   %r14
  lea    D43(%rip),%r14
  push   %r13
  lea    D67(%rip),%r13
  push   %r12
  lea    D28(%rip),%r12
  push   %rbp
  lea    D69(%rip),%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbx
  nopw   0x0(%rax,%rax,1)
L35:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14,%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbx,%rsi
  lea    D47(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x3,%eax
  je     L34
  jg     L45
  cmp    $0x1,%eax
  je     L21
  cmp    $0x2,%eax
  jne    L74
  xor    %eax,%eax
  call   <delete@plt>
  jmp    L35
  nopl   (%rax)
L45:
  cmp    $0x4,%eax
  jne    L74
  mov    $0x1,%edi
  call   <exit@plt>
L74:
  lea    D29(%rip),%rdi
  call   <printf@plt>
  jmp    L35
  nopl   (%rax)
L34:
  xor    %eax,%eax
  call   <display@plt>
  jmp    L35
  nopl   0x0(%rax)
L21:
  xor    %eax,%eax
  call   <insert@plt>
  jmp    L35
```

tool_calls: name: parse_data
arguments: label: D18
type_guessed: string
name: parse_data
arguments: label: D43
type_guessed: string
name: parse_data
arguments: label: D67
type_guessed: string
name: parse_data
arguments: label: D28
type_guessed: string
name: parse_data
arguments: label: D69
type_guessed: string
name: parse_data
arguments: label: D47
type_guessed: string
name: parse_data
arguments: label: D29
type_guessed: string

tool: D18: 1.Insert element to queue 


tool: D43: 2.Delete element from queue 


tool: D67: 3.Display all elements of queue 


tool: D28: 4.Quit 


tool: D69: Enter your choice : 

tool: D47: %d

tool: D29: Wrong choice 


assistant: ```c
int main() {
  int choice;
  while (1) {
    printf("1.Insert element to queue \n");
    printf("2.Delete element from queue \n");
    printf("3.Display all elements of queue \n");
    printf("4.Quit \n");
    printf("Enter your choice : ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      exit(1);
    default:
      printf("Wrong choice \n");
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  lea    D59(%rip),%r15
  push   %r14
  lea    D7(%rip),%r14
  push   %r13
  lea    D69(%rip),%r13
  push   %r12
  lea    D31(%rip),%r12
  push   %rbp
  lea    D28(%rip),%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbx
  nopw   0x0(%rax,%rax,1)
L68:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14,%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbx,%rsi
  lea    D43(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x3,%eax
  je     L80
  jg     L3
  cmp    $0x1,%eax
  je     L45
  cmp    $0x2,%eax
  jne    L15
  xor    %eax,%eax
  call   <delete@plt>
  jmp    L68
  nopl   (%rax)
L3:
  cmp    $0x4,%eax
  jne    L15
  mov    $0x1,%edi
  call   <exit@plt>
L15:
  lea    D67(%rip),%rdi
  call   <printf@plt>
  jmp    L68
  nopl   (%rax)
L80:
  xor    %eax,%eax
  call   <display@plt>
  jmp    L68
  nopl   0x0(%rax)
L45:
  xor    %eax,%eax
  call   <insert@plt>
  jmp    L68
```

tool_calls: name: retrieve_data
arguments: data_label: D59
datatype: string
name: retrieve_data
arguments: data_label: D7
datatype: string
name: retrieve_data
arguments: data_label: D69
datatype: string
name: retrieve_data
arguments: data_label: D31
datatype: string
name: retrieve_data
arguments: data_label: D28
datatype: string
name: retrieve_data
arguments: data_label: D43
datatype: string
name: retrieve_data
arguments: data_label: D67
datatype: string

tool: D59: 1.Insert element to queue 


tool: D7: 2.Delete element from queue 


tool: D69: 3.Display all elements of queue 


tool: D31: 4.Quit 


tool: D28: Enter your choice : 

tool: D43: %d

tool: D67: Wrong choice 


assistant: ```c
int main() {
  int choice;
  while (1) {
    printf("1.Insert element to queue \n");
    printf("2.Delete element from queue \n");
    printf("3.Display all elements of queue \n");
    printf("4.Quit \n");
    printf("Enter your choice : ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      exit(1);
    default:
      printf("Wrong choice \n");
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<FLASH_init>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xd7788,%edx
  mov    $0x26,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x11bc8,%edx
  mov    $0x27,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x109,%edx
  mov    $0x1,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xf03,%edx
  mov    $0x19,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x1001,%edx
  mov    $0xf,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void FLASH_init(void) {
  mbus_remote_register_write(0x5, 0x26, 0x0D7788);
  mbus_remote_register_write(0x5, 0x27, 0x011BC8);
  mbus_remote_register_write(0x5, 0x01, 0x000109);
  mbus_remote_register_write(0x5, 0x19, 0x000F03);
  mbus_remote_register_write(0x5, 0x0F, 0x001001);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<FLASH_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xd7788,%edx
  mov    $0x26,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x11bc8,%edx
  mov    $0x27,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x109,%edx
  mov    $0x1,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xf03,%edx
  mov    $0x19,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x1001,%edx
  mov    $0xf,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void FLASH_init(void) {
  mbus_remote_register_write(0x5, 0x26, 0x0D7788);
  mbus_remote_register_write(0x5, 0x27, 0x011BC8);
  mbus_remote_register_write(0x5, 0x01, 0x000109);
  mbus_remote_register_write(0x5, 0x19, 0x000F03);
  mbus_remote_register_write(0x5, 0x0F, 0x001001);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<FLASH_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xd7788,%edx
  mov    $0x26,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x11bc8,%edx
  mov    $0x27,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x109,%edx
  mov    $0x1,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xf03,%edx
  mov    $0x19,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x1001,%edx
  mov    $0xf,%esi
  mov    $0x5,%edi
  add    $0x8,%rsp
  jmp    1050 <mbus_remote_register_write@plt>
```

assistant: ```c
void FLASH_init(void) {
  mbus_remote_register_write(0x5, 0x26, 0x0D7788);
  mbus_remote_register_write(0x5, 0x27, 0x011BC8);
  mbus_remote_register_write(0x5, 0x01, 0x000109);
  mbus_remote_register_write(0x5, 0x19, 0x000F03);
  mbus_remote_register_write(0x5, 0x0F, 0x001001);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<FLASH_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xd7788,%edx
  mov    $0x26,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x11bc8,%edx
  mov    $0x27,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x109,%edx
  mov    $0x1,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xf03,%edx
  mov    $0x19,%esi
  mov    $0x5,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x1001,%edx
  mov    $0xf,%esi
  mov    $0x5,%edi
  add    $0x8,%rsp
  jmp    1050 <mbus_remote_register_write@plt>
```

assistant: ```c
void FLASH_init(void) {
  mbus_remote_register_write(0x5, 0x26, 0x0D7788);
  mbus_remote_register_write(0x5, 0x27, 0x011BC8);
  mbus_remote_register_write(0x5, 0x01, 0x000109);
  mbus_remote_register_write(0x5, 0x19, 0x000F03);
  mbus_remote_register_write(0x5, 0x0F, 0x001001);
}
```
user: Translate the below assembly code into C programming language:

```asm
<getPW>:
  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
  movq   $0x0,-0x20(%rbp)
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <sysconf@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x3ff,-0x18(%rbp)
  ja     L38
  movq   $0x400,-0x18(%rbp)
L38:
  mov    -0x40(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L91
  mov    D44(%rip),%rax
  mov    (%rax),%eax
  jmp    L110
L91:
  mov    -0x18(%rbp),%rax
  lea    -0x4(%rax),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x4(%rax),%rdx
  lea    -0x20(%rbp),%rdi
  mov    -0x10(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <getpwnam_r@plt>
  mov    %eax,-0x24(%rbp)
  mov    D17(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  shlq   -0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L91
  mov    D44(%rip),%rax
  mov    (%rax),%eax
  jmp    L110
L16:
  nop
  mov    -0x20(%rbp),%rax
  test   %rax,%rax
  jne    L100
  cmpl   $0x0,-0x24(%rbp)
  jne    L100
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    D22(%rip),%rax
  mov    (%rax),%eax
  jmp    L110
L100:
  cmpl   $0x0,-0x24(%rbp)
  je     L56
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x24(%rbp),%eax
  jmp    L110
L56:
  mov    -0x40(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L110:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L84
  call   <__stack_chk_fail@plt>
L84:
  leave
  ret
```

assistant: ```c
int getPW(const char *user, char **pwbuf) {
  struct passwd *pwbufp = NULL;
  size_t currBufferSize = sysconf(_SC_GETPW_R_SIZE_MAX);
  if (currBufferSize < 1024) {
    currBufferSize = 1024;
  }
  *pwbuf = NULL;
  char *buf = (char *)malloc(sizeof(char) * currBufferSize);
  if (!buf) {
    return ENOMEM;
  }
  int error;
  for (;;) {
    error = getpwnam_r(user, (struct passwd *)buf, buf + sizeof(struct passwd), currBufferSize - sizeof(struct passwd), &pwbufp);
    if (error != ERANGE) {
      break;
    }
    free(buf);
    currBufferSize *= 2;
    buf = (char *)malloc(sizeof(char) * currBufferSize);
    if (!buf) {
      return ENOMEM;
    }
  }
  if (!pwbufp && !error) {
    free(buf);
    return ENOENT;
  } else if (error) {
    free(buf);
    return error;
  }
  *pwbuf = buf;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<getPW>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  mov    D13(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  mov    %rax,%rbp
  mov    $0x400,%eax
  cmp    %rax,%rbp
  cmovb  %rax,%rbp
  movq   $0x0,(%r15)
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %rsp,%r14
  test   %rax,%rax
  je     L92
L34:
  lea    -0x4(%rbp),%rcx
  lea    0x4(%rbx),%rdx
  mov    %r14,%r8
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <getpwnam_r@plt>
  mov    %eax,%r12d
  mov    D3(%rip),%rax
  cmp    %r12d,(%rax)
  jne    L42
  mov    %rbx,%rdi
  call   <free@plt>
  add    %rbp,%rbp
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L34
  mov    D35(%rip),%rax
  mov    (%rax),%r12d
  jmp    L48
L92:
  mov    D35(%rip),%rax
  mov    (%rax),%r12d
L48:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L42:
  cmpq   $0x0,(%rsp)
  jne    L91
  test   %r12d,%r12d
  je     L43
L91:
  test   %r12d,%r12d
  jne    L40
  mov    %rbx,(%r15)
  jmp    L48
L43:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    D15(%rip),%rax
  mov    (%rax),%r12d
  jmp    L48
L40:
  mov    %rbx,%rdi
  call   <free@plt>
  jmp    L48
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getPW(const char *user, char **pwbuf) {
  struct passwd *pwbufp = NULL;
  size_t currBufferSize = sysconf(_SC_GETPW_R_SIZE_MAX);
  if (currBufferSize < 1024) {
    currBufferSize = 1024;
  }
  *pwbuf = NULL;
  char *buf = (char *)malloc(sizeof(char) * currBufferSize);
  if (!buf) {
    return ENOMEM;
  }
  int error;
  for (;;) {
    error = getpwnam_r(user, (struct passwd *)buf, buf + sizeof(struct passwd), currBufferSize - sizeof(struct passwd), &pwbufp);
    if (error != ERANGE) {
      break;
    }
    free(buf);
    currBufferSize *= 2;
    buf = (char *)malloc(sizeof(char) * currBufferSize);
    if (!buf) {
      return ENOMEM;
    }
  }
  if (!pwbufp && !error) {
    free(buf);
    return ENOENT;
  } else if (error) {
    free(buf);
    return error;
  }
  *pwbuf = buf;
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<getPW>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    D3(%rip),%rax
  movq   $0x0,0x10(%rsp)
  mov    (%rax),%edi
  call   <sysconf@plt>
  movq   $0x0,(%r15)
  mov    %rax,%r8
  mov    $0x400,%eax
  cmp    %rax,%r8
  cmovae %r8,%rax
  mov    %eax,%edi
  mov    %rax,%rbx
  call   <malloc@plt>
  test   %rax,%rax
  je     L12
  mov    D14(%rip),%r13
  mov    %rax,%rbp
  lea    0x10(%rsp),%r14
  jmp    L23
  nopl   (%rax)
L57:
  mov    %rbp,%rdi
  add    %rbx,%rbx
  call   <free@plt>
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L12
L23:
  mov    %r14,%r8
  lea    -0x4(%rbx),%rcx
  lea    0x4(%rbp),%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <getpwnam_r@plt>
  mov    %eax,%r8d
  cmp    %eax,0x0(%r13)
  je     L57
  cmpq   $0x0,0x10(%rsp)
  je     L83
  test   %eax,%eax
  jne    L37
  mov    %rbp,(%r15)
  jmp    L68
  nopw   0x0(%rax,%rax,1)
L12:
  mov    D16(%rip),%rax
  mov    (%rax),%r8d
L68:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L70
  add    $0x28,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L83:
  test   %eax,%eax
  je     L14
L37:
  mov    %rbp,%rdi
  mov    %r8d,0xc(%rsp)
  call   <free@plt>
  mov    0xc(%rsp),%r8d
  jmp    L68
L14:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    D15(%rip),%rax
  mov    (%rax),%r8d
  jmp    L68
L70:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getPW(const char *user, char **pwbuf) {
  struct passwd *pwbufp = NULL;
  size_t currBufferSize = sysconf(_SC_GETPW_R_SIZE_MAX);
  if (currBufferSize < 1024) {
    currBufferSize = 1024;
  }
  *pwbuf = NULL;
  char *buf = (char *)malloc(sizeof(char) * currBufferSize);
  if (!buf) {
    return ENOMEM;
  }
  int error;
  for (;;) {
    error = getpwnam_r(user, (struct passwd *)buf, buf + sizeof(struct passwd), currBufferSize - sizeof(struct passwd), &pwbufp);
    if (error != ERANGE) {
      break;
    }
    free(buf);
    currBufferSize *= 2;
    buf = (char *)malloc(sizeof(char) * currBufferSize);
    if (!buf) {
      return ENOMEM;
    }
  }
  if (!pwbufp && !error) {
    free(buf);
    return ENOENT;
  } else if (error) {
    free(buf);
    return error;
  }
  *pwbuf = buf;
  return 0;
}
```