#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 */
int __ccaprice_printf_extract(uint64_t *x, uint32_t radix) {
  uint32_t hi = *x >> 32;
  uint32_t lo = *x;
  uint32_t mod = hi % radix;
  hi /= radix;
  uint32_t n = (mod << 16) | (lo >> 16);
  mod = n % radix;
  n /= radix;
  lo = (mod << 16) | (lo & 0xffff);
  mod = lo % radix;
  lo /= radix;
  lo |= (n << 16);
  *x = ((uint64_t)hi << 32) | lo;
  return mod;
}


x86 assembly (clang, -O0):
<__ccaprice_printf_extract>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
mov    -0x14(%rbp),%ecx
sar    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
mov    -0x14(%rbp),%ecx
and    $0xffff,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x10,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,%ecx
or     -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @__ccaprice_printf_extract(i32* nocapture readnone %0, i32 %1) {
ret i32 poison
}