#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*/ printf(char *, ...);
void gen_flo_test(const char *reader, void *ptr, size_t bits, double expected) {
  printf("(check-= (%s (open-input-bytes (bytes", reader);
  for (size_t i = 0; i < (bits / 8); i++) {
    printf(" %d", ((unsigned char *)ptr)[i]);
  }
  printf("))) %.3f 0.01)\n", expected);
}


x86 assembly (clang, -O0):
<gen_flo_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x3,%rcx
cmp    %rcx,%rax
jae    1183 <gen_flo_test+0x73>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1143 <gen_flo_test+0x33>
movsd  -0x20(%rbp),%xmm0
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_flo_test>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x8,%r12
jb     1168 <gen_flo_test+0x58>
shr    $0x3,%r12
lea    0xee1(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <gen_flo_test+0x40>
lea    0xebb(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"(check-= (%s (open-input-bytes (bytes\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [16 x i8] c"))) %.3f 0.01)\0A\00"
define void @gen_flo_test(i8* %0, i8* %1, i64 %2, double %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca double
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store double %3, double* %8
%10 = load i8*, i8** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %10)
store i64 0, i64* %9
br label %12
12: ; preds = %24, %4
%13 = load i64, i64* %9
%14 = load i64, i64* %7
%15 = udiv i64 %14, 8
%16 = icmp ult i64 %13, %15
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i8*, i8** %6
%19 = load i64, i64* %9
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17
%25 = load i64, i64* %9
%26 = add i64 %25, 1
store i64 %26, i64* %9
br label %12
27: ; preds = %12
%28 = load double, double* %8
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %28)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"(check-= (%s (open-input-bytes (bytes\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [16 x i8] c"))) %.3f 0.01)\0A\00"
define void @gen_flo_test(i8* %0, i8* nocapture %1, i64 %2, double %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = icmp ult i64 %2, 8
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = lshr i64 %2, 3
br label %11
9: ; preds = %11, %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %3)
ret void
11: ; preds = %7, %11
%12 = phi i64 [ %17, %11 ], [ 0, %7 ]
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %9, label %11
}