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


x86 assembly (clang, -O0):
<t118_3mul>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %rdi,-0x50(%rbp)
mov    %rsi,-0x48(%rbp)
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x58(%rbp),%rcx
mov    %rcx,-0xb8(%rbp)
sar    $0x3f,%rcx
mov    %rcx,-0x90(%rbp)
mov    $0xffffffffffffffff,%rcx
mov    %rcx,-0xc8(%rbp)
mul    %rcx
mov    %rax,%r14
mov    -0xb8(%rbp),%rax
mov    %rdx,-0x108(%rbp)
mul    %rcx
mov    %rax,%r11
mov    -0x90(%rbp),%rax
mov    %rdx,%rdi
mov    -0x108(%rbp),%rdx
mov    %r11,%r8
add    %rdx,%r8
mov    %rdi,%rsi
adc    $0x0,%rsi
mov    %r14,%rbx
add    %r8,%rbx
adc    %rdx,%rsi
setb   %dl
movzbl %dl,%edx
add    %rsi,%r11
adc    %rdx,%rdi
movabs $0xfc00000000000000,%rdx
mov    %rdx,-0x118(%rbp)
mul    %rdx
mov    %rax,%r13
mov    -0xc0(%rbp),%rax
mov    %rdx,%r15
mov    -0x118(%rbp),%rdx
mov    %r13,%r12
add    %r15,%r12
adc    $0x0,%r15
mul    %rdx
mov    %rax,%rsi
mov    -0xb8(%rbp),%rax
mov    %rsi,-0xb0(%rbp)
mov    %rdx,%rsi
mov    -0x118(%rbp),%rdx
mov    %rsi,-0x110(%rbp)
mul    %rdx
mov    %rax,%rsi
mov    -0x110(%rbp),%rax
add    %rax,%rsi
mov    %r13,%rax
adc    %rdx,%rax
mov    %r12,%r10
adc    $0x0,%r10
mov    %r15,%rdx
adc    $0x0,%rdx
mov    %r14,%r8
add    %rsi,%r8
mov    %rbx,%r9
adc    %rax,%r9
mov    %r11,%rax
adc    $0x0,%rax
mov    %rdi,%rsi
adc    $0x0,%rsi
add    %rax,%r10
mov    -0x90(%rbp),%rax
mov    %r10,-0xe8(%rbp)
adc    %rsi,%rdx
mov    %rdx,-0xf8(%rbp)
setb   %dl
movzbl %dl,%edx
mov    %rdx,-0xd8(%rbp)
mul    %rcx
mov    %rax,%rsi
mov    %rdx,%r10
mov    -0x108(%rbp),%rdx
mov    %rsi,%rcx
add    %r10,%rcx
mov    %r10,%rax
adc    $0x0,%rax
mov    %rax,-0x100(%rbp)
mov    %rsi,%rax
add    %rcx,%rax
mov    -0x100(%rbp),%rcx
mov    %rax,-0xe0(%rbp)
adc    %r10,%rcx
setb   %al
movzbl %al,%eax
mov    %rax,-0xf0(%rbp)
mov    %rsi,%rax
add    %rcx,%rax
mov    -0xf8(%rbp),%rcx
mov    %rax,-0xd0(%rbp)
mov    -0xf0(%rbp),%rax
adc    %rax,%r10
mov    -0xe8(%rbp),%rax
add    %rax,%rsi
mov    -0xe0(%rbp),%rax
adc    %rcx,%rax
mov    -0xd8(%rbp),%rcx
mov    %rax,-0x80(%rbp)
mov    -0xd0(%rbp),%rax
adc    %rcx,%rax
mov    -0xc8(%rbp),%rcx
mov    %rax,-0x78(%rbp)
mov    -0xc0(%rbp),%rax
adc    $0x0,%r10
sub    %rax,%rdx
mov    -0xb8(%rbp),%rax
sub    %rax,%rdx
mov    -0x90(%rbp),%rax
mov    %rdx,-0xa8(%rbp)
imul   %rcx
mov    %rax,%rcx
mov    %rcx,-0x88(%rbp)
mov    %r14,%rax
add    %rcx,%rax
mov    -0xb0(%rbp),%rcx
mov    %rax,-0xa0(%rbp)
mov    -0xa8(%rbp),%rax
adc    %rdx,%rax
mov    %rax,-0x98(%rbp)
mov    -0xa0(%rbp),%rax
add    %rax,%r11
mov    -0x98(%rbp),%rax
adc    %rax,%rdi
mov    -0x90(%rbp),%rax
shl    $0x3a,%rax
sub    %rax,%rdx
mov    -0x88(%rbp),%rax
add    %rax,%r12
mov    -0x80(%rbp),%rax
adc    %rdx,%r15
mov    -0x78(%rbp),%rdx
add    %r13,%rbx
adc    %r12,%r11
adc    %r15,%rdi
add    %r14,%rsi
adc    %rbx,%rax
adc    %r11,%rdx
adc    %rdi,%r10
mov    %r9,%rdi
sar    $0x3f,%rdi
xor    %rdi,%r10
xor    %rdi,%rax
or     %r10,%rax
xor    %rdi,%rdx
xor    %rdi,%rsi
or     %rdx,%rsi
or     %rax,%rsi
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%edx
mov    %rdx,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
or     %rdx,%rax
setne  %al
mov    %rcx,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
test   $0x1,%al
jne    140b <t118_3mul+0x2fb>
jmp    1412 <t118_3mul+0x302>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x70(%rbp),%rax
mov    -0x68(%rbp),%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rdx
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<t118_3mul>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%r8
mov    %rsi,%r14
mov    $0xffffffffffffffff,%rbp
mov    %rdi,%rax
mov    %rdi,0x18(%rsp)
mul    %rbp
mov    %rdx,%rdi
mov    %rax,%rcx
mov    %rsi,%rax
mul    %rbp
sar    $0x3f,%r14
mov    %rax,%rbx
add    %rdi,%rbx
mov    %rdx,%r13
adc    $0x0,%r13
add    %rcx,%rbx
mov    %rcx,%r11
mov    %rcx,0x8(%rsp)
adc    %rdi,%r13
setb   %cl
movzbl %cl,%r9d
add    %rax,%r13
adc    %rdx,%r9
mov    %r9,0x10(%rsp)
movabs $0xfc00000000000000,%r10
mov    %r14,%rax
mul    %r10
mov    %rdx,%r12
mov    %rax,%rbp
mov    %rax,%rcx
mov    %rax,0x20(%rsp)
add    %rdx,%rbp
adc    $0x0,%r12
mov    %r8,%rax
mul    %r10
mov    %rdx,%r8
mov    %rax,0x30(%rsp)
mov    %rsi,%rax
mov    %rsi,%r15
mul    %r10
mov    %rdx,%r10
add    %r8,%rax
adc    $0x0,%r10
add    %rcx,%r10
mov    %rbp,%rdx
adc    $0x0,%rdx
mov    %r12,%rcx
adc    $0x0,%rcx
add    %r11,%rax
mov    %rax,0x28(%rsp)
adc    %rbx,%r10
mov    %r13,%r8
adc    $0x0,%r8
mov    %r9,%r11
adc    $0x0,%r11
add    %rdx,%r8
adc    %rcx,%r11
setb   0x7(%rsp)
mov    %r14,%rax
mov    $0xffffffffffffffff,%rcx
mul    %rcx
mov    %rax,%rsi
add    %rdx,%rsi
mov    %rdx,%rcx
adc    $0x0,%rcx
add    %rax,%rsi
adc    %rdx,%rcx
setb   %r9b
add    %rax,%rcx
movzbl %r9b,%r9d
adc    %rdx,%r9
add    %rax,%r8
adc    %r11,%rsi
movzbl 0x7(%rsp),%eax
adc    %rax,%rcx
adc    $0x0,%r9
sub    0x18(%rsp),%rdi
mov    %r14,%rax
mov    $0xffffffffffffffff,%rdx
imul   %rdx
sub    %r15,%rdi
mov    0x8(%rsp),%r15
mov    %r15,%r11
add    %rax,%r11
adc    %rdx,%rdi
add    %r13,%r11
adc    0x10(%rsp),%rdi
shl    $0x3a,%r14
sub    %r14,%rdx
add    %rax,%rbp
adc    %r12,%rdx
add    0x20(%rsp),%rbx
adc    %r11,%rbp
adc    %rdi,%rdx
add    %r15,%r8
adc    %rsi,%rbx
adc    %rcx,%rbp
adc    %r9,%rdx
mov    %r10,%rcx
sar    $0x3f,%rcx
xor    %rcx,%rdx
xor    %rcx,%rbx
or     %rdx,%rbx
xor    %rcx,%rbp
xor    %r8,%rcx
or     %rbp,%rcx
or     %rbx,%rcx
mov    0x30(%rsp),%rbx
mov    0x28(%rsp),%rsi
mov    %esi,%eax
and    $0x1,%eax
mov    %rax,%rdx
neg    %rdx
xor    %rdx,%r10
xor    %rsi,%rdx
or     %r10,%rdx
or     %rcx,%rdx
jne    12c7 <t118_3mul+0x1b7>
mov    %rbx,%rcx
xor    %rbx,%rcx
or     %rcx,%rax
je     12ce <t118_3mul+0x1be>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
mov    %rbx,%rdx
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define { i64, i64 } @t118_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 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.smul.with.overflow.i129(i129 -5316911983139663491615228241121378304, i129 %12)
%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 } @t118_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 = sext i128 %6 to i129
%8 = tail call { i129, i1 } @llvm.smul.with.overflow.i129(i129 %7, i129 -5316911983139663491615228241121378304)
%9 = extractvalue { i129, i1 } %8, 1
%10 = extractvalue { i129, i1 } %8, 0
%11 = and i129 %10, 334965454937798799971759379190646833152
%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 = lshr exact i129 %10, 64
%18 = trunc i129 %17 to i64
%19 = insertvalue { i64, i64 } { i64 0, i64 poison }, i64 %18, 1
ret { i64, i64 } %19
}