#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ div31(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/);
uint8_t cvt_31x6p5_bin32(uint8_t *gfv, uint32_t bv) {
  uint32_t r;
  div31(&bv, &r, bv);
  gfv[0] = r;
  div31(&bv, &r, bv);
  gfv[1] = r;
  div31(&bv, &r, bv);
  gfv[2] = r;
  div31(&bv, &r, bv);
  gfv[3] = r;
  div31(&bv, &r, bv);
  gfv[4] = r;
  div31(&bv, &r, bv);
  gfv[5] = r;
  return bv;
}


x86 assembly (clang, -O0):
<cvt_31x6p5_bin32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%edx
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <div31@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvt_31x6p5_bin32>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
mov    %esi,0x8(%rsp)
lea    0x8(%rsp),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x4(%rbx)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x8(%rbx)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,0xc(%rbx)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rbx)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <div31@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rbx)
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cvt_31x6p5_bin32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @div31(i32* %4, i32* %5, i32 %6)
%8 = load i32, i32* %5
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 %8, i32* %10
%11 = load i32, i32* %4
%12 = call i32 @div31(i32* %4, i32* %5, i32 %11)
%13 = load i32, i32* %5
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %13, i32* %15
%16 = load i32, i32* %4
%17 = call i32 @div31(i32* %4, i32* %5, i32 %16)
%18 = load i32, i32* %5
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i64 2
store i32 %18, i32* %20
%21 = load i32, i32* %4
%22 = call i32 @div31(i32* %4, i32* %5, i32 %21)
%23 = load i32, i32* %5
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 3
store i32 %23, i32* %25
%26 = load i32, i32* %4
%27 = call i32 @div31(i32* %4, i32* %5, i32 %26)
%28 = load i32, i32* %5
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 4
store i32 %28, i32* %30
%31 = load i32, i32* %4
%32 = call i32 @div31(i32* %4, i32* %5, i32 %31)
%33 = load i32, i32* %5
%34 = load i32*, i32** %3
%35 = getelementptr inbounds i32, i32* %34, i64 5
store i32 %33, i32* %35
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @cvt_31x6p5_bin32(i32* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %1, i32* %3
%5 = bitcast i32* %4 to i8*
%6 = call i32 @div31(i32* %3, i32* %4, i32 %1)
%7 = load i32, i32* %4
store i32 %7, i32* %0
%8 = load i32, i32* %3
%9 = call i32 @div31(i32* %3, i32* %4, i32 %8)
%10 = load i32, i32* %4
%11 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %10, i32* %11
%12 = load i32, i32* %3
%13 = call i32 @div31(i32* %3, i32* %4, i32 %12)
%14 = load i32, i32* %4
%15 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %14, i32* %15
%16 = load i32, i32* %3
%17 = call i32 @div31(i32* %3, i32* %4, i32 %16)
%18 = load i32, i32* %4
%19 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %18, i32* %19
%20 = load i32, i32* %3
%21 = call i32 @div31(i32* %3, i32* %4, i32 %20)
%22 = load i32, i32* %4
%23 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %22, i32* %23
%24 = load i32, i32* %3
%25 = call i32 @div31(i32* %3, i32* %4, i32 %24)
%26 = load i32, i32* %4
%27 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %26, i32* %27
%28 = load i32, i32* %3
ret i32 %28
}