__attribute__((no, noclone)) signed __int128 t120_1mul(signed __int128 x,
                                                       signed __int128 y) {
  signed __int128 r;
  if (__builtin_mul_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t120_1mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdx,%rax
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rsi
mov    %rax,-0x30(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x38(%rbp),%r8
mov    %r8,-0x78(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x70(%rbp)
sar    $0x3f,%r8
mov    %rax,%rdi
imul   %r8,%rdi
mul    %r8
mov    %rax,%r9
mov    -0x78(%rbp),%rax
mov    %rdx,%rsi
mov    -0x88(%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    -0x88(%rbp),%rax
mov    %rdx,%rdi
mov    -0x90(%rbp),%rdx
add    %r11,%rdi
imul   %rax,%r10
add    %r10,%rdi
add    %r9,%r8
adc    %rsi,%rdi
mul    %rdx
mov    %rax,%rsi
mov    -0x78(%rbp),%rax
mov    %rsi,-0x68(%rbp)
mov    %rdx,%rsi
mov    -0x90(%rbp),%rdx
mov    %rsi,-0x80(%rbp)
mul    %rdx
mov    %rax,%r9
mov    -0x88(%rbp),%rax
mov    %rdx,%r10
mov    -0x80(%rbp),%rdx
add    %rdx,%r9
adc    $0x0,%r10
mul    %rcx
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
mov    %rdx,%rsi
mov    -0x70(%rbp),%rdx
add    %r9,%rcx
adc    %rsi,%r10
setb   %sil
movzbl %sil,%esi
mov    %esi,%r9d
mul    %rdx
mov    %rdx,%rsi
mov    -0x68(%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,-0x60(%rbp)
mov    %rcx,-0x58(%rbp)
test   $0x1,%al
jne    126f <t120_1mul+0x15f>
jmp    1276 <t120_1mul+0x166>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x60(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t120_1mul>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r9
mov    %rdi,%r11
sar    $0x3f,%rsi
mov    %rdx,%rdi
mov    %rdx,%rax
mul    %rsi
mov    %rax,%r10
imul   %rsi,%rdi
add    %rdi,%rdx
imul   %rcx,%rsi
add    %rdx,%rsi
mov    %rcx,%rdi
sar    $0x3f,%rdi
mov    %rdi,%rbx
imul   %r9,%rbx
mov    %rdi,%rax
mul    %r11
mov    %rax,%r8
add    %rbx,%rdx
imul   %r11,%rdi
add    %rdx,%rdi
add    %r10,%r8
adc    %rsi,%rdi
mov    %r11,%rax
mul    %r15
mov    %rdx,%r10
mov    %rax,%r14
mov    %r9,%rax
mul    %r15
mov    %rdx,%rsi
mov    %rax,%rbx
add    %r10,%rbx
adc    $0x0,%rsi
mov    %r11,%rax
mul    %rcx
mov    %rdx,%r10
mov    %rax,%r15
add    %rbx,%r15
adc    %rsi,%r10
setb   %bl
mov    %r9,%rax
mul    %rcx
movzbl %bl,%ecx
add    %r10,%rax
adc    %rcx,%rdx
add    %r8,%rax
adc    %rdi,%rdx
mov    %r15,%rcx
sar    $0x3f,%rcx
xor    %rcx,%rdx
xor    %rax,%rcx
or     %rdx,%rcx
je     11c5 <t120_1mul+0xb5>
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 } @t120_1mul(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = alloca i128
%9 = alloca i128
%10 = alloca i128
%11 = bitcast i128* %6 to { i64, i64 }*
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 0
store i64 %0, i64* %12
%13 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 1
store i64 %1, i64* %13
%14 = load i128, i128* %6
%15 = bitcast i128* %7 to { i64, i64 }*
%16 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %15, i32 0, i32 0
store i64 %2, i64* %16
%17 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %15, i32 0, i32 1
store i64 %3, i64* %17
%18 = load i128, i128* %7
store i128 %14, i128* %8
store i128 %18, i128* %9
%19 = load i128, i128* %8
%20 = load i128, i128* %9
%21 = call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %19, i128 %20)
%22 = extractvalue { i128, i1 } %21, 1
%23 = extractvalue { i128, i1 } %21, 0
store i128 %23, i128* %10
br i1 %22, label %24, label %26
24: ; preds = %4
%25 = call i32 (...) @bar()
br label %26
26: ; preds = %24, %4
%27 = load i128, i128* %10
store i128 %27, i128* %5
%28 = bitcast i128* %5 to { i64, i64 }*
%29 = load { i64, i64 }, { i64, i64 }* %28
ret { i64, i64 } %29
}

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