__attribute__((no, noclone)) unsigned __int128 t145_3sub(unsigned __int128 y) {
  unsigned __int128 r;
  if (__builtin_sub_overflow(
          (signed __int128)((
              -((signed __int128)(((unsigned __int128)1 << (16 * 8 - 1)) - 1)) -
              1)),
          y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t145_3sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rax
neg    %rdx
movabs $0x8000000000000000,%rcx
sbb    %rax,%rcx
mov    $0xffffffffffffffff,%r9
mov    %r9,%r8
sbb    $0x0,%r8
sbb    $0x0,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    118f <t145_3sub+0x7f>
jmp    1196 <t145_3sub+0x86>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t145_3sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
neg    %r14
movabs $0x8000000000000000,%rbx
sbb    %rsi,%rbx
mov    $0xffffffffffffffff,%rcx
sbb    $0x0,%rcx
mov    $0xffffffffffffffff,%rdx
sbb    $0x0,%rdx
mov    %ecx,%eax
and    $0x1,%eax
neg    %rax
xor    %rax,%rdx
xor    %rax,%rcx
or     %rdx,%rcx
jne    1155 <t145_3sub+0x45>
test   %rax,%rax
jns    115c <t145_3sub+0x4c>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t145_3sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = zext i128 %11 to i129
%13 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 -170141183460469231731687303715884105728, i129 %12)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = zext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t145_3sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = tail call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 -170141183460469231731687303715884105728, i129 %7)
%9 = extractvalue { i129, i1 } %8, 1
%10 = extractvalue { i129, i1 } %8, 0
%11 = icmp slt i129 %10, 0
%12 = or i1 %9, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 (...) @bar()
br label %15
15: ; preds = %13, %2
%16 = trunc i129 %10 to i64
%17 = lshr i129 %10, 64
%18 = trunc i129 %17 to i64
%19 = insertvalue { i64, i64 } poison, i64 %16, 0
%20 = insertvalue { i64, i64 } %19, i64 %18, 1
ret { i64, i64 } %20
}