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

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


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

x86 assembly (clang, -O2):
<cvt_31x5_bin24>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
and    $0xffffff,%edx
mov    %edx,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),%eax
mov    %eax,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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