#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*/ fprintf(int /*<<< orphan*/, char *, void *, double);
scalar_t__ memory_free(void *, char *, int);
int /*<<< orphan*/ stdout;
void array_element_destroy(void *x, void *arg) {
  { arg = arg; }
  if (NULL != x)
    fprintf(stdout, "\tdestroyed element -> {object=>0x%p,value=>%.3f}\n", x,
            *(double *)x);
  ((void)(memory_free((void *)(x),
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/"
                      "heads/master/test/test_array.c",
                      71),
          (x) = 0));
}


x86 assembly (clang, -O0):
<array_element_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     1165 <array_element_destroy+0x45>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x47,%edx
call   1030 <memory_free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_element_destroy>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1145 <array_element_destroy+0x25>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
movsd  (%rbx),%xmm0
lea    0xec3(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
lea    0xee6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x47,%edx
pop    %rbx
jmp    1030 <memory_free@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [50 x i8] c"\09destroyed element -> {object=>0x%p,value=>%.3f}\0A\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/heads/master/test/test_array.c\00"
define void @array_element_destroy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8* %5, i8** %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* null, %6
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = load i8*, i8** %3
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %10, double %13)
br label %15
15: ; preds = %8, %2
%16 = load i8*, i8** %3
%17 = call i64 @memory_free(i8* %16, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i32 71)
store i8* null, i8** %3
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [50 x i8] c"\09destroyed element -> {object=>0x%p,value=>%.3f}\0A\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ASMlover/libc/refs/heads/master/test/test_array.c\00"
define void @array_element_destroy(i8* %0, i8* nocapture readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = bitcast i8* %0 to double*
%7 = load double, double* %6
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %0, double %7)
br label %9
9: ; preds = %4, %2
%10 = tail call i64 @memory_free(i8* %0, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i32 71)
ret void
}