user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<test_xchg>:
  endbr64
  push   %r15
  lea    D40(%rip),%r15
  push   %r14
  lea    D4(%rip),%r14
  push   %r13
  mov    %r14,%rsi
  lea    D8(%rip),%r13
  push   %r12
  lea    D47(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  mov    $0xfbca7654,%ebp
  push   %rbx
  mov    $0x12345678,%ebx
  mov    %ebp,%ecx
  mov    %ebx,%edx
  xchg   %edx,%ecx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    %ebx,%edx
  mov    %ebp,%ecx
  xchg   %dx,%cx
  call   <printf@plt>
  mov    %r13,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    %ebx,%edx
  mov    %ebp,%ecx
  xchg   %dl,%cl
  call   <printf@plt>
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  movl   $0xfbca7654,0x4(%rsp)
  xor    %eax,%eax
  lea    D18(%rip),%r14
  xchg   %edx,0x4(%rsp)
  mov    0x4(%rsp),%ecx
  call   <printf@plt>
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  movl   $0xfbca7654,0x4(%rsp)
  xor    %eax,%eax
  lea    D25(%rip),%r15
  xchg   %dx,0x4(%rsp)
  mov    0x4(%rsp),%ecx
  call   <printf@plt>
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  lea    D78(%rip),%r13
  lea    D58(%rip),%r12
  xor    %eax,%eax
  movl   $0xfbca7654,0x4(%rsp)
  xchg   %dl,0x4(%rsp)
  mov    0x4(%rsp),%ecx
  call   <printf@plt>
  mov    %ebp,%eax
  mov    $0xfbca7654,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %ecx,%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    $0xfbca7654,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %cx,%r8w
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    $0xfbca7654,%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %cl,%r8b
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    $0xfffefdfc,%edx
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %ecx,%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    $0xfffefdfc,%edx
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %cx,%r8w
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %r14,%rsi
  mov    %r12,%rdi
  mov    $0xfffefdfc,%edx
  mov    %ebx,%ecx
  mov    %ebp,%r8d
  cmpxchg %cl,%r8b
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    %ebx,%ecx
  mov    $0xfbca7654,%edx
  movl   $0xfbca7654,0x4(%rsp)
  mov    %r13,%rsi
  mov    %r12,%rdi
  cmpxchg %ecx,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    %ebx,%ecx
  mov    $0xfbca7654,%edx
  movl   $0xfbca7654,0x4(%rsp)
  mov    %r15,%rsi
  mov    %r12,%rdi
  cmpxchg %cx,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%eax
  mov    %ebx,%ecx
  mov    $0xfbca7654,%edx
  movl   $0xfbca7654,0x4(%rsp)
  mov    %r14,%rsi
  mov    %r12,%rdi
  cmpxchg %cl,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %ebx,%ecx
  mov    %r13,%rsi
  movl   $0xfbca7654,0x4(%rsp)
  mov    $0xfffefdfc,%edx
  mov    %r12,%rdi
  cmpxchg %ecx,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %ebx,%ecx
  mov    %r15,%rsi
  movl   $0xfbca7654,0x4(%rsp)
  mov    $0xfffefdfc,%edx
  mov    %r12,%rdi
  cmpxchg %cx,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffefdfc,%eax
  mov    %ebx,%ecx
  mov    %r14,%rsi
  movl   $0xfbca7654,0x4(%rsp)
  mov    $0xfffefdfc,%edx
  mov    %r12,%rdi
  cmpxchg %cl,0x4(%rsp)
  mov    0x4(%rsp),%r8d
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D40
type: string
name: extract_symbolic_data
arguments: data_tag: D4
type: string
name: extract_symbolic_data
arguments: data_tag: D8
type: string
name: extract_symbolic_data
arguments: data_tag: D47
type: string
name: extract_symbolic_data
arguments: data_tag: D18
type: string
name: extract_symbolic_data
arguments: data_tag: D25
type: string
name: extract_symbolic_data
arguments: data_tag: D78
type: string
name: extract_symbolic_data
arguments: data_tag: D58
type: string

tool: D40: xchgw

tool: D4: xchgl

tool: D8: xchgb

tool: D47: %-10s A=%08x B=%08x


tool: D18: cmpxchgb

tool: D25: cmpxchgw

tool: D78: cmpxchgl

tool: D58: %-10s EAX=%08x A=%08x C=%08x


assistant: ```c
void test_xchg(void) {
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgl", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgw", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgb", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgl", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgw", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("xchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1));
    printf("%-10s A=%08x B=%08x\n", "xchgb", op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgl", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgw", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgb", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgl", 0xfffefdfc, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgw", 0xfffefdfc, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=q"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgb", 0xfffefdfc, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgl", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgw", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfbca7654));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgb", 0xfbca7654, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgl"
        " %"
        ""
        "0, %"
        ""
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgl", 0xfffefdfc, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgw"
        " %"
        "w"
        "0, %"
        "w"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgw", 0xfffefdfc, op0, op1);
  };
  {
    int op0, op1;
    op0 = 0x12345678;
    op1 = 0xfbca7654;
    asm("cmpxchgb"
        " %"
        "b"
        "0, %"
        "b"
        "1"
        : "=q"(op0), "=m"(op1)
        : "0"(op0), "1"(op1), "a"(0xfffefdfc));
    printf("%-10s EAX=%08x A=%08x C=%08x\n", "cmpxchgb", 0xfffefdfc, op0, op1);
  };
}
```