// File: alan0201tw[P]RayTracer/src/util.cpp
// Function: next_week_final()
std::shared_ptr<hitable> next_week_final()
{
    int nb = 20;
    std::vector<std::shared_ptr<hitable>> list;
    std::vector<std::shared_ptr<hitable>> box_list;
    std::vector<std::shared_ptr<hitable>> box_list2;

    std::shared_ptr<texture> white_texture = std::make_shared<constant_texture>(vec3(0.73f, 0.73f, 0.73f));
    std::shared_ptr<texture> ground_texture = std::make_shared<constant_texture>(vec3(0.48f, 0.83f, 0.53f));
    auto white_material = std::make_shared<lambertian>(white_texture);
    auto ground_material = std::make_shared<lambertian>(ground_texture);

    list.reserve(30);
    box_list.reserve(10000);
    box_list2.reserve(10000);

    static const float w = 100;
    for(int i = 0; i < nb; i++)
    {
        for(int j = 0; j < nb; j++)
        {
            float x0 = -1000 + i * w;
            float z0 = -1000 + j * w;
            float y0 = 0;
            float x1 = x0 + w;
            float y1 = 100 * (drand48() + 0.01f);
            float z1 = z0 + w;
            box_list.push_back(std::make_shared<box>(vec3(x0, y0, z0), vec3(x1, y1, z1), ground_material));
        }
    }

    list.push_back( std::make_shared<bvh_node>(box_list, 0.0f, 1.0f) );
    
    std::shared_ptr<texture> light_texture = std::make_shared<constant_texture>(vec3(7.0f, 7.0f, 7.0f));
    auto light = std::make_shared<diffuse_light>(light_texture);

    list.push_back(std::make_shared<xz_rect>(123, 423, 147, 412, 554, light));
    vec3 center(400, 400, 200);
    auto moving_sphere_mat = std::make_shared<lambertian>(std::make_shared<constant_texture>(vec3(0.7, 0.3, 0.1)));
    list.push_back(std::make_shared<moving_sphere>(center, center + vec3(30, 0, 0), 0, 1, 50, moving_sphere_mat));
    
    list.push_back(std::make_shared<sphere>(vec3(260, 150, 45), 50, std::make_shared<dielectric>(1.5f)));
    list.push_back(std::make_shared<sphere>(vec3(0, 150, 145), 50, std::make_shared<metal>(vec3(0.8, 0.8, 0.9), 10.0f)));
    {
        std::shared_ptr<hitable> boundary = std::make_shared<sphere>(vec3(360, 150, 145), 70, std::make_shared<dielectric>(1.5f));
        auto texture1 = std::make_shared<constant_texture>(vec3(0.2, 0.4, 0.9));
        list.push_back(boundary);
        list.push_back(std::make_shared<constant_medium>(boundary, 0.2f, texture1));
    }
    {
        std::shared_ptr<hitable> boundary1 = std::make_shared<sphere>(vec3(0, 0, 0), 5000, std::make_shared<dielectric>(1.5f));
        list.push_back(std::make_shared<constant_medium>(boundary1, 0.0001f, white_texture));
    }

    auto emat = std::make_shared<lambertian>(std::make_shared<image_texture>("./resources/texture.jpg"));
    list.push_back(std::make_shared<sphere>(vec3(400, 200, 400), 100, emat));

    auto perlin_texture = std::make_shared<perlin_noise_texture>(0.1f);
    list.push_back(std::make_shared<sphere>(vec3(220, 280, 300), 80, std::make_shared<lambertian>(perlin_texture)));

    int ns = 1000;
    for(int j = 0; j < ns; j++)
    {
        float tmp_x = 165.0f * drand48();
        float tmp_y = 165.0f * drand48();
        float tmp_z = 165.0f * drand48();
        box_list2.push_back(std::make_shared<sphere>(vec3(tmp_x, tmp_y, tmp_z), 10, white_material));
    }

    list.push_back(std::make_shared<translate>(
        std::make_shared<rotate_y>(
            std::make_shared<bvh_node>(box_list2, 0.0f, 1.0f), 
            15.0f), 
        vec3(-100, 270, 395)));

    return std::make_shared<bvh_node>(list, 0.0f, 1.0f);

    // using BVH, with 1920*1080 image. 10 sample per pixel
    // real    0m49.472s
    // user    4m14.656s
    // sys     0m39.828s

    // without
    // real    5m28.462s
    // user    40m24.922s
    // sys     0m27.766s

    // 3000 spp 1920x1080 benchmark
    // real    274m12.543s
    // user    1075m47.013s
    // sys     0m36.908s
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x650, %rsp            # imm = 0x650
movq %rdi, -0x580(%rbp)
movq %rdi, %rax
movq %rax, -0x578(%rbp)
movq %rdi, -0x8(%rbp)
movl $0x14, -0xc(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x8b80
leaq -0x40(%rbp), %rdi
callq 0x8b80
leaq -0x58(%rbp), %rdi
callq 0x8b80
leaq -0x84(%rbp), %rdi
movss 0x56207(%rip), %xmm2    # 0x7e508
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf9b0
jmp 0x2830e
leaq -0x78(%rbp), %rdi
leaq -0x84(%rbp), %rsi
callq 0x2cc80
jmp 0x28320
leaq -0x68(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %rsi, -0x588(%rbp)
callq 0x2cf80
movq -0x588(%rbp), %rdi
callq 0x2cd40
leaq -0xc4(%rbp), %rdi
movss 0x561e5(%rip), %xmm0    # 0x7e534
movss 0x561e1(%rip), %xmm1    # 0x7e538
movss 0x561dd(%rip), %xmm2    # 0x7e53c
callq 0xf9b0
jmp 0x28366
leaq -0xb8(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x2cc80
jmp 0x2837b
leaq -0xa8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
movq %rsi, -0x590(%rbp)
callq 0x2cf80
movq -0x590(%rbp), %rdi
callq 0x2cd40
leaq -0xd8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2cea0
jmp 0x283b3
leaq -0xe8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2cea0
jmp 0x283c8
leaq -0x28(%rbp), %rdi
movl $0x1e, %esi
callq 0x8ba0
jmp 0x283d8
leaq -0x40(%rbp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x8ba0
jmp 0x283e8
leaq -0x58(%rbp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x8ba0
jmp 0x283f8
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x28654
movl $0x0, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2863e
cvtsi2ssl -0xec(%rbp), %xmm0
movss 0x56142(%rip), %xmm1    # 0x7e57c
movss %xmm1, -0x594(%rbp)
mulss %xmm1, %xmm0
movss 0x5608e(%rip), %xmm2    # 0x7e4dc
addss %xmm2, %xmm0
movss %xmm0, -0xf4(%rbp)
cvtsi2ssl -0xf0(%rbp), %xmm0
mulss %xmm1, %xmm0
addss %xmm2, %xmm0
movss %xmm0, -0xf8(%rbp)
movl $0x0, -0xfc(%rbp)
movss -0xf4(%rbp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x100(%rbp)
callq 0x7480
movss -0x594(%rbp), %xmm1
movsd 0x56003(%rip), %xmm2    # 0x7e4a8
addsd %xmm2, %xmm0
movsd 0x55fff(%rip), %xmm2    # 0x7e4b0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x104(%rbp)
movss -0xf8(%rbp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x108(%rbp)
movss -0xf4(%rbp), %xmm0
movss -0xfc(%rbp), %xmm1
movss -0xf8(%rbp), %xmm2
leaq -0x134(%rbp), %rdi
callq 0xf9b0
jmp 0x284fb
movss -0x100(%rbp), %xmm0
movss -0x104(%rbp), %xmm1
movss -0x108(%rbp), %xmm2
leaq -0x140(%rbp), %rdi
callq 0xf9b0
jmp 0x28521
leaq -0x128(%rbp), %rdi
leaq -0x134(%rbp), %rsi
leaq -0x140(%rbp), %rdx
leaq -0xe8(%rbp), %rcx
callq 0x2db70
jmp 0x28544
leaq -0x118(%rbp), %rdi
movq %rdi, -0x5a0(%rbp)
leaq -0x128(%rbp), %rsi
callq 0x2dd50
movq -0x5a0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x8ca0
jmp 0x28570
leaq -0x118(%rbp), %rdi
callq 0x8e00
leaq -0x128(%rbp), %rdi
callq 0x2dc60
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x2841b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x296d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x296cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x296c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x296b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x296a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x8e00
leaq -0x128(%rbp), %rdi
callq 0x2dc60
jmp 0x296a9
jmp 0x28640
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x28402
movl $0x0, -0x164(%rbp)
movl $0x3f800000, -0x168(%rbp) # imm = 0x3F800000
leaq -0x160(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x164(%rbp), %rdx
leaq -0x168(%rbp), %rcx
callq 0x2d4e0
jmp 0x28688
leaq -0x150(%rbp), %rdi
movq %rdi, -0x5a8(%rbp)
leaq -0x160(%rbp), %rsi
callq 0x2d560
movq -0x5a8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x286b4
leaq -0x150(%rbp), %rdi
callq 0x8e00
leaq -0x160(%rbp), %rdi
callq 0x13be0
leaq -0x194(%rbp), %rdi
movss 0x55e21(%rip), %xmm2    # 0x7e4fc
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf9b0
jmp 0x286e8
leaq -0x188(%rbp), %rdi
leaq -0x194(%rbp), %rsi
callq 0x2cc80
jmp 0x286fd
leaq -0x178(%rbp), %rdi
movq %rdi, -0x5b0(%rbp)
leaq -0x188(%rbp), %rsi
movq %rsi, -0x5b8(%rbp)
callq 0x2cf80
movq -0x5b8(%rbp), %rdi
callq 0x2cd40
movq -0x5b0(%rbp), %rsi
leaq -0x1a8(%rbp), %rdi
callq 0x2d3d0
jmp 0x2873f
movl $0x7b, -0x1cc(%rbp)
movl $0x1a7, -0x1d0(%rbp)    # imm = 0x1A7
movl $0x93, -0x1d4(%rbp)
movl $0x19c, -0x1d8(%rbp)    # imm = 0x19C
movl $0x22a, -0x1dc(%rbp)    # imm = 0x22A
movq %rsp, %rax
leaq -0x1a8(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x1c8(%rbp), %rdi
leaq -0x1cc(%rbp), %rsi
leaq -0x1d0(%rbp), %rdx
leaq -0x1d4(%rbp), %rcx
leaq -0x1d8(%rbp), %r8
leaq -0x1dc(%rbp), %r9
callq 0x2d890
jmp 0x287af
leaq -0x1b8(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
leaq -0x1c8(%rbp), %rsi
callq 0x8fa0
movq -0x5c0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x287db
leaq -0x1b8(%rbp), %rdi
callq 0x8e00
leaq -0x1c8(%rbp), %rdi
callq 0x8fd0
leaq -0x1e8(%rbp), %rdi
movss 0x55d3e(%rip), %xmm1    # 0x7e540
movss 0x55d3a(%rip), %xmm2    # 0x7e544
movaps %xmm1, %xmm0
callq 0xf9b0
jmp 0x28814
leaq -0x214(%rbp), %rdi
movss 0x55cc5(%rip), %xmm0    # 0x7e4e8
movss 0x55ca5(%rip), %xmm1    # 0x7e4d0
movss 0x55ca1(%rip), %xmm2    # 0x7e4d4
callq 0xf9b0
jmp 0x2883a
leaq -0x208(%rbp), %rdi
leaq -0x214(%rbp), %rsi
callq 0x2cc80
jmp 0x2884f
leaq -0x1f8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x2dd80
jmp 0x28864
leaq -0x208(%rbp), %rdi
callq 0x2cd40
leaq -0x254(%rbp), %rdi
movss 0x55cc9(%rip), %xmm0    # 0x7e548
xorps %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0xf9b0
jmp 0x2888c
leaq -0x1e8(%rbp), %rdi
leaq -0x254(%rbp), %rsi
callq 0xfa30
movss %xmm1, -0x5d4(%rbp)
movaps %xmm0, -0x5d0(%rbp)
jmp 0x288b0
movss -0x5d4(%rbp), %xmm0
movaps -0x5d0(%rbp), %xmm1
movlpd %xmm1, -0x268(%rbp)
movss %xmm0, -0x260(%rbp)
movl -0x260(%rbp), %eax
movl %eax, -0x240(%rbp)
movq -0x268(%rbp), %rax
movq %rax, -0x248(%rbp)
movl $0x0, -0x26c(%rbp)
movl $0x1, -0x270(%rbp)
movl $0x32, -0x274(%rbp)
movq %rsp, %rax
leaq -0x1f8(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x238(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
leaq -0x248(%rbp), %rdx
leaq -0x26c(%rbp), %rcx
leaq -0x270(%rbp), %r8
leaq -0x274(%rbp), %r9
callq 0x2ddf0
jmp 0x28945
leaq -0x228(%rbp), %rdi
movq %rdi, -0x5e0(%rbp)
leaq -0x238(%rbp), %rsi
callq 0x2d050
movq -0x5e0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28971
leaq -0x228(%rbp), %rdi
callq 0x8e00
leaq -0x238(%rbp), %rdi
callq 0x2d080
leaq -0x2a4(%rbp), %rdi
movss 0x55bb4(%rip), %xmm0    # 0x7e54c
movss 0x55bb0(%rip), %xmm1    # 0x7e550
movss 0x55bac(%rip), %xmm2    # 0x7e554
callq 0xf9b0
jmp 0x289af
movl $0x32, -0x2a8(%rbp)
movl $0x3fc00000, -0x2bc(%rbp) # imm = 0x3FC00000
leaq -0x2b8(%rbp), %rdi
leaq -0x2bc(%rbp), %rsi
callq 0x2df10
jmp 0x289d8
leaq -0x298(%rbp), %rdi
leaq -0x2a4(%rbp), %rsi
leaq -0x2a8(%rbp), %rdx
leaq -0x2b8(%rbp), %rcx
callq 0x2de90
jmp 0x289fb
leaq -0x288(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
leaq -0x298(%rbp), %rsi
callq 0x2cf10
movq -0x5e8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28a27
leaq -0x288(%rbp), %rdi
callq 0x8e00
leaq -0x298(%rbp), %rdi
callq 0x2cf40
leaq -0x2b8(%rbp), %rdi
callq 0x2d2b0
leaq -0x2ec(%rbp), %rdi
xorps %xmm0, %xmm0
movss 0x55af3(%rip), %xmm1    # 0x7e550
movss 0x55af3(%rip), %xmm2    # 0x7e558
callq 0xf9b0
jmp 0x28a6c
movl $0x32, -0x2f0(%rbp)
leaq -0x30c(%rbp), %rdi
movss 0x55a6b(%rip), %xmm1    # 0x7e4f0
movss 0x55a4b(%rip), %xmm2    # 0x7e4d8
movaps %xmm1, %xmm0
callq 0xf9b0
jmp 0x28a97
movl $0x41200000, -0x310(%rbp) # imm = 0x41200000
leaq -0x300(%rbp), %rdi
leaq -0x30c(%rbp), %rsi
leaq -0x310(%rbp), %rdx
callq 0x2e000
jmp 0x28abd
leaq -0x2e0(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
leaq -0x2f0(%rbp), %rdx
leaq -0x300(%rbp), %rcx
callq 0x2df80
jmp 0x28ae0
leaq -0x2d0(%rbp), %rdi
movq %rdi, -0x5f0(%rbp)
leaq -0x2e0(%rbp), %rsi
callq 0x2cf10
movq -0x5f0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28b0c
leaq -0x2d0(%rbp), %rdi
callq 0x8e00
leaq -0x2e0(%rbp), %rdi
callq 0x2cf40
leaq -0x300(%rbp), %rdi
callq 0x2d1a0
leaq -0x33c(%rbp), %rdi
movss 0x55a1d(%rip), %xmm0    # 0x7e55c
movss 0x55a09(%rip), %xmm1    # 0x7e550
movss 0x55a09(%rip), %xmm2    # 0x7e558
callq 0xf9b0
jmp 0x28b56
movl $0x46, -0x340(%rbp)
movl $0x3fc00000, -0x354(%rbp) # imm = 0x3FC00000
leaq -0x350(%rbp), %rdi
leaq -0x354(%rbp), %rsi
callq 0x2df10
jmp 0x28b7f
leaq -0x330(%rbp), %rdi
leaq -0x33c(%rbp), %rsi
leaq -0x340(%rbp), %rdx
leaq -0x350(%rbp), %rcx
callq 0x2de90
jmp 0x28ba2
leaq -0x320(%rbp), %rdi
leaq -0x330(%rbp), %rsi
movq %rsi, -0x5f8(%rbp)
callq 0x2cf10
movq -0x5f8(%rbp), %rdi
callq 0x2cf40
leaq -0x350(%rbp), %rdi
callq 0x2d2b0
leaq -0x374(%rbp), %rdi
movss 0x558e9(%rip), %xmm0    # 0x7e4cc
movss 0x55975(%rip), %xmm1    # 0x7e560
movss 0x558e5(%rip), %xmm2    # 0x7e4d8
callq 0xf9b0
jmp 0x28bfa
leaq -0x368(%rbp), %rdi
leaq -0x374(%rbp), %rsi
callq 0x2cc80
jmp 0x28c0f
leaq -0x28(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x2e080
jmp 0x28c21
movl $0x3e4ccccd, -0x39c(%rbp) # imm = 0x3E4CCCCD
leaq -0x398(%rbp), %rdi
leaq -0x320(%rbp), %rsi
leaq -0x39c(%rbp), %rdx
leaq -0x368(%rbp), %rcx
callq 0x2e0f0
jmp 0x28c4e
leaq -0x388(%rbp), %rdi
movq %rdi, -0x600(%rbp)
leaq -0x398(%rbp), %rsi
callq 0x2dd00
movq -0x600(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28c7a
leaq -0x388(%rbp), %rdi
callq 0x8e00
leaq -0x398(%rbp), %rdi
callq 0x2dd30
leaq -0x368(%rbp), %rdi
callq 0x2cd40
leaq -0x320(%rbp), %rdi
callq 0x8e00
leaq -0x3cc(%rbp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf9b0
jmp 0x28cc1
movl $0x1388, -0x3d0(%rbp)   # imm = 0x1388
movl $0x3fc00000, -0x3e4(%rbp) # imm = 0x3FC00000
leaq -0x3e0(%rbp), %rdi
leaq -0x3e4(%rbp), %rsi
callq 0x2df10
jmp 0x28cea
leaq -0x3c0(%rbp), %rdi
leaq -0x3cc(%rbp), %rsi
leaq -0x3d0(%rbp), %rdx
leaq -0x3e0(%rbp), %rcx
callq 0x2de90
jmp 0x28d0d
leaq -0x3b0(%rbp), %rdi
movq %rdi, -0x608(%rbp)
leaq -0x3c0(%rbp), %rsi
movq %rsi, -0x610(%rbp)
callq 0x2cf10
movq -0x610(%rbp), %rdi
callq 0x2cf40
leaq -0x3e0(%rbp), %rdi
callq 0x2d2b0
movq -0x608(%rbp), %rsi
movl $0x38d1b717, -0x40c(%rbp) # imm = 0x38D1B717
leaq -0x408(%rbp), %rdi
leaq -0x40c(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x2dc80
jmp 0x28d70
leaq -0x3f8(%rbp), %rdi
movq %rdi, -0x618(%rbp)
leaq -0x408(%rbp), %rsi
callq 0x2dd00
movq -0x618(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28d9c
leaq -0x3f8(%rbp), %rdi
callq 0x8e00
leaq -0x408(%rbp), %rdi
callq 0x2dd30
leaq -0x3b0(%rbp), %rdi
callq 0x8e00
leaq 0x55d3f(%rip), %rsi     # 0x7eb06
leaq -0x430(%rbp), %rdi
callq 0x2cd60
jmp 0x28dd5
leaq -0x420(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x2e170
jmp 0x28dea
leaq -0x430(%rbp), %rdi
callq 0x2ce00
leaq -0x45c(%rbp), %rdi
movss 0x5573f(%rip), %xmm1    # 0x7e544
movss 0x55733(%rip), %xmm2    # 0x7e540
movaps %xmm2, %xmm0
callq 0xf9b0
jmp 0x28e17
movl $0x64, -0x460(%rbp)
leaq -0x450(%rbp), %rdi
leaq -0x45c(%rbp), %rsi
leaq -0x460(%rbp), %rdx
leaq -0x420(%rbp), %rcx
callq 0x2e1e0
jmp 0x28e44
leaq -0x440(%rbp), %rdi
movq %rdi, -0x620(%rbp)
leaq -0x450(%rbp), %rsi
callq 0x2cf10
movq -0x620(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28e70
leaq -0x440(%rbp), %rdi
callq 0x8e00
leaq -0x450(%rbp), %rdi
callq 0x2cf40
movl $0x3dcccccd, -0x474(%rbp) # imm = 0x3DCCCCCD
leaq -0x470(%rbp), %rdi
leaq -0x474(%rbp), %rsi
callq 0x2d610
jmp 0x28ea7
leaq -0x4a4(%rbp), %rdi
movss 0x556ae(%rip), %xmm0    # 0x7e564
movss 0x556aa(%rip), %xmm1    # 0x7e568
movss 0x556a6(%rip), %xmm2    # 0x7e56c
callq 0xf9b0
jmp 0x28ecd
movl $0x50, -0x4a8(%rbp)
leaq -0x4b8(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x2e260
jmp 0x28eec
leaq -0x498(%rbp), %rdi
leaq -0x4a4(%rbp), %rsi
leaq -0x4a8(%rbp), %rdx
leaq -0x4b8(%rbp), %rcx
callq 0x2ce20
jmp 0x28f0f
leaq -0x488(%rbp), %rdi
movq %rdi, -0x628(%rbp)
leaq -0x498(%rbp), %rsi
callq 0x2cf10
movq -0x628(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x28f3b
leaq -0x488(%rbp), %rdi
callq 0x8e00
leaq -0x498(%rbp), %rdi
callq 0x2cf40
leaq -0x4b8(%rbp), %rdi
callq 0x2cf60
movl $0x3e8, -0x4bc(%rbp)    # imm = 0x3E8
movl $0x0, -0x4c0(%rbp)
movl -0x4c0(%rbp), %eax
cmpl -0x4bc(%rbp), %eax
jge 0x29424
callq 0x7480
movsd 0x5550e(%rip), %xmm1    # 0x7e4a0
movsd %xmm1, -0x630(%rbp)
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4c4(%rbp)
callq 0x7480
movsd -0x630(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4c8(%rbp)
callq 0x7480
movsd -0x630(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4cc(%rbp)
movss -0x4c4(%rbp), %xmm0
movss -0x4c8(%rbp), %xmm1
movss -0x4cc(%rbp), %xmm2
leaq -0x4fc(%rbp), %rdi
callq 0xf9b0
jmp 0x2900a
movl $0xa, -0x500(%rbp)
leaq -0x4f0(%rbp), %rdi
leaq -0x4fc(%rbp), %rsi
leaq -0x500(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0x2e1e0
jmp 0x29037
leaq -0x4e0(%rbp), %rdi
movq %rdi, -0x638(%rbp)
leaq -0x4f0(%rbp), %rsi
callq 0x2cf10
movq -0x638(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x8ca0
jmp 0x29063
leaq -0x4e0(%rbp), %rdi
callq 0x8e00
leaq -0x4f0(%rbp), %rdi
callq 0x2cf40
movl -0x4c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c0(%rbp)
jmp 0x28f73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x8e00
leaq -0x160(%rbp), %rdi
callq 0x13be0
jmp 0x296a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2969d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x8e00
leaq -0x1c8(%rbp), %rdi
callq 0x8fd0
jmp 0x29691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2cd40
jmp 0x29691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x8e00
leaq -0x238(%rbp), %rdi
callq 0x2d080
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x291c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x8e00
leaq -0x298(%rbp), %rdi
callq 0x2cf40
leaq -0x2b8(%rbp), %rdi
callq 0x2d2b0
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29211
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x8e00
leaq -0x2e0(%rbp), %rdi
callq 0x2cf40
leaq -0x300(%rbp), %rdi
callq 0x2d1a0
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x2d2b0
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x292a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29297
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x8e00
leaq -0x398(%rbp), %rdi
callq 0x2dd30
leaq -0x368(%rbp), %rdi
callq 0x2cd40
leaq -0x320(%rbp), %rdi
callq 0x8e00
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x2d2b0
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29315
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x3f8(%rbp), %rdi
callq 0x8e00
leaq -0x408(%rbp), %rdi
callq 0x2dd30
leaq -0x3b0(%rbp), %rdi
callq 0x8e00
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x2ce00
jmp 0x29685
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29679
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x440(%rbp), %rdi
callq 0x8e00
leaq -0x450(%rbp), %rdi
callq 0x2cf40
jmp 0x29679
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2966d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x293e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x8e00
leaq -0x498(%rbp), %rdi
callq 0x2cf40
leaq -0x4b8(%rbp), %rdi
callq 0x2cf60
jmp 0x2966d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x8e00
leaq -0x4f0(%rbp), %rdi
callq 0x2cf40
jmp 0x2966d
movl $0x0, -0x544(%rbp)
movl $0x3f800000, -0x548(%rbp) # imm = 0x3F800000
leaq -0x540(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x544(%rbp), %rdx
leaq -0x548(%rbp), %rcx
callq 0x2d4e0
jmp 0x29458
movl $0x41700000, -0x54c(%rbp) # imm = 0x41700000
leaq -0x530(%rbp), %rdi
leaq -0x540(%rbp), %rsi
leaq -0x54c(%rbp), %rdx
callq 0x2e2d0
jmp 0x2947e
leaq -0x558(%rbp), %rdi
movss 0x550e3(%rip), %xmm0    # 0x7e570
movss 0x550df(%rip), %xmm1    # 0x7e574
movss 0x550db(%rip), %xmm2    # 0x7e578
callq 0xf9b0
jmp 0x294a4
leaq -0x520(%rbp), %rdi
leaq -0x530(%rbp), %rsi
leaq -0x558(%rbp), %rdx
callq 0x2da70
jmp 0x294c0
leaq -0x510(%rbp), %rdi
movq %rdi, -0x640(%rbp)
leaq -0x520(%rbp), %rsi
callq 0x2dbf0
movq -0x640(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x8ca0
jmp 0x294ec
leaq -0x510(%rbp), %rdi
callq 0x8e00
leaq -0x520(%rbp), %rdi
callq 0x2dc20
leaq -0x530(%rbp), %rdi
callq 0x2dc40
leaq -0x540(%rbp), %rdi
callq 0x13be0
movl $0x0, -0x56c(%rbp)
movl $0x3f800000, -0x570(%rbp) # imm = 0x3F800000
leaq -0x568(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x56c(%rbp), %rdx
leaq -0x570(%rbp), %rcx
callq 0x2d4e0
jmp 0x29550
movq -0x580(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x2d560
leaq -0x568(%rbp), %rdi
callq 0x13be0
leaq -0x470(%rbp), %rdi
callq 0x2d6b0
leaq -0x420(%rbp), %rdi
callq 0x2cf60
leaq -0x1f8(%rbp), %rdi
callq 0x2cf60
leaq -0x1a8(%rbp), %rdi
callq 0x2d440
leaq -0x178(%rbp), %rdi
callq 0x12a50
leaq -0xe8(%rbp), %rdi
callq 0x2cf60
leaq -0xd8(%rbp), %rdi
callq 0x2cf60
leaq -0xa8(%rbp), %rdi
callq 0x12a50
leaq -0x68(%rbp), %rdi
callq 0x12a50
leaq -0x58(%rbp), %rdi
callq 0x92d0
leaq -0x40(%rbp), %rdi
callq 0x92d0
leaq -0x28(%rbp), %rdi
callq 0x92d0
movq -0x578(%rbp), %rax
addq $0x650, %rsp            # imm = 0x650
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29661
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x29655
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x510(%rbp), %rdi
callq 0x8e00
leaq -0x520(%rbp), %rdi
callq 0x2dc20
leaq -0x530(%rbp), %rdi
callq 0x2dc40
leaq -0x540(%rbp), %rdi
callq 0x13be0
leaq -0x470(%rbp), %rdi
callq 0x2d6b0
leaq -0x420(%rbp), %rdi
callq 0x2cf60
leaq -0x1f8(%rbp), %rdi
callq 0x2cf60
leaq -0x1a8(%rbp), %rdi
callq 0x2d440
leaq -0x178(%rbp), %rdi
callq 0x12a50
leaq -0xe8(%rbp), %rdi
callq 0x2cf60
leaq -0xd8(%rbp), %rdi
callq 0x2cf60
leaq -0xa8(%rbp), %rdi
callq 0x12a50
leaq -0x68(%rbp), %rdi
callq 0x12a50
leaq -0x58(%rbp), %rdi
callq 0x92d0
leaq -0x40(%rbp), %rdi
callq 0x92d0
leaq -0x28(%rbp), %rdi
callq 0x92d0
movq -0x90(%rbp), %rdi
callq 0x7860
nopl (%rax)