long double testcompassign(_Atomic long double *addr) {
  *addr -= 25;
  return *addr;
}


x86 assembly (clang, -O0):
<testcompassign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    %rsi,-0x68(%rbp)
mov    $0x10,%edi
lea    -0x20(%rbp),%rdx
mov    $0x5,%ecx
call   1040 <__atomic_load@plt>
fldt   -0x20(%rbp)
fstpt  -0x5c(%rbp)
fldt   -0x5c(%rbp)
mov    -0x68(%rbp),%rsi
flds   0xea6(%rip)
fadd   %st(1),%st
xorps  %xmm0,%xmm0
movaps %xmm0,-0x30(%rbp)
fxch   %st(1)
fstpt  -0x30(%rbp)
movaps %xmm0,-0x40(%rbp)
fstpt  -0x40(%rbp)
mov    $0x10,%edi
lea    -0x30(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    $0x5,%r9d
mov    %r9d,%r8d
call   1030 <__atomic_compare_exchange@plt>
fldt   -0x30(%rbp)
test   $0x1,%al
fstpt  -0x5c(%rbp)
jne    119d <testcompassign+0x7d>
jmp    114d <testcompassign+0x2d>
mov    -0x8(%rbp),%rsi
mov    $0x10,%edi
lea    -0x50(%rbp),%rdx
mov    $0x5,%ecx
call   1040 <__atomic_load@plt>
fldt   -0x50(%rbp)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testcompassign>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
lea    0x30(%rsp),%rdx
mov    $0x10,%edi
mov    %rbx,%rsi
mov    $0x5,%ecx
call   1040 <__atomic_load@plt>
fldt   0x30(%rsp)
fld    %st(0)
fadds  0xeb1(%rip)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
fxch   %st(1)
fstpt  (%rsp)
movaps %xmm0,0x10(%rsp)
fstpt  0x10(%rsp)
mov    %rsp,%rdx
lea    0x10(%rsp),%rcx
mov    $0x10,%edi
mov    %rbx,%rsi
mov    $0x5,%r8d
mov    $0x5,%r9d
call   1030 <__atomic_compare_exchange@plt>
test   %al,%al
jne    11e3 <testcompassign+0xc3>
mov    %rsp,%r14
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
fldt   (%rsp)
fld    %st(0)
fadds  0xe55(%rip)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
fxch   %st(1)
fstpt  (%rsp)
movaps %xmm0,0x10(%rsp)
fstpt  0x10(%rsp)
mov    $0x10,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    $0x5,%r8d
mov    $0x5,%r9d
call   1030 <__atomic_compare_exchange@plt>
test   %al,%al
je     11a0 <testcompassign+0x80>
lea    0x20(%rsp),%rdx
mov    $0x10,%edi
mov    %rbx,%rsi
mov    $0x5,%ecx
call   1040 <__atomic_load@plt>
fldt   0x20(%rsp)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define x86_fp80 @testcompassign(x86_fp80* %0) {
%2 = alloca x86_fp80*
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
store x86_fp80* %0, x86_fp80** %2
%7 = load x86_fp80*, x86_fp80** %2
%8 = bitcast x86_fp80* %7 to i8*
%9 = bitcast x86_fp80* %3 to i8*
%10 = load x86_fp80, x86_fp80* %3
br label %11
11: ; preds = %11, %1
%12 = phi x86_fp80 [ %10, %1 ], [ %20, %11 ]
%13 = fsub x86_fp80 %12, 0xK4003C800000000000000
%14 = bitcast x86_fp80* %4 to i8*
store x86_fp80 %12, x86_fp80* %4
%15 = bitcast x86_fp80* %5 to i8*
store x86_fp80 %13, x86_fp80* %5
%16 = bitcast x86_fp80* %7 to i8*
%17 = bitcast x86_fp80* %4 to i8*
%18 = bitcast x86_fp80* %5 to i8*
%19 = call zeroext i1 @__atomic_compare_exchange(i64 16, i8* %16, i8* %17, i8* %18, i32 5, i32 5)
%20 = load x86_fp80, x86_fp80* %4
br i1 %19, label %21, label %11
21: ; preds = %11
%22 = load x86_fp80*, x86_fp80** %2
%23 = bitcast x86_fp80* %22 to i8*
%24 = bitcast x86_fp80* %6 to i8*
%25 = load x86_fp80, x86_fp80* %6
ret x86_fp80 %25
}

LLVM IR (-O2):
define x86_fp80 @testcompassign(x86_fp80* %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = bitcast x86_fp80* %0 to i8*
%7 = bitcast x86_fp80* %2 to i8*
%8 = bitcast x86_fp80* %3 to i8*
%9 = bitcast x86_fp80* %4 to i8*
%10 = load x86_fp80, x86_fp80* %2
%11 = fadd x86_fp80 %10, 0xKC003C800000000000000
store x86_fp80 %10, x86_fp80* %3
store x86_fp80 %11, x86_fp80* %4
%12 = call zeroext i1 @__atomic_compare_exchange(i64 16, i8* %6, i8* %8, i8* %9, i32 5, i32 5)
br i1 %12, label %17, label %13
13: ; preds = %1, %13
%14 = load x86_fp80, x86_fp80* %3
%15 = fadd x86_fp80 %14, 0xKC003C800000000000000
store x86_fp80 %14, x86_fp80* %3
store x86_fp80 %15, x86_fp80* %4
%16 = call zeroext i1 @__atomic_compare_exchange(i64 16, i8* %6, i8* %8, i8* %9, i32 5, i32 5)
br i1 %16, label %17, label %13
17: ; preds = %13, %1
%18 = bitcast x86_fp80* %5 to i8*
%19 = load x86_fp80, x86_fp80* %5
ret x86_fp80 %19
}