# The census of float_moves_zig_x86_64_O2g: what `aa; pdd` renders for each function `afl` lists.
# Regenerate with `scripts/census.py golden` when `afl` moves, then bless.

NAME=afl
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=afl
EXPECT=<<EOF
0x010014b0    1     42 sym._start
0x010014e0    1     10 sym.scale
0x010014f0    1     19 sym.swap_call
0x01001510    1     27 sym.main
0x01001530    4    102 sym.__libc_csu_init
0x010015a0    1      6 sym.__libc_csu_fini
EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x010014b0
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x010014b0
EXPECT=<<EOF
void _start(void)
{
    uint64_t tmp_10014b5_0_2;

    /* r2dec proof: 5 constructs are marked below; 27 source obligations: 0 rendered, 5 elided, 0 refused, 22 residual; 1 statements rendered; 1 held from entry, read as residuals (stack_p0) */
    {
        tmp_10014b5_0_2 = r2sleigh_residual_u64(1);
        r2sleigh_residual_void(2); /* r2dec gap: StoreNotSpelled at 0x10014b0:29 covering 1 op (render::values) */
        r2sleigh_residual_void(3); /* r2dec gap: StoreNotSpelled at 0x10014b0:32 covering 1 op (render::values) */
        r2sleigh_residual_void(4); /* r2dec gap: CallNotRendered at 0x10014b0:46 covering 1 op (render::values): call to __libc_start_main: the import's declaration has an argument this convention does not place */
        r2sleigh_residual_void(5); /* r2dec gap: TransferNotFollowed at 0x10014b0 (render::control) */
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x010014e0
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x010014e0
EXPECT=<<EOF
double scale(double x, double k)
{
    /* r2dec proof: no individual construct is marked; 9 source obligations: 3 rendered, 6 elided, 0 refused; 1 statements rendered */
    {
        return (double)(x * k);
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x010014f0
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x010014f0
EXPECT=<<EOF
double swap_call(double a, double b)
{
    double scale(double, double);

    /* r2dec proof: no individual construct is marked; 6 source obligations: 4 rendered, 2 elided, 0 refused; 1 statements rendered; 1 callee prototype supplied by the source */
    {
        return scale(b, a);
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x01001510
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x01001510
EXPECT=<<EOF
int32_t main(int32_t argc, char** argv)
{
    double swap_call(double, double);

    __uint128_t xmm0_2;
    uint64_t tmp_lane_1001525_2_0_1;
    uint8_t tmp_1001525_12_1;
    double tmp_1001525_1b_1;
    uint64_t tmp_1001525_13_2;

    /* r2dec proof: 1 construct is marked below; 30 source obligations: 19 rendered, 9 elided, 0 refused, 2 residual; 6 statements rendered; 1 callee prototype supplied by the source */
    {
        xmm0_2 = (__uint128_t)r2sleigh_float_to_bits_64(swap_call((double)(int32_t)argc, r2sleigh_float_from_bits_64((uint64_t)0x4000000000000000U)));
        tmp_lane_1001525_2_0_1 = (uint64_t)((__uint128_t)xmm0_2 >> 0U);
        tmp_1001525_12_1 = (uint8_t)((uint32_t)(uint8_t)((double)(int64_t)0xffffffff7fffffffU < r2sleigh_float_from_bits_64(tmp_lane_1001525_2_0_1)) & (uint32_t)(uint8_t)(r2sleigh_float_from_bits_64(tmp_lane_1001525_2_0_1) < (double)(int64_t)0x80000000U));
        tmp_1001525_1b_1 = (double)(int32_t)0U;
        tmp_1001525_13_2 = tmp_1001525_12_1 ? (uint64_t)tmp_lane_1001525_2_0_1 : (uint64_t)r2sleigh_float_to_bits_64(tmp_1001525_1b_1);
        return (int32_t)((uint32_t)(r2sleigh_float_from_bits_64(tmp_1001525_13_2) > -2147483649.0 && r2sleigh_float_from_bits_64(tmp_1001525_13_2) < 2147483648.0 ? (int32_t)r2sleigh_float_from_bits_64(tmp_1001525_13_2) : r2sleigh_residual_i32(1)) | (uint32_t)((uint32_t)(uint8_t)((uint32_t)tmp_1001525_12_1 ^ (uint32_t)(uint8_t)1U) * (uint32_t)0x80000000U));
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x01001530
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x01001530
EXPECT=<<EOF
void __libc_csu_init(int32_t argc, char** argv, char** envp)
{
    /* r2dec proof: no individual construct is marked; 26 source obligations: 2 rendered, 24 elided, 0 refused; 1 statements rendered */
    {
        {
            return;
        }
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN

NAME=0x010015a0
FILE=tests/fixtures/float_moves_zig_x86_64_O2g
CMDS=aa; pdd @ 0x010015a0
EXPECT=<<EOF
void __libc_csu_fini(void)
{
    /* r2dec proof: no individual construct is marked; 7 source obligations: 1 rendered, 6 elided, 0 refused; 1 statements rendered */
    {
        return;
    }
}

EOF
EXPECT_ERR=<<EOF
EOF
RUN
