#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*/ sscanf(char *, char *, unsigned int *);
long double cov_deserialize(char *buf, int length) {
  int i;
  unsigned int u;
  union {
    unsigned char bytes[10];
    long double val;
  } bfconvert;
  for (i = 0; i < length; i++) {
    sscanf(buf, "%02X", &u);
    bfconvert.bytes[i] = u;
    buf += 2;
  }
  return bfconvert.val;
}


x86 assembly (clang, -O0):
<cov_deserialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116d <cov_deserialize+0x5d>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x14(%rbp),%eax
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <cov_deserialize+0x16>
fldt   -0x30(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cov_deserialize>:
fldz
test   %esi,%esi
jle    1175 <cov_deserialize+0x65>
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r13
fstp   %st(0)
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xecc(%rip),%r14
lea    0xc(%rsp),%r15
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <sscanf@plt>
movzbl 0xc(%rsp),%eax
mov    %al,0x10(%rsp,%rbx,1)
add    $0x2,%r13
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <cov_deserialize+0x30>
fldt   0x10(%rsp)
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%union.anon = type { x86_fp80 }
@.str = [5 x i8] c"%02X\00"
define x86_fp80 @cov_deserialize(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %union.anon
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
%16 = trunc i32 %15 to i8
%17 = bitcast %union.anon* %7 to [10 x i8]*
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 %19
store i8 %16, i8* %20
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8* %22, i8** %3
br label %23
23: ; preds = %12
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %8
26: ; preds = %8
%27 = bitcast %union.anon* %7 to x86_fp80*
%28 = load x86_fp80, x86_fp80* %27
ret x86_fp80 %28
}

LLVM IR (-O2):
%union.anon = type { x86_fp80 }
@.str = [5 x i8] c"%02X\00"
define x86_fp80 @cov_deserialize(i8* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = alloca %union.anon
%5 = bitcast i32* %3 to i8*
%6 = bitcast %union.anon* %4 to i8*
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = bitcast %union.anon* %4 to [10 x i8]*
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %19, %11 ]
%13 = phi i8* [ %0, %8 ], [ %18, %11 ]
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 %12
store i8 %16, i8* %17
%18 = getelementptr inbounds i8, i8* %13, i64 2
%19 = add nuw nsw i64 %12, 1
%20 = icmp eq i64 %19, %10
br i1 %20, label %21, label %11
21: ; preds = %11
%22 = getelementptr inbounds %union.anon, %union.anon* %4, i64 0, i32 0
%23 = load x86_fp80, x86_fp80* %22
br label %24
24: ; preds = %21, %2
%25 = phi x86_fp80 [ %23, %21 ], [ undef, %2 ]
ret x86_fp80 %25
}