char *ptr_to_ascii(void *ptr) {
  static char addr[((int)(3 + sizeof(void *) * 2))];
  int nchars;
  nchars = snprintf(addr, ((int)(3 + sizeof(void *) * 2)), "%p", ptr);
  if (nchars == -1 || nchars >= ((int)(3 + sizeof(void *) * 2)))
    __fail("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/"
           "banshee/engine/utils.c",
           243, __FUNCTION__,
           "Unable to convert ptr to ascii (need %d bytes, have %d)\n", nchars,
           ((int)(3 + sizeof(void *) * 2)));
  return addr;
}


x86 assembly (clang, -O0):
<ptr_to_ascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0x2f09(%rip),%rdi
mov    $0x13,%esi
lea    0xebd(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1161 <ptr_to_ascii+0x41>
cmpl   $0x13,-0xc(%rbp)
jl     118c <ptr_to_ascii+0x6c>
mov    -0xc(%rbp),%r8d
lea    0xe97(%rip),%rdi
mov    $0xf3,%esi
lea    0xf1f(%rip),%rdx
lea    0xf25(%rip),%rcx
mov    $0x13,%r9d
mov    $0x0,%al
call   1040 <__fail@plt>
lea    0x2ead(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr_to_ascii>:
push   %rax
mov    %rdi,%rcx
lea    0x2f15(%rip),%rdi
lea    0xece(%rip),%rdx
mov    $0x13,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
cmp    $0xffffffff,%eax
je     1148 <ptr_to_ascii+0x28>
cmp    $0x13,%eax
jl     1172 <ptr_to_ascii+0x52>
lea    0xeb4(%rip),%rdi
lea    0xf41(%rip),%rdx
lea    0xf47(%rip),%rcx
mov    $0xf3,%esi
mov    %eax,%r8d
mov    $0x13,%r9d
xor    %eax,%eax
call   1040 <__fail@plt>
lea    0x2ec7(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@ptr_to_ascii.addr = internal global [19 x i8] zeroinitializer
@.str = [3 x i8] c"%p\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/banshee/engine/utils.c\00"
@__FUNCTION__.ptr_to_ascii = [13 x i8] c"ptr_to_ascii\00"
@.str.2 = [57 x i8] c"Unable to convert ptr to ascii (need %d bytes, have %d)\0A\00"
define i8* @ptr_to_ascii(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @ptr_to_ascii.addr, i64 0, i64 0), i64 19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 19
br i1 %10, label %11, label %14
11: ; preds = %8, %1
%12 = load i32, i32* %3
%13 = call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @__fail to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 243, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.ptr_to_ascii, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 19)
br label %14
14: ; preds = %11, %8
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @ptr_to_ascii.addr, i64 0, i64 0)
}

LLVM IR (-O2):
@ptr_to_ascii.addr = internal global [19 x i8] zeroinitializer
@.str = [3 x i8] c"%p\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/banshee/engine/utils.c\00"
@__FUNCTION__.ptr_to_ascii = [13 x i8] c"ptr_to_ascii\00"
@.str.2 = [57 x i8] c"Unable to convert ptr to ascii (need %d bytes, have %d)\0A\00"
define i8* @ptr_to_ascii(i8* %0) {
%2 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @ptr_to_ascii.addr, i64 0, i64 0), i64 19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i32 %2, -1
%4 = icmp sgt i32 %2, 18
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @__fail to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 243, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.ptr_to_ascii, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %2, i32 19)
br label %8
8: ; preds = %1, %6
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @ptr_to_ascii.addr, i64 0, i64 0)
}