#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 */

/* Variables and functions */
int /*<<< orphan*/ AribToString(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, unsigned char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void getStr(char *tostr, unsigned char *byte, int *pbit, int len) {
  char str[4096];
  int pbyte = *pbit / 8;
  unsigned char *fbyte = byte + pbyte;
  memset(str, 0, sizeof(char) * 4096);
  memcpy(str, fbyte, len);
  *pbit += (len * 8);
  AribToString(tostr, str, len);
  return;
}


x86 assembly (clang, -O0):
<getStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1024(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1024(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1040 <memset@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x1030(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x1c(%rbp),%ecx
shl    $0x3,%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <AribToString@plt>
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getStr>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    %rdx,%r14
mov    (%rdx),%eax
lea    0x7(%rax),%edx
test   %eax,%eax
cmovns %eax,%edx
mov    %ecx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r12
sar    $0x3,%edx
movslq %edx,%rax
add    %rax,%rbx
mov    %rsp,%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1040 <memset@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
lea    0x0(,%r15,8),%eax
add    %eax,(%r14)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15d,%edx
call   1030 <AribToString@plt>
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @getStr(i8* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [4096 x i8]
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = sdiv i32 %13, 8
store i32 %14, i32* %10
%15 = load i8*, i8** %6
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8* %18, i8** %11
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%20 = call i32 @memset(i8* %19, i32 0, i32 4096)
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%22 = load i8*, i8** %11
%23 = load i32, i32* %8
%24 = call i32 @memcpy(i8* %21, i8* %22, i32 %23)
%25 = load i32, i32* %8
%26 = mul nsw i32 %25, 8
%27 = load i32*, i32** %7
%28 = load i32, i32* %27
%29 = add nsw i32 %28, %26
store i32 %29, i32* %27
%30 = load i8*, i8** %5
%31 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%32 = load i32, i32* %8
%33 = call i32 @AribToString(i8* %30, i8* %31, i32 %32)
ret void
}

LLVM IR (-O2):
define void @getStr(i8* %0, i8* %1, i32* nocapture %2, i32 %3) {
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 8
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = call i32 @memset(i8* %6, i32 0, i32 4096)
%12 = call i32 @memcpy(i8* %6, i8* %10, i32 %3)
%13 = shl nsw i32 %3, 3
%14 = load i32, i32* %2
%15 = add nsw i32 %14, %13
store i32 %15, i32* %2
%16 = call i32 @AribToString(i8* %0, i8* %6, i32 %3)
ret void
}