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

    num_args = check_assert_args2("assert_array_equal", 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: in assert_array_equal(): 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();
    }

    fprintf(fout, "! assert_array_equal_with(%s)\n",
            (num_args == 3) ? "tol" : "");

    // length check
    print_array_size_check(a, b);

    // XXX generate different code if tolerance = 0

    // do loop
    fputs("    do funit_i_ = 1,size(", fout);
    PRINT_CODE(a);
    fputs(")\n", fout);
    fputs("      if (abs(", fout);
    PRINT_CODE(a);
    fputs("(funit_i_) - ", fout);
    PRINT_CODE(b);
    fprintf(fout, "(funit_i_)) > %g) then\n", this_tolerance);
    fputs("        write(funit_message_,*) \"", fout);
    print_macro_arg(a);
    fprintf(fout, "(\", funit_i_, &\n          \") is not within %g of ",
            this_tolerance);
    print_macro_arg(b);
    fputs("(\", funit_i_, &\n          \"): \", ", fout);
    PRINT_CODE(a);
    fputs("(funit_i_), \"vs\", ", fout);
    PRINT_CODE(b);
    fputs("(funit_i_)\n", fout);
    fputs("        funit_passed_ = .false.\n", fout);
    fputs("        return\n", fout);
    fputs("      end if\n", fout);
    fputs("    end do", fout);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %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 0x5feb(%rip), %rdi      # 0xb867
movl $0x2, %ecx
movl $0x3, %r8d
callq 0x5e80
movl %eax, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jge 0x58a1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5b88
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x2, -0x30(%rbp)
jne 0x58ff
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x58ef
movq 0x9735(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0xb9cb(%rip), %rdx      # 0x11298
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x6136(%rip), %rsi      # 0xba12
movb $0x0, %al
callq 0x21a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5b88
movsd -0x18(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x5970
cmpl $0x3, -0x30(%rbp)
jne 0x5969
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5967
movq 0x96bd(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0xb953(%rip), %rdx      # 0x11298
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x5e6f(%rip), %rsi      # 0xb7c3
movb $0x0, %al
callq 0x21a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5b88
jmp 0x596e
callq 0x2050
jmp 0x5970
movq 0xb919(%rip), %rdi      # 0x11290
movl -0x30(%rbp), %ecx
leaq 0x6475(%rip), %rdx      # 0xbdf6
leaq 0x5eaa(%rip), %rax      # 0xb832
cmpl $0x3, %ecx
cmoveq %rax, %rdx
leaq 0x60e1(%rip), %rsi      # 0xba77
movb $0x0, %al
callq 0x21a0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6170
movq 0xb8df(%rip), %rsi      # 0x11290
leaq 0x5eda(%rip), %rdi      # 0xb892
callq 0x2130
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xb8bc(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xb8ab(%rip), %rsi      # 0x11290
leaq 0x637b(%rip), %rdi      # 0xbd67
callq 0x2130
movq 0xb898(%rip), %rsi      # 0x11290
leaq 0x6097(%rip), %rdi      # 0xba96
callq 0x2130
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xb875(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xb864(%rip), %rsi      # 0x11290
leaq 0x6072(%rip), %rdi      # 0xbaa5
callq 0x2130
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xb841(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xb830(%rip), %rdi      # 0x11290
movss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x6043(%rip), %rsi      # 0xbab3
movb $0x1, %al
callq 0x21a0
movq 0xb812(%rip), %rsi      # 0x11290
leaq 0x5e53(%rip), %rdi      # 0xb8d8
callq 0x2130
movq -0x20(%rbp), %rdi
callq 0x5cc0
movq 0xb7f6(%rip), %rdi      # 0x11290
movss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x6021(%rip), %rsi      # 0xbacb
movb $0x1, %al
callq 0x21a0
movq -0x28(%rbp), %rdi
callq 0x5cc0
movq 0xb7cf(%rip), %rsi      # 0x11290
leaq 0x5e60(%rip), %rdi      # 0xb928
callq 0x2130
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xb7ac(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xb79b(%rip), %rsi      # 0x11290
leaq 0x5e4e(%rip), %rdi      # 0xb94a
callq 0x2130
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0xb778(%rip), %rcx      # 0x11290
movl $0x1, %edx
callq 0x2270
movq 0xb767(%rip), %rsi      # 0x11290
leaq 0x5e2d(%rip), %rdi      # 0xb95d
callq 0x2130
movq 0xb754(%rip), %rsi      # 0x11290
leaq 0x5e26(%rip), %rdi      # 0xb969
callq 0x2130
movq 0xb741(%rip), %rsi      # 0x11290
leaq 0x5e34(%rip), %rdi      # 0xb98a
callq 0x2130
movq 0xb72e(%rip), %rsi      # 0x11290
leaq 0x5e31(%rip), %rdi      # 0xb99a
callq 0x2130
movq 0xb71b(%rip), %rsi      # 0x11290
leaq 0x5e2c(%rip), %rdi      # 0xb9a8
callq 0x2130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)