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


x86 assembly (clang, -O0):
<t115_3mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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),%rax
mov    -0x28(%rbp),%rsi
mov    %rsi,%rdi
sar    $0x3f,%rdi
add    %rdi,%rax
mov    %rsi,%rcx
adc    %rdi,%rcx
mov    %rcx,-0x48(%rbp)
xor    %rdi,%rax
movabs $0x8000000000000000,%rcx
mul    %rcx
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
seto   %dl
xor    %rdi,%rax
setne  %al
or     %dl,%al
mov    %rsi,%rdi
shr    $0x3f,%rdi
xor    %edx,%edx
add    $0xffffffffffffffff,%rdi
movabs $0x7fffffffffffffff,%rdi
ff ff 7f
adc    %rdi,%rdx
sub    %rcx,%rdx
setb   %dl
or     %dl,%al
mov    %rcx,%rdx
neg    %rdx
test   %rsi,%rsi
cmovs  %rdx,%rcx
mov    %rcx,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
test   $0x1,%al
jne    11b6 <t115_3mul+0xa6>
jmp    11bd <t115_3mul+0xad>
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    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t115_3mul>:
push   %rbx
mov    %rdi,%rax
mov    %rsi,%rcx
sar    $0x3f,%rcx
add    %rcx,%rax
mov    %rsi,%rdi
adc    %rcx,%rdi
xor    %rcx,%rax
movabs $0x8000000000000000,%rdx
mul    %rdx
mov    %rax,%rbx
seto   %al
xor    %rcx,%rdi
setne  %cl
or     %al,%cl
xor    %edx,%edx
shr    $0x3f,%rsi
add    $0xffffffffffffffff,%rsi
movabs $0x7fffffffffffffff,%rax
ff ff 7f
adc    %rdx,%rax
test   %cl,%cl
jne    1162 <t115_3mul+0x52>
cmp    %rbx,%rax
jae    1169 <t115_3mul+0x59>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
mov    %rbx,%rdx
pop    %rbx
ret

LLVM IR (-O0):
define { i64, i64 } @t115_3mul(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 = icmp slt i128 %11, 0
%13 = sub i128 0, %11
%14 = select i1 %12, i128 %13, i128 %11
%15 = call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %14, i128 -170141183460469231731687303715884105728)
%16 = extractvalue { i128, i1 } %15, 1
%17 = extractvalue { i128, i1 } %15, 0
%18 = zext i1 %12 to i128
%19 = add i128 170141183460469231731687303715884105727, %18
%20 = icmp ugt i128 %17, %19
%21 = or i1 %16, %20
%22 = sub i128 0, %17
%23 = select i1 %12, i128 %22, i128 %17
store i128 %23, i128* %6
br i1 %21, label %24, label %26
24: ; preds = %2
%25 = call i32 (...) @bar()
br label %26
26: ; preds = %24, %2
%27 = load i128, i128* %6
store i128 %27, i128* %3
%28 = bitcast i128* %3 to { i64, i64 }*
%29 = load { i64, i64 }, { i64, i64 }* %28
ret { i64, i64 } %29
}

LLVM IR (-O2):
define { i64, i64 } @t115_3mul(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 @llvm.abs.i128(i128 %6, i1 false)
%8 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %7, i128 -170141183460469231731687303715884105728)
%9 = extractvalue { i128, i1 } %8, 1
%10 = extractvalue { i128, i1 } %8, 0
%11 = lshr i128 %3, 63
%12 = add nuw i128 %11, 170141183460469231731687303715884105727
%13 = icmp ugt i128 %10, %12
%14 = or i1 %9, %13
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 (...) @bar()
br label %17
17: ; preds = %15, %2
%18 = lshr exact i128 %10, 64
%19 = trunc i128 %18 to i64
%20 = insertvalue { i64, i64 } { i64 0, i64 poison }, i64 %19, 1
ret { i64, i64 } %20
}