__attribute__((no, noclone)) unsigned __int128 t127_5mul(signed __int128 x) {
  unsigned __int128 r;
  if (__builtin_mul_overflow(x, (signed __int128)(8), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t127_5mul>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x78,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
sar    $0x3f,%rax
mov    %rax,-0x80(%rbp)
mov    $0x8,%ecx
mov    %rcx,-0x68(%rbp)
imul   %rcx
mov    %rax,%rsi
mov    -0x80(%rbp),%rax
mov    %rdx,%rbx
mul    %rcx
mov    %rax,%r11
mov    -0x78(%rbp),%rax
mov    %rdx,%r9
mov    %r11,%rdi
sar    $0x3f,%rdi
xor    %rdi,%rbx
mov    %r9,%r10
or     %r11,%r10
mov    %r10,%r8
xor    %rdi,%r8
mov    %r8,%rdx
or     %rbx,%rdx
or     %r9,%rsi
xor    %rdi,%rsi
or     %rsi,%r8
or     %rdx,%r8
mul    %rcx
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
mov    %rdx,%rsi
mov    -0x68(%rbp),%rdx
or     %rsi,%r11
mov    %r11d,%esi
and    $0x1,%esi
mov    %rsi,%r9
neg    %r9
mov    %r9,%rdi
xor    %r11,%rdi
xor    %r10,%r9
or     %r9,%rdi
or     %r8,%rdi
mov    %rdi,-0x60(%rbp)
mul    %rdx
mov    %rax,%rdi
mov    -0x60(%rbp),%rax
mov    %rdi,-0x58(%rbp)
mov    %rdx,%rdi
mov    -0x58(%rbp),%rdx
or     %rdi,%rcx
or     %rsi,%rax
setne  %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    11fa <t127_5mul+0xea>
jmp    1201 <t127_5mul+0xf1>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rdx
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<t127_5mul>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r8
mov    %rsi,%rbx
sar    $0x3f,%rbx
mov    $0x8,%r10d
mov    %rbx,%rax
imul   %r10
mov    %rax,%rcx
mov    %rdx,%rsi
mov    %rdi,%r9
mov    %rbx,%rax
mul    %r10
mov    %rdx,%rbx
mov    %rax,%rdi
lea    (%rax,%rdx,1),%r11
mov    %r8,%rax
mul    %r10
mov    %rax,%r8
or     %rdi,%rdx
mov    %rdi,%rax
sar    $0x3f,%rax
xor    %rax,%rsi
or     %rbx,%rcx
mov    %edx,%ebx
and    $0x1,%ebx
mov    %rbx,%rdi
neg    %rdi
xor    %rdi,%rdx
xor    %r11,%rdi
xor    %rax,%r11
or     %r11,%rsi
xor    %rax,%rcx
or     %r11,%rcx
or     %rsi,%rcx
or     %rdx,%rdi
mov    %r9,%rax
mul    %r10
mov    %rax,%r14
mov    %rdx,%r15
or     %r8,%r15
or     %rcx,%rdi
jne    11a8 <t127_5mul+0x98>
mov    %r15,%rax
xor    %r15,%rax
mov    %r14,%rcx
xor    %r14,%rcx
or     %rbx,%rcx
or     %rax,%rcx
je     11af <t127_5mul+0x9f>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %r15,%rdx
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define { i64, i64 } @t127_5mul(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 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.smul.with.overflow.i129(i129 %12, i129 8)
%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 } @t127_5mul(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 = sext i128 %6 to i129
%8 = tail call { i129, i1 } @llvm.smul.with.overflow.i129(i129 %7, i129 8)
%9 = extractvalue { i129, i1 } %8, 1
%10 = extractvalue { i129, i1 } %8, 0
%11 = and i129 %10, 340282366920938463463374607431768211448
%12 = icmp ne i129 %10, %11
%13 = or i1 %9, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = tail call i32 (...) @bar()
br label %16
16: ; preds = %14, %2
%17 = trunc i129 %10 to i64
%18 = lshr i129 %10, 64
%19 = trunc i129 %18 to i64
%20 = insertvalue { i64, i64 } poison, i64 %17, 0
%21 = insertvalue { i64, i64 } %20, i64 %19, 1
ret { i64, i64 } %21
}