// File: /workspace/github_c_makefile_star2_O0/ieyasu[P]funit/generate_code.c
// Function: generate_assert_equal_with
static int generate_assert_equal_with(struct Code *macro, double tolerance)
{
    struct Code *a = macro->u.m.args, *b;
    double this_tolerance;
    int num_args;

    num_args = check_assert_args2("assert_equal_with", macro, a, 2, 3);
    if (num_args < 2) {
        return -1;
    }
    b = a->next;
    if (num_args == 2) {
        if (tolerance < 0.0) {
            fprintf(stderr, "near %s:%li: missing a tolerance argument or "
                    "a set-level default tolerance\n",
                    test_set_file_name, macro->lineno);
            return -1;
        }
        this_tolerance = tolerance;
    } else if (num_args == 3) {
        this_tolerance = strtod(b->next->u.c.str, NULL);
        if (this_tolerance < 0.0) {
            fprintf(stderr, "near %s:%li: in assert_array_equal(): parsed "
                    "a tolerance < 0.0; you need to fix that\n",
                    test_set_file_name, macro->lineno);
            return -1;
        }
    } else {
        abort();
    }

    // XXX generate different code if tolerance = 0
    fprintf(fout, "! assert_equal_with(%s)\n", (num_args == 3) ? "tol" : "");
    fputs("    if (abs((", fout);
    PRINT_CODE(a);
    fputs(") - (", fout);
    PRINT_CODE(b);
    fprintf(fout, ")) > %g) then\n", this_tolerance);
    fputs("      write(funit_message_,*) \"'",fout);
    print_macro_arg(a);
    fputs("' (\", ", fout);
    PRINT_CODE(a);
    fprintf(fout, ", &\n\") is not within %g of '", this_tolerance);
    print_macro_arg(b);
    fputs("'\"\n", fout);
    fputs("      funit_passed_ = .false.\n", fout);
    fputs("      return\n", fout);
    fputs("    end if", fout);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x63b9(%rip), %rdi      # 0xb765
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x5e80
movl %eax, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jge 0x53d1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5605
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x2, -0x34(%rbp)
jne 0x542b
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x541f
movq 0x9c05(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0xbe9b(%rip), %rdx      # 0x11298
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x636b(%rip), %rsi      # 0xb777
movb $0x0, %al
callq 0x21a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5605
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x5490
cmpl $0x3, -0x34(%rbp)
jne 0x5489
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20a0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x5487
movq 0x9b9d(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0xbe33(%rip), %rdx      # 0x11298
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x634f(%rip), %rsi      # 0xb7c3
movb $0x0, %al
callq 0x21a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5605
jmp 0x548e
callq 0x2050
jmp 0x5490
movq 0xbdf9(%rip), %rdi      # 0x11290
movl -0x34(%rbp), %ecx
leaq 0x6955(%rip), %rdx      # 0xbdf6
leaq 0x638a(%rip), %rax      # 0xb832
cmpl $0x3, %ecx
cmoveq %rax, %rdx
leaq 0x6363(%rip), %rsi      # 0xb819
movb $0x0, %al
callq 0x21a0
movq 0xbdcc(%rip), %rsi      # 0x11290
leaq 0x636b(%rip), %rdi      # 0xb836
callq 0x2130
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xbda9(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xbd98(%rip), %rsi      # 0x11290
leaq 0x6345(%rip), %rdi      # 0xb844
callq 0x2130
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xbd75(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xbd64(%rip), %rdi      # 0x11290
movsd -0x30(%rbp), %xmm0
leaq 0x6584(%rip), %rsi      # 0xbabc
movb $0x1, %al
callq 0x21a0
movq 0xbd4a(%rip), %rsi      # 0x11290
leaq 0x5f78(%rip), %rdi      # 0xb4c5
callq 0x2130
movq -0x20(%rbp), %rdi
callq 0x5cc0
movq 0xbd2e(%rip), %rsi      # 0x11290
leaq 0x6195(%rip), %rdi      # 0xb6fe
callq 0x2130
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xbd0b(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xbcfa(%rip), %rdi      # 0x11290
movsd -0x30(%rbp), %xmm0
leaq 0x62a8(%rip), %rsi      # 0xb84a
movb $0x1, %al
callq 0x21a0
movq -0x28(%rbp), %rdi
callq 0x5cc0
movq 0xbcd7(%rip), %rsi      # 0x11290
leaq 0x615e(%rip), %rdi      # 0xb71e
callq 0x2130
movq 0xbcc4(%rip), %rsi      # 0x11290
leaq 0x6398(%rip), %rdi      # 0xb96b
callq 0x2130
movq 0xbcb1(%rip), %rsi      # 0x11290
leaq 0x63a6(%rip), %rdi      # 0xb98c
callq 0x2130
movq 0xbc9e(%rip), %rsi      # 0x11290
leaq 0x5efa(%rip), %rdi      # 0xb4f3
callq 0x2130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop