// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/./softfptest_template.h
// Function: test_cvt_sf64_sf128
void test_cvt_sf64_sf(F_UINT a, RoundingModeEnum rm, int it)
{
    uint64_t a64, a64_ref;
    float_status st;
    uint32_t fflags;
    F_UINT a_ref;

    /* to 64 bit */
    fflags = 0;
    a64 = glue(glue(cvt_sf, F_SIZE), _sf64)(a, rm, &fflags);

    softfloat_init_ctx(&st, rm);
    a64_ref = softfloat_to_sf64(glue(glue(float, F_SIZE), _to_float64)(sf_to_softfloat(a), &st));
    if (a64 != a64_ref || softfloat_to_fflags(&st) != fflags) {
        printf("ERROR op=cvt_sf_sf64 size=%d rm=%s it=%d:\n",
               F_SIZE, rm_to_str[rm], it);
        printf("a  = "); print_sf(a); printf("\n");
        printf("ref= "); print_sf64(a64_ref); printf("\n");
        printf("r  = "); print_sf64(a64); printf("\n");
        exit(1);
    }
    
    /* from 64 bit */
    fflags = 0;
    a = glue(cvt_sf64_sf, F_SIZE)(a64, &fflags);
    
    softfloat_init_ctx(&st, rm);
    a_ref = softfloat_to_sf(glue(float64_to_float, F_SIZE)(sf_to_softfloat64(a64), &st));
    if (a != a_ref || softfloat_to_fflags(&st) != fflags) {
        printf("ERROR op=cvt_sf64_sf size=%d rm=%s it=%d\n",
               F_SIZE, rm_to_str[rm], it);
        printf("a  = "); print_sf64(a64); printf("\n");
        printf("ref= "); print_sf(a_ref); printf("\n");
        printf("r  = "); print_sf(a); printf("\n");
        exit(1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %rcx
movl %ebp, (%rcx)
callq 0x9116
movq %rax, %rbx
leaq 0x10(%rsp), %rdx
movl %ebp, (%rdx)
movl %ebp, 0x3(%rdx)
movl %r12d, %ebp
leaq 0x11f76(%rip), %rax     # 0x160d0
movb (%rax,%rbp,4), %r13b
movb %r13b, 0x1(%rdx)
movb $0x1, 0x6(%rdx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x11cae
movq %rax, %r12
cmpq %rax, %rbx
jne 0x4252
movb 0x12(%rsp), %al
movl %eax, %ecx
shlb $0x4, %cl
andb $0x10, %cl
leal (%rax,%rax), %edx
andb $0x8, %dl
orb %cl, %dl
movl %eax, %ecx
shrb %cl
andb $0x4, %cl
orb %dl, %cl
movl %eax, %edx
shrb $0x3, %dl
andb $0x2, %dl
orb %cl, %dl
shrb $0x5, %al
andb $0x1, %al
orb %dl, %al
movzbl %al, %eax
cmpl %eax, 0x8(%rsp)
jne 0x4252
xorl %r12d, %r12d
leaq 0x8(%rsp), %rsi
movl %r12d, (%rsi)
movq %rbx, %rdi
callq 0x904f
movq %rax, %r14
movq %rdx, %r15
leaq 0x10(%rsp), %rsi
movl %r12d, (%rsi)
movl %r12d, 0x3(%rsi)
movb %r13b, 0x1(%rsi)
movb $0x1, 0x6(%rsi)
movq %rbx, %rdi
callq 0xd86b
movq %rax, %r12
movq %rdx, %r13
movq %r15, %rax
xorq %rdx, %rax
movq %r14, %rcx
xorq %r12, %rcx
orq %rax, %rcx
jne 0x42cf
movb 0x12(%rsp), %al
movl %eax, %ecx
shlb $0x4, %cl
andb $0x10, %cl
leal (%rax,%rax), %edx
andb $0x8, %dl
orb %cl, %dl
movl %eax, %ecx
shrb %cl
andb $0x4, %cl
orb %dl, %cl
movl %eax, %edx
shrb $0x3, %dl
andb $0x2, %dl
orb %cl, %dl
shrb $0x5, %al
andb $0x1, %al
orb %dl, %al
movzbl %al, %eax
cmpl %eax, 0x8(%rsp)
jne 0x42cf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17b67(%rip), %rax     # 0x1bdc0
movq (%rax,%rbp,8), %rdx
leaq 0x121c6(%rip), %rdi     # 0x1642a
movl $0x80, %esi
movl 0xc(%rsp), %ecx
xorl %eax, %eax
callq 0x1070
leaq 0x11f1f(%rip), %rdi     # 0x1619a
xorl %eax, %eax
callq 0x1070
movq %r15, %rdi
movq %r14, %rsi
callq 0x3e81
movl $0xa, %edi
callq 0x1030
leaq 0x11f08(%rip), %rdi     # 0x161a6
xorl %eax, %eax
callq 0x1070
movq %r12, %rdi
callq 0x2949
movl $0xa, %edi
callq 0x1030
leaq 0x11efe(%rip), %rdi     # 0x161bc
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
callq 0x2949
jmp 0x434d
leaq 0x17aea(%rip), %rax     # 0x1bdc0
movq (%rax,%rbp,8), %rdx
leaq 0x12174(%rip), %rdi     # 0x16455
movl $0x80, %esi
movl 0xc(%rsp), %ecx
xorl %eax, %eax
callq 0x1070
leaq 0x11ea2(%rip), %rdi     # 0x1619a
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
callq 0x2949
movl $0xa, %edi
callq 0x1030
leaq 0x11e8e(%rip), %rdi     # 0x161a6
xorl %eax, %eax
callq 0x1070
movq %r12, %rdi
movq %r13, %rsi
callq 0x3e81
movl $0xa, %edi
callq 0x1030
leaq 0x11e81(%rip), %rdi     # 0x161bc
xorl %eax, %eax
callq 0x1070
movq %r14, %rdi
movq %r15, %rsi
callq 0x3e81
movl $0xa, %edi
callq 0x1030
movl $0x1, %edi
callq 0x10b0