#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ cov_serialize(long double, unsigned char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
unsigned char *malloc(int);
scalar_t__ strlen(char *);
void cov_arr_log(long double lds[], int size, char *msg, char *fn) {
  int ld_size, i, j;
  unsigned char *buf;
  FILE *file;
  file = fopen(fn, "a");
  ld_size = 10;
  buf = malloc(ld_size);
  if (strlen(msg) > 0)
    fprintf(file, "#%s\n", msg);
  for (i = 0; i < size; i++) {
    long double ld = lds[i];
    cov_serialize(ld, buf, ld_size);
    if (i > 0)
      fprintf(file, " ");
    for (j = 0; j < ld_size; j++) {
      fprintf(file, "%02X", buf[j]);
    }
  }
  fprintf(file, "\n");
  fclose(file);
}


x86 assembly (clang, -O0):
<cov_arr_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x40(%rbp)
movl   $0xa,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jle    11c7 <cov_arr_log+0x67>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    126e <cov_arr_log+0x10e>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %rsp,%rax
fstpt  (%rax)
call   1080 <cov_serialize@plt>
cmpl   $0x0,-0x28(%rbp)
jle    121c <cov_arr_log+0xbc>
mov    -0x40(%rbp),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    125b <cov_arr_log+0xfb>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1223 <cov_arr_log+0xc3>
jmp    1260 <cov_arr_log+0x100>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ce <cov_arr_log+0x6e>
mov    -0x40(%rbp),%rdi
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cov_arr_log>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbp
mov    %esi,%r12d
mov    %rdi,%r14
lea    0xe74(%rip),%rsi
mov    %rcx,%rdi
call   1080 <fopen@plt>
mov    %rax,%r15
mov    $0xa,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    11c5 <cov_arr_log+0x55>
lea    0xe4a(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r12d,%r12d
jle    1387 <cov_arr_log+0x217>
fldt   (%r14)
fstpt  (%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1090 <cov_serialize@plt>
movzbl (%rbx),%edx
lea    0xe1c(%rip),%rbp
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x1(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x2(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x3(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x4(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x5(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x6(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x7(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x8(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x9(%rbx),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x1,%r12d
je     1387 <cov_arr_log+0x217>
mov    %r12d,%ebp
add    $0x10,%r14
add    $0xffffffffffffffff,%rbp
lea    0xd5a(%rip),%r12
nopl   (%rax)
fldt   (%r14)
fstpt  (%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1090 <cov_serialize@plt>
mov    $0x20,%edi
mov    %r15,%rsi
call   1050 <fputc@plt>
movzbl (%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x1(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x2(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x3(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x4(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x5(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x6(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x7(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x8(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movzbl 0x9(%rbx),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x10,%r14
add    $0xffffffffffffffff,%rbp
jne    12b0 <cov_arr_log+0x140>
mov    $0xa,%edi
mov    %r15,%rsi
call   1050 <fputc@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [5 x i8] c"#%s\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [5 x i8] c"%02X\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @cov_arr_log(x86_fp80* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca x86_fp80*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca x86_fp80
store x86_fp80* %0, x86_fp80** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%15 = load i8*, i8** %8
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %13
store i32 10, i32* %9
%17 = load i32, i32* %9
%18 = call i8* @malloc(i32 %17)
store i8* %18, i8** %12
%19 = load i8*, i8** %7
%20 = call i64 @strlen(i8* %19)
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %4
%23 = load i32*, i32** %13
%24 = load i8*, i8** %7
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %22, %4
store i32 0, i32* %10
br label %27
27: ; preds = %64, %26
%28 = load i32, i32* %10
%29 = load i32, i32* %6
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %67
31: ; preds = %27
%32 = load x86_fp80*, x86_fp80** %5
%33 = load i32, i32* %10
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds x86_fp80, x86_fp80* %32, i64 %34
%36 = load x86_fp80, x86_fp80* %35
store x86_fp80 %36, x86_fp80* %14
%37 = load x86_fp80, x86_fp80* %14
%38 = load i8*, i8** %12
%39 = load i32, i32* %9
%40 = call i32 @cov_serialize(x86_fp80 %37, i8* %38, i32 %39)
%41 = load i32, i32* %10
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %31
%44 = load i32*, i32** %13
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %43, %31
store i32 0, i32* %11
br label %47
47: ; preds = %60, %46
%48 = load i32, i32* %11
%49 = load i32, i32* %9
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %63
51: ; preds = %47
%52 = load i32*, i32** %13
%53 = load i8*, i8** %12
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %51
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %47
63: ; preds = %47
br label %64
64: ; preds = %63
%65 = load i32, i32* %10
%66 = add nsw i32 %65, 1
store i32 %66, i32* %10
br label %27
67: ; preds = %27
%68 = load i32*, i32** %13
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%70 = load i32*, i32** %13
%71 = call i32 @fclose(i32* %70)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [5 x i8] c"#%s\0A\00"
@.str.3 = [5 x i8] c"%02X\00"
define void @cov_arr_log(x86_fp80* nocapture %0, i32 %1, i8* %2, i8* nocapture %3) {
%5 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %9, %4
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %95
13: ; preds = %11
%14 = zext i32 %1 to i64
%15 = load x86_fp80, x86_fp80* %0
%16 = tail call i32 @cov_serialize(x86_fp80 %15, i8* %6, i32 10)
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds i8, i8* %6, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds i8, i8* %6, i64 2
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds i8, i8* %6, i64 3
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds i8, i8* %6, i64 4
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds i8, i8* %6, i64 5
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds i8, i8* %6, i64 6
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds i8, i8* %6, i64 7
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds i8, i8* %6, i64 8
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds i8, i8* %6, i64 9
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %54)
%56 = icmp eq i32 %1, 1
br i1 %56, label %95, label %57
57: ; preds = %13, %57
%58 = phi i64 [ %93, %57 ], [ 1, %13 ]
%59 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 %58
%60 = load x86_fp80, x86_fp80* %59
%61 = tail call i32 @cov_serialize(x86_fp80 %60, i8* %6, i32 10)
%62 = tail call i32 @fputc(i32 32, i32* %5)
%63 = load i8, i8* %6
%64 = zext i8 %63 to i32
%65 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = load i8, i8* %20
%67 = zext i8 %66 to i32
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%69 = load i8, i8* %24
%70 = zext i8 %69 to i32
%71 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%72 = load i8, i8* %28
%73 = zext i8 %72 to i32
%74 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = load i8, i8* %32
%76 = zext i8 %75 to i32
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = load i8, i8* %36
%79 = zext i8 %78 to i32
%80 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %79)
%81 = load i8, i8* %40
%82 = zext i8 %81 to i32
%83 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %82)
%84 = load i8, i8* %44
%85 = zext i8 %84 to i32
%86 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %85)
%87 = load i8, i8* %48
%88 = zext i8 %87 to i32
%89 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %88)
%90 = load i8, i8* %52
%91 = zext i8 %90 to i32
%92 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %91)
%93 = add nuw nsw i64 %58, 1
%94 = icmp eq i64 %93, %14
br i1 %94, label %95, label %57
95: ; preds = %57, %13, %11
%96 = tail call i32 @fputc(i32 10, i32* %5)
%97 = tail call i32 @fclose(i32* %5)
ret void
}