#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t _div_mulhi64(const uint64_t a, const uint64_t b) {
  const uint32_t a_lo = (const uint32_t)a;
  const uint32_t a_hi = (const uint32_t)(a >> 32);
  const uint32_t b_lo = (const uint32_t)b;
  const uint32_t b_hi = (const uint32_t)(b >> 32);
  const uint64_t a_x_b_mid = (const uint64_t)a_hi * b_lo;
  const uint64_t b_x_a_mid = (const uint64_t)b_hi * a_lo;
  const uint64_t a_x_b_lo = (const uint64_t)a_lo * b_lo;
  const uint64_t a_x_b_hi = (const uint64_t)a_hi * b_hi;
  const uint32_t carry_bits =
      ((uint64_t)(uint32_t)a_x_b_mid + (uint64_t)(uint32_t)b_x_a_mid +
       (a_x_b_lo >> 32)) >>
      32;
  const uint64_t multhi =
      a_x_b_hi + (a_x_b_mid >> 32) + (b_x_a_mid >> 32) + carry_bits;
  return multhi;
}


x86 assembly (clang, -O0):
<_div_mulhi64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    -0x24(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x1c(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x20(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_div_mulhi64>:
ret

LLVM IR (-O0):
define i32 @_div_mulhi64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%15 = load i32, i32* %3
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = ashr i32 %16, 32
store i32 %17, i32* %6
%18 = load i32, i32* %4
store i32 %18, i32* %7
%19 = load i32, i32* %4
%20 = ashr i32 %19, 32
store i32 %20, i32* %8
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = mul nsw i32 %21, %22
store i32 %23, i32* %9
%24 = load i32, i32* %8
%25 = load i32, i32* %5
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %10
%27 = load i32, i32* %5
%28 = load i32, i32* %7
%29 = mul nsw i32 %27, %28
store i32 %29, i32* %11
%30 = load i32, i32* %6
%31 = load i32, i32* %8
%32 = mul nsw i32 %30, %31
store i32 %32, i32* %12
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = add nsw i32 %33, %34
%36 = load i32, i32* %11
%37 = ashr i32 %36, 32
%38 = add nsw i32 %35, %37
%39 = ashr i32 %38, 32
store i32 %39, i32* %13
%40 = load i32, i32* %12
%41 = load i32, i32* %9
%42 = ashr i32 %41, 32
%43 = add nsw i32 %40, %42
%44 = load i32, i32* %10
%45 = ashr i32 %44, 32
%46 = add nsw i32 %43, %45
%47 = load i32, i32* %13
%48 = add nsw i32 %46, %47
store i32 %48, i32* %14
%49 = load i32, i32* %14
ret i32 %49
}

LLVM IR (-O2):
define i32 @_div_mulhi64(i32 %0, i32 %1) {
ret i32 poison
}