#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*/ bi_bi2str(char *, int, unsigned long *, unsigned int const);
int /*<<< orphan*/ printf(char *, char *, ...);
void bi_print(char *name, int a_len, unsigned long *a_data,
              const unsigned int system) {
  char result[5000];
  printf("%s: len=%d\n", name, a_len);
  bi_bi2str(result, a_len, a_data, system);
  printf("%s\n", result);
}


x86 assembly (clang, -O0):
<bi_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x13b0(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <bi_bi2str@plt>
lea    -0x13b0(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x13b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bi_print>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1388,%rsp
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%rsi
lea    0xec1(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <bi_bi2str@plt>
lea    0xeaa(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1388,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s: len=%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @bi_print(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i32
%9 = alloca [5000 x i8]
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
%13 = getelementptr inbounds [5000 x i8], [5000 x i8]* %9, i64 0, i64 0
%14 = load i32, i32* %6
%15 = load i64*, i64** %7
%16 = load i32, i32* %8
%17 = call i32 @bi_bi2str(i8* %13, i32 %14, i64* %15, i32 %16)
%18 = getelementptr inbounds [5000 x i8], [5000 x i8]* %9, i64 0, i64 0
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s: len=%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @bi_print(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = alloca [5000 x i8]
%6 = getelementptr inbounds [5000 x i8], [5000 x i8]* %5, i64 0, i64 0
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%8 = call i32 @bi_bi2str(i8* %6, i32 %1, i64* %2, i32 %3)
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret void
}