char *unpack4(int jb) {
  int i, ih1, ih2, ih3, ioff = 48;
  static char bc[7];
  ih1 = jb;
  ih2 = ih1;
  for (i = 0; i < 6; i++) {
    ih1 /= 16;
    ih3 = ih1 * 16;
    bc[5 - i] = ih2 - ih3 + ioff;
    ih2 /= 16;
  }
  bc[6] = '\0';
  return bc;
}


x86 assembly (clang, -O0):
<unpack4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x30,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    117e <unpack4+0x7e>
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %al,%dl
mov    $0x5,%eax
sub    -0x8(%rbp),%eax
movslq %eax,%rcx
lea    0x2ec2(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <unpack4+0x21>
movb   $0x0,0x2ea2(%rip)
lea    0x2e95(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack4>:
lea    0xffffff(%rdi),%r8d
test   %edi,%edi
cmovns %edi,%r8d
lea    0xfffff(%rdi),%r9d
test   %edi,%edi
cmovns %edi,%r9d
lea    0xffff(%rdi),%r10d
test   %edi,%edi
cmovns %edi,%r10d
lea    0xfff(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
lea    0xff(%rdi),%edx
test   %edi,%edi
cmovns %edi,%edx
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%esi
sar    $0x4,%esi
and    $0xfffffff0,%eax
sub    %eax,%edi
add    $0x30,%dil
mov    %dil,0x2ecc(%rip)
lea    0x2ec0(%rip),%rax
sar    $0x8,%edx
mov    %edx,%edi
shl    $0x4,%edi
sub    %edi,%esi
add    $0x30,%sil
mov    %sil,0x2eaf(%rip)
sar    $0xc,%ecx
mov    %ecx,%esi
shl    $0x4,%esi
sub    %esi,%edx
add    $0x30,%dl
mov    %dl,0x2e9b(%rip)
sar    $0x10,%r10d
mov    %r10d,%edx
shl    $0x4,%edx
sub    %edx,%ecx
add    $0x30,%cl
mov    %cl,0x2e85(%rip)
sar    $0x14,%r9d
mov    %r9d,%ecx
shl    $0x4,%ecx
sub    %ecx,%r10d
add    $0x30,%r10b
mov    %r10b,0x2e6c(%rip)
shr    $0x14,%r8d
and    $0xf0,%r8d
sub    %r8d,%r9d
add    $0x30,%r9b
mov    %r9b,0x2e52(%rip)
movb   $0x0,0x2e51(%rip)
ret

LLVM IR (-O0):
@unpack4.bc = internal global [7 x i8] zeroinitializer
define i8* @unpack4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i32 48, i32* %7
%8 = load i32, i32* %2
store i32 %8, i32* %4
%9 = load i32, i32* %4
store i32 %9, i32* %5
store i32 0, i32* %3
br label %10
10: ; preds = %30, %1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 16
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, 16
store i32 %17, i32* %6
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
%21 = load i32, i32* %7
%22 = add nsw i32 %20, %21
%23 = trunc i32 %22 to i8
%24 = load i32, i32* %3
%25 = sub nsw i32 5, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 %26
store i8 %23, i8* %27
%28 = load i32, i32* %5
%29 = sdiv i32 %28, 16
store i32 %29, i32* %5
br label %30
30: ; preds = %13
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %10
33: ; preds = %10
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 6)
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 0)
}

LLVM IR (-O2):
@unpack4.bc = internal global [7 x i8] zeroinitializer
define i8* @unpack4(i32 %0) {
%2 = sdiv i32 %0, 16
%3 = mul i32 %2, -16
%4 = add i32 %3, %0
%5 = trunc i32 %4 to i8
%6 = add i8 %5, 48
store i8 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 5)
%7 = sdiv i32 %0, 256
%8 = mul nsw i32 %7, -16
%9 = add nsw i32 %8, %2
%10 = trunc i32 %9 to i8
%11 = add i8 %10, 48
store i8 %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 4)
%12 = sdiv i32 %0, 4096
%13 = mul nsw i32 %12, -16
%14 = add nsw i32 %13, %7
%15 = trunc i32 %14 to i8
%16 = add i8 %15, 48
store i8 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 3)
%17 = sdiv i32 %0, 65536
%18 = mul nsw i32 %17, -16
%19 = add nsw i32 %18, %12
%20 = trunc i32 %19 to i8
%21 = add i8 %20, 48
store i8 %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 2)
%22 = sdiv i32 %0, 1048576
%23 = mul nsw i32 %22, -16
%24 = add nsw i32 %23, %17
%25 = trunc i32 %24 to i8
%26 = add i8 %25, 48
store i8 %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 1)
%27 = sdiv i32 %0, -16777216
%28 = shl nsw i32 %27, 4
%29 = add i32 %28, %22
%30 = trunc i32 %29 to i8
%31 = add i8 %30, 48
store i8 %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 6)
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @unpack4.bc, i64 0, i64 0)
}