// File: /workspace/github_c_makefile_star2_O0/codeplea[P]tinyexpr/smoke.c
// Function: test_nans
void test_nans() {

    const char *nans[] = {
        "0/0",
        "1%0",
        "1%(1%0)",
        "(1%0)%1",
        "fac(-1)",
        "ncr(2, 4)",
        "ncr(-2, 4)",
        "ncr(2, -4)",
        "npr(2, 4)",
        "npr(-2, 4)",
        "npr(2, -4)",
    };

    int i;
    for (i = 0; i < sizeof(nans) / sizeof(const char *); ++i) {
        const char *expr = nans[i];

        int err;
        const double r = te_interp(expr, &err);
        lequal(err, 0);
        lok(r != r);

        te_expr *n = te_compile(expr, 0, 0, &err);
        lok(n);
        lequal(err, 0);
        const double c = te_eval(n);
        lok(c != c);
        te_free(n);
    }
}

// Assembly:
subq $0x88, %rsp
leaq 0x30(%rsp), %rdi
leaq 0xaf2d(%rip), %rsi      # 0xe5f0
movl $0x58, %edx
callq 0x30e0
movl $0x0, 0x2c(%rsp)
movslq 0x2c(%rsp), %rax
cmpq $0xb, %rax
jae 0x38b3
movslq 0x2c(%rsp), %rax
movq 0x30(%rsp,%rax,8), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x9300
movsd %xmm0, 0x10(%rsp)
movl 0xb9ee(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xb9e5(%rip)      # 0xf0fc
cmpl $0x0, 0x1c(%rsp)
je 0x374e
movl 0xb9dc(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xb9d3(%rip)      # 0xf100
movl 0x1c(%rsp), %ecx
leaq 0x7ce9(%rip), %rdi      # 0xb421
leaq 0x7c7c(%rip), %rsi      # 0xb3bb
movl $0xe8, %edx
xorl %r8d, %r8d
movb $0x0, %al
callq 0x3080
jmp 0x3750
jmp 0x3752
movl 0xb9a4(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xb99b(%rip)      # 0xf0fc
movsd 0x10(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
jne 0x379a
jp 0x379a
movl 0xb989(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xb980(%rip)      # 0xf100
leaq 0x7c26(%rip), %rdi      # 0xb3ad
leaq 0x7c2d(%rip), %rsi      # 0xb3bb
movl $0xe9, %edx
movb $0x0, %al
callq 0x3080
jmp 0x379c
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq 0x1c(%rsp), %rcx
callq 0x8ff0
movq %rax, 0x8(%rsp)
movl 0xb940(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xb937(%rip)      # 0xf0fc
cmpq $0x0, 0x8(%rsp)
jne 0x37f6
movl 0xb92d(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xb924(%rip)      # 0xf100
leaq 0x7bca(%rip), %rdi      # 0xb3ad
leaq 0x7bd1(%rip), %rsi      # 0xb3bb
movl $0xec, %edx
movb $0x0, %al
callq 0x3080
jmp 0x37f8
jmp 0x37fa
movl 0xb8fc(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xb8f3(%rip)      # 0xf0fc
cmpl $0x0, 0x1c(%rsp)
je 0x3840
movl 0xb8ea(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xb8e1(%rip)      # 0xf100
movl 0x1c(%rsp), %ecx
leaq 0x7bf7(%rip), %rdi      # 0xb421
leaq 0x7b8a(%rip), %rsi      # 0xb3bb
movl $0xed, %edx
xorl %r8d, %r8d
movb $0x0, %al
callq 0x3080
jmp 0x3842
movq 0x8(%rsp), %rdi
callq 0x8450
movsd %xmm0, (%rsp)
movl 0xb8a5(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xb89c(%rip)      # 0xf0fc
movsd (%rsp), %xmm0
ucomisd (%rsp), %xmm0
jne 0x3897
jp 0x3897
movl 0xb88c(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xb883(%rip)      # 0xf100
leaq 0x7b29(%rip), %rdi      # 0xb3ad
leaq 0x7b30(%rip), %rsi      # 0xb3bb
movl $0xef, %edx
movb $0x0, %al
callq 0x3080
jmp 0x3899
movq 0x8(%rsp), %rdi
callq 0x7e40
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x36d5
addq $0x88, %rsp
retq
nopl (%rax,%rax)