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


x86 assembly (clang, -O0):
<t122_2mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%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)
movabs $0x8000000000000000,%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%r8
mov    %r8,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x60(%rbp)
sar    $0x3f,%r8
mov    %rax,%rdi
imul   %r8,%rdi
mul    %r8
mov    %rax,%r9
mov    -0x68(%rbp),%rax
mov    %rdx,%rsi
mov    -0x78(%rbp),%rdx
add    %rdi,%rsi
mov    %rcx,%rdi
imul   %r8,%rdi
add    %rdi,%rsi
mov    %rcx,%r10
sar    $0x3f,%r10
mov    %r10,%r11
imul   %rax,%r11
mov    %r10,%rax
mul    %rdx
mov    %rax,%r8
mov    -0x78(%rbp),%rax
mov    %rdx,%rdi
mov    -0x80(%rbp),%rdx
add    %r11,%rdi
imul   %rax,%r10
add    %r10,%rdi
add    %r9,%r8
adc    %rsi,%rdi
mul    %rdx
mov    %rax,%rsi
mov    -0x68(%rbp),%rax
mov    %rsi,-0x58(%rbp)
mov    %rdx,%rsi
mov    -0x80(%rbp),%rdx
mov    %rsi,-0x70(%rbp)
mul    %rdx
mov    %rax,%r9
mov    -0x78(%rbp),%rax
mov    %rdx,%r10
mov    -0x70(%rbp),%rdx
add    %rdx,%r9
adc    $0x0,%r10
mul    %rcx
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rdx,%rsi
mov    -0x60(%rbp),%rdx
add    %r9,%rcx
adc    %rsi,%r10
setb   %sil
movzbl %sil,%esi
mov    %esi,%r9d
mul    %rdx
mov    %rdx,%rsi
mov    -0x58(%rbp),%rdx
add    %r10,%rax
adc    %r9,%rsi
add    %r8,%rax
adc    %rdi,%rsi
mov    %rcx,%rdi
sar    $0x3f,%rdi
xor    %rdi,%rsi
xor    %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    1255 <t122_2mul+0x145>
jmp    125c <t122_2mul+0x14c>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t122_2mul>:
push   %r14
push   %rbx
push   %rax
movabs $0x8000000000000000,%r9
mov    $0xffffffffffffffff,%rcx
mov    %rdi,%rax
mul    %rcx
mov    %rax,%r8
mov    %rdx,%rcx
sub    %rdi,%rcx
sub    %rsi,%rcx
mov    %rsi,%rax
and    %r9,%rax
add    %rax,%rcx
mov    %rsi,%rax
mul    %r9
mov    %rdx,%rsi
mov    %rax,%rbx
mov    %rdi,%rax
mul    %r9
mov    %rax,%r14
or     %rbx,%rdx
add    %r8,%rdx
adc    %rcx,%rsi
sar    $0x3f,%rax
xor    %rax,%rsi
xor    %rdx,%rax
or     %rsi,%rax
je     1174 <t122_2mul+0x64>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define { i64, i64 } @t122_2mul(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 = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %6, i128 -170141183460469231731687303715884105728)
%8 = extractvalue { i128, i1 } %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @bar()
br label %11
11: ; preds = %9, %2
%12 = extractvalue { i128, i1 } %7, 0
%13 = lshr exact i128 %12, 64
%14 = trunc i128 %13 to i64
%15 = insertvalue { i64, i64 } { i64 0, i64 poison }, i64 %14, 1
ret { i64, i64 } %15
}