__attribute__((no, noclone)) unsigned __int128 t101_4mul(signed __int128 x) {
  unsigned __int128 y = (1);
  unsigned __int128 r;
  if (__builtin_mul_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t101_4mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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)
movq   $0x0,-0x38(%rbp)
movq   $0x1,-0x40(%rbp)
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%rsi
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%rdx
mov    %rdx,-0x70(%rbp)
mov    %rsi,%rdi
sar    $0x3f,%rdi
add    %rdi,%r8
mov    %rsi,%rax
adc    %rdi,%rax
xor    %rdi,%r8
mov    %r8,-0x68(%rbp)
xor    %rdi,%rax
test   %rax,%rax
setne  %r8b
test   %rdx,%rdx
setne  %dl
and    %dl,%r8b
mul    %rcx
mov    -0x68(%rbp),%rdx
mov    %rax,%rdi
mov    -0x70(%rbp),%rax
seto   %r9b
or     %r9b,%r8b
mul    %rdx
mov    %rax,%rdx
mov    -0x68(%rbp),%rax
seto   %r9b
or     %r9b,%r8b
mov    %r8b,-0x59(%rbp)
add    %rdx,%rdi
mul    %rcx
mov    %rax,%rcx
mov    -0x59(%rbp),%al
mov    %rcx,-0x58(%rbp)
mov    %rdx,%rcx
mov    -0x58(%rbp),%rdx
add    %rdi,%rcx
setb   %dil
or     %dil,%al
mov    %rdx,%rdi
or     %rcx,%rdi
setne  %dil
xor    %r9d,%r9d
mov    %rdx,%r8
neg    %r8
sbb    %rcx,%r9
test   %rsi,%rsi
sets   %sil
cmovs  %r9,%rcx
cmovs  %r8,%rdx
and    %dil,%sil
or     %sil,%al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    1209 <t101_4mul+0xf9>
jmp    1210 <t101_4mul+0x100>
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    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t101_4mul>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
jns    1126 <t101_4mul+0x16>
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 } @t101_4mul(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 1, i128* %6
%12 = load i128, i128* %5
%13 = load i128, i128* %6
%14 = icmp slt i128 %12, 0
%15 = sub i128 0, %12
%16 = select i1 %14, i128 %15, i128 %12
%17 = call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %16, i128 %13)
%18 = extractvalue { i128, i1 } %17, 1
%19 = extractvalue { i128, i1 } %17, 0
%20 = icmp ne i128 %19, 0
%21 = and i1 %14, %20
%22 = or i1 %18, %21
%23 = sub i128 0, %19
%24 = select i1 %14, i128 %23, i128 %19
store i128 %24, i128* %7
br i1 %22, label %25, label %27
25: ; preds = %2
%26 = call i32 (...) @bar()
br label %27
27: ; preds = %25, %2
%28 = load i128, i128* %7
store i128 %28, i128* %3
%29 = bitcast i128* %3 to { i64, i64 }*
%30 = load { i64, i64 }, { i64, i64 }* %29
ret { i64, i64 } %30
}

LLVM IR (-O2):
define { i64, i64 } @t101_4mul(i64 %0, i64 %1) {
%3 = icmp sgt i64 %1, -1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @bar()
br label %6
6: ; preds = %4, %2
%7 = insertvalue { i64, i64 } poison, i64 %0, 0
%8 = insertvalue { i64, i64 } %7, i64 %1, 1
ret { i64, i64 } %8
}