// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/util.cpp
// Function: random_scene()
std::shared_ptr<hitable> random_scene()
{
    int n = 500;
    std::vector<std::shared_ptr<hitable>> list;
    list.reserve(n + 1);

    std::shared_ptr<texture> _checker_texture = std::make_shared<checker_texture>(
        std::make_shared<constant_texture>(vec3(0.2f, 0.3f, 0.1f)),
        std::make_shared<constant_texture>(vec3(0.9f, 0.9f, 0.9f))
    );
    std::shared_ptr<texture> _image_texture = std::make_shared<image_texture>("./resources/texture.jpg");

    list.push_back(std::make_shared<sphere>(vec3(0,-1000,0), 1000, std::make_shared<lambertian>(_checker_texture)));

    for (int a = -10; a < 10; a++) {
        for (int b = -10; b < 10; b++) {
            float choose_mat = drand48();
            vec3 center(a + 0.9 * drand48(), 0.2f, b + 0.9 * drand48()); 
            if ((center-vec3(4,0.2,0)).length() > 0.9) { 
                if (choose_mat < 0.8f) 
                {
                    // diffuse
                    //list.push_back(std::make_shared<sphere>(center, 0.2, std::make_shared<lambertian>(vec3(drand48()*drand48(), drand48()*drand48(), drand48()*drand48()))));
                    std::shared_ptr<texture> random_texture = std::make_shared<constant_texture>(
                        vec3(drand48()*drand48(), drand48()*drand48(), drand48()*drand48()));

                    list.push_back(std::make_shared<moving_sphere>(
                        center, center + vec3(0, 0.5f * drand48(), 0.0f), 
                        0.0f, 1.0f, // start and end time
                        0.2f, std::make_shared<lambertian>(random_texture)));
                }
                else if (choose_mat < 0.95f)
                {
                    // metal
                    list.push_back(std::make_shared<sphere>(center, 0.2,
                        std::make_shared<metal>(vec3(0.5*(1 + drand48()), 0.5*(1 + drand48()), 0.5*(1 + drand48())),  0.5*drand48())));
                }
                else
                {
                    // glass
                    list.push_back(std::make_shared<sphere>(center, 0.2, std::make_shared<dielectric>(1.5)));
                }
            }
        }
    }
    std::shared_ptr<texture> _color_texture = std::make_shared<constant_texture>(vec3(4.0f, 4.0f, 4.0f));

    list.push_back(std::make_shared<sphere>(vec3(-4, 1, 2.0f), 1.0, std::make_shared<dielectric>(1.5)));
    //list.push_back(std::make_shared<sphere>(vec3(-4, 1, 0), 1.0, std::make_shared<lambertian>(vec3(0.4, 0.2, 0.1))));
    // list.push_back(std::make_shared<sphere>(vec3(-4, 1, 2.0f), 1.0, std::make_shared<lambertian>(_image_texture)));
    list.push_back(std::make_shared<sphere>(vec3(0, 1, 0), 1.0, std::make_shared<diffuse_light>(_color_texture)));
    list.push_back(std::make_shared<sphere>(vec3(4, 1, 0), 1.0, std::make_shared<metal>(vec3(0.7, 0.6, 0.5), 0.0)));

    //return std::make_shared<hitable_list>(list, list.size());

    // change to bvh
    return std::make_shared<bvh_node>(list, 0.0f, 1.0f);

    // using O(N) search ( hitable_list )
    // real    4m49.214s
    // user    13m57.995s
    // sys     0m7.843s
    //
    // using BVH
    // real    1m21.986s
    // user    4m50.992s
    // sys     0m4.199s
    //
    // using BVH and functors
    // real    1m18.025s
    // user    4m20.477s
    // sys     0m3.869s
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x1f5, %esi            # imm = 0x1F5
callq 0x7602
movq $0x0, 0x10(%rsp)
movl $0x28, %edi
callq 0x63f0
movabsq $0x100000001, %r14      # imm = 0x100000001
movq %r14, 0x8(%rax)
leaq 0x38c9b(%rip), %r15     # 0x4e470
movq %r15, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x3891a(%rip), %r12     # 0x4e100
addq $0x10, %r12
movq %r12, 0x10(%rax)
movsd 0x26cea(%rip), %xmm0    # 0x3c4e0
movsd %xmm0, 0x18(%rax)
movl $0x3dcccccd, 0x20(%rax) # imm = 0x3DCCCCCD
movq %rax, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq $0x0, (%rsp)
movl $0x28, %edi
callq 0x63f0
movq %r14, 0x8(%rax)
movq %r15, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, 0x10(%rax)
movsd 0x26cb8(%rip), %xmm0    # 0x3c4f0
movsd %xmm0, 0x18(%rax)
movl $0x3f666666, 0x20(%rax) # imm = 0x3F666666
movq %rsp, %r8
movq %rax, 0x8(%r8)
movq %rcx, (%r8)
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x21250
movups 0x20(%rsp), %xmm0
movups %xmm0, 0xf8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x15893
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x158a2
callq 0x7768
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x272f8(%rip), %rcx     # 0x3cbae
leaq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x2143e
movq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
movabsq $-0x3b86000000000000, %rax # imm = 0xC47A000000000000
movq %rax, 0x48(%rsp)
movl $0x0, 0x50(%rsp)
movl $0x3e8, 0x34(%rsp)      # imm = 0x3E8
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x60(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
callq 0x215a2
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0x48(%rsp), %r15
leaq 0x34(%rsp), %r8
movq %rsp, %r9
movq %r15, %rcx
callq 0x21706
movups 0x10(%rsp), %xmm0
leaq 0x20(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7c02
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1596d
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1597c
callq 0x7768
movq %r12, 0xd0(%rsp)
movq %rbx, 0xd8(%rsp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1599b
callq 0x7768
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
leaq 0x60(%rsp), %r14
leaq 0x39074(%rip), %rax     # 0x4ea20
addq $0x10, %rax
movq %rax, 0xc0(%rsp)
leaq 0x39099(%rip), %rax     # 0x4ea58
addq $0x10, %rax
movq %rax, 0xc8(%rsp)
leaq 0xa0(%rsp), %r12
leaq 0x10(%rsp), %rbx
movl %ecx, 0x94(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0xf0(%rsp)
movl $0xfffffff6, %r13d      # imm = 0xFFFFFFF6
callq 0x63a0
movsd %xmm0, 0x70(%rsp)
callq 0x63a0
movsd 0x26c0b(%rip), %xmm1    # 0x3c618
mulsd %xmm1, %xmm0
addsd 0xf0(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x80(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, 0x78(%rsp)
callq 0x63a0
mulsd 0x26bd6(%rip), %xmm0    # 0x3c618
addsd 0x78(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss 0x80(%rsp), %xmm2
movss %xmm2, 0x34(%rsp)
movl $0x3e4ccccd, 0x38(%rsp) # imm = 0x3E4CCCCD
movss %xmm0, 0x3c(%rsp)
addss 0x26a33(%rip), %xmm2    # 0x3c4a4
mulss %xmm2, %xmm2
xorpd %xmm1, %xmm1
addss %xmm1, %xmm2
mulss %xmm0, %xmm0
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jb 0x15a90
sqrtss %xmm0, %xmm0
jmp 0x15a95
callq 0x6710
cvtss2sd %xmm0, %xmm0
ucomisd 0x26b77(%rip), %xmm0    # 0x3c618
jbe 0x15f25
xorps %xmm0, %xmm0
cvtsd2ss 0x70(%rsp), %xmm0
movss 0x269f0(%rip), %xmm1    # 0x3c4a8
ucomiss %xmm0, %xmm1
jbe 0x15ccb
callq 0x63a0
movsd %xmm0, 0x80(%rsp)
callq 0x63a0
movsd %xmm0, 0x78(%rsp)
callq 0x63a0
movsd %xmm0, 0x70(%rsp)
callq 0x63a0
movsd %xmm0, 0xe8(%rsp)
callq 0x63a0
movsd %xmm0, 0x88(%rsp)
callq 0x63a0
movsd %xmm0, 0xe0(%rsp)
movl $0x28, %edi
callq 0x63f0
movq %r12, %rbx
movq %r14, %r12
leaq 0x34(%rsp), %r14
movsd 0x80(%rsp), %xmm0
mulsd 0x78(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0x70(%rsp), %xmm1
mulsd 0xe8(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movsd 0x88(%rsp), %xmm1
mulsd 0xe0(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x388f8(%rip), %rcx     # 0x4e470
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xd0(%rsp), %rdx
movq %rdx, 0x10(%rax)
movlps %xmm0, 0x18(%rax)
movss %xmm1, 0x20(%rax)
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x63a0
mulsd 0x26a72(%rip), %xmm0    # 0x3c620
cvtsd2ss %xmm0, %xmm0
movss 0x34(%rsp), %xmm1
xorps %xmm2, %xmm2
addss %xmm2, %xmm1
addss 0x38(%rsp), %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movss 0x3c(%rsp), %xmm0
addss %xmm2, %xmm0
movlps %xmm1, 0x60(%rsp)
movss %xmm0, 0x68(%rsp)
movl $0x0, 0x58(%rsp)
movl $0x3f800000, 0x9c(%rsp) # imm = 0x3F800000
movl $0x3e4ccccd, 0x98(%rsp) # imm = 0x3E4CCCCD
movq $0x0, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
leaq 0x5f(%rsp), %rbp
movq %rbp, %rdx
leaq 0x20(%rsp), %rcx
callq 0x215a2
movq $0x0, (%rsp)
subq $0x8, %rsp
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r12, %r14
movq %r12, %r8
leaq 0x60(%rsp), %r9
movq %r15, %rbp
pushq %r15
leaq 0xa8(%rsp), %rax
pushq %rax
leaq 0xb4(%rsp), %rax
pushq %rax
callq 0x21872
addq $0x20, %rsp
movups (%rsp), %xmm0
movups %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq %rbx, %r12
movq %rbx, %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x7c02
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x15c97
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
movq %rbp, %r15
je 0x15ca9
callq 0x7768
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x15cb8
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x15f25
jmp 0x15f20
movss 0x267d9(%rip), %xmm1    # 0x3c4ac
movabsq $0x3fc999999999999a, %rax # imm = 0x3FC999999999999A
ucomiss %xmm0, %xmm1
jbe 0x15e63
movq %rax, 0x48(%rsp)
callq 0x63a0
movsd %xmm0, 0x80(%rsp)
callq 0x63a0
movsd %xmm0, 0x70(%rsp)
callq 0x63a0
movsd %xmm0, 0x88(%rsp)
callq 0x63a0
movsd %xmm0, 0x78(%rsp)
movq $0x0, (%rsp)
movl $0x28, %edi
callq 0x63f0
movsd 0x268e9(%rip), %xmm2    # 0x3c620
movsd 0x78(%rsp), %xmm5
mulsd %xmm2, %xmm5
movsd 0x268bf(%rip), %xmm3    # 0x3c608
movsd 0x88(%rsp), %xmm0
addsd %xmm3, %xmm0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movsd 0x70(%rsp), %xmm1
addsd %xmm3, %xmm1
mulsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movsd 0x80(%rsp), %xmm4
addsd %xmm3, %xmm4
mulsd %xmm2, %xmm4
xorps %xmm2, %xmm2
cvtsd2ss %xmm4, %xmm2
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x388b3(%rip), %rcx     # 0x4e650
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
xorps %xmm3, %xmm3
cvtsd2ss %xmm5, %xmm3
movq 0xc0(%rsp), %rdx
movq %rdx, 0x10(%rax)
movss %xmm2, 0x18(%rax)
movss %xmm1, 0x1c(%rax)
movss %xmm0, 0x20(%rax)
movss 0x26457(%rip), %xmm0    # 0x3c228
minss %xmm3, %xmm0
cmpltss 0x266b2(%rip), %xmm3    # 0x3c490
andnps %xmm0, %xmm3
movss %xmm3, 0x24(%rax)
movq %rax, 0x8(%rsp)
movq %rcx, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
leaq 0x34(%rsp), %rcx
movq %r15, %r8
movq %rsp, %r9
callq 0x21a74
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
callq 0x7c02
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x15e41
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x15e50
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x15f25
jmp 0x15f20
movq %rax, 0x48(%rsp)
movq $0x0, (%rsp)
movl $0x20, %edi
callq 0x63f0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x38811(%rip), %rcx     # 0x4e6a0
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xc8(%rsp), %rdx
movq %rdx, 0x10(%rax)
movl $0x3fc00000, 0x18(%rax) # imm = 0x3FC00000
movq %rax, 0x8(%rsp)
movq %rcx, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
leaq 0x34(%rsp), %rcx
movq %r15, %r8
movq %rsp, %r9
callq 0x21bc4
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
callq 0x7c02
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x15f07
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x15f16
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x15f25
callq 0x7768
incl %r13d
cmpl $0xa, %r13d
jne 0x159f5
movl 0x94(%rsp), %ecx
incl %ecx
cmpl $0xa, %ecx
jne 0x159d8
movl $0x28, %edi
callq 0x63f0
movabsq $0x100000001, %r14      # imm = 0x100000001
movq %r14, 0x8(%rax)
leaq 0x3850d(%rip), %rcx     # 0x4e470
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xd0(%rsp), %rdx
movq %rdx, 0x10(%rax)
movsd 0x2657f(%rip), %xmm0    # 0x3c500
movsd %xmm0, 0x18(%rax)
movl $0x40800000, 0x20(%rax) # imm = 0x40800000
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movabsq $0x3f800000c0800000, %rax # imm = 0x3F800000C0800000
movq %rax, 0x34(%rsp)
movl $0x40000000, 0x3c(%rsp) # imm = 0x40000000
movabsq $0x3ff0000000000000, %rbx # imm = 0x3FF0000000000000
movq %rbx, 0x60(%rsp)
movq $0x0, 0x48(%rsp)
movl $0x20, %edi
callq 0x63f0
movq %r14, 0x8(%rax)
leaq 0x386c5(%rip), %rcx     # 0x4e6a0
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xc8(%rsp), %rdx
movq %rdx, 0x10(%rax)
movl $0x3fc00000, 0x18(%rax) # imm = 0x3FC00000
leaq 0x48(%rsp), %r9
movq %rax, 0x8(%r9)
movq %rcx, (%r9)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x58(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x21cb6
movups (%rsp), %xmm0
leaq 0x10(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7c02
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16057
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16066
callq 0x7768
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16075
callq 0x7768
movabsq $0x3f80000000000000, %rax # imm = 0x3F80000000000000
movq %rax, 0x34(%rsp)
movl $0x0, 0x3c(%rsp)
movq %rbx, 0x60(%rsp)
leaq 0x50(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x48(%rsp), %rsi
leaq 0x58(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x21da8
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x58(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x60(%rsp), %r8
leaq 0x48(%rsp), %r9
callq 0x21f0c
movups (%rsp), %xmm0
leaq 0x10(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7c02
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1610a
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16119
callq 0x7768
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16128
callq 0x7768
movabsq $0x3f80000040800000, %rax # imm = 0x3F80000040800000
movq %rax, 0x34(%rsp)
movl $0x0, 0x3c(%rsp)
movq %rbx, 0x60(%rsp)
movq $0x0, 0x48(%rsp)
movl $0x28, %edi
callq 0x63f0
movq %r14, 0x8(%rax)
leaq 0x384ee(%rip), %rcx     # 0x4e650
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq 0xc0(%rsp), %rdx
movq %rdx, 0x10(%rax)
movaps 0x26391(%rip), %xmm0    # 0x3c510
movups %xmm0, 0x18(%rax)
leaq 0x48(%rsp), %r9
movq %rax, 0x8(%r9)
movq %rcx, (%r9)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x58(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x60(%rsp), %r8
callq 0x21ffe
movq 0xd8(%rsp), %rbx
movups (%rsp), %xmm0
leaq 0x10(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7c02
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x161ea
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x161f9
callq 0x7768
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16208
callq 0x7768
movq %rsp, %r8
movl $0x0, (%r8)
leaq 0x48(%rsp), %r9
movl $0x3f800000, (%r9)      # imm = 0x3F800000
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x34(%rsp), %rdx
leaq 0xa0(%rsp), %rcx
callq 0x220f0
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x18(%rsp), %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x8(%rbx)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1626d
callq 0x7768
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1627c
callq 0x7768
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x1628e
callq 0x7768
leaq 0xa0(%rsp), %rdi
callq 0x7720
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x16354
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x162c7
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x162db
callq 0x7768
jmp 0x162db
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16357
jmp 0x1634d
jmp 0x16354
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x162fb
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1630f
callq 0x7768
jmp 0x1630f
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16357
jmp 0x1634d
jmp 0x16354
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1632f
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16343
callq 0x7768
jmp 0x16343
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x16357
callq 0x7768
jmp 0x16357
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x164a3
jmp 0x16499
jmp 0x164a0
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16381
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16395
callq 0x7768
jmp 0x16395
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x164a3
jmp 0x16499
jmp 0x164a0
movq %rax, %rbx
jmp 0x164b2
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x163cc
callq 0x7768
jmp 0x163cc
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x164c4
jmp 0x164bf
jmp 0x163e1
movq %rax, %rbx
jmp 0x164c4
movq %rax, %rbx
jmp 0x1640f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16400
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1640f
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x164a3
jmp 0x16499
jmp 0x164a0
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16433
callq 0x7768
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16449
callq 0x7768
jmp 0x16449
jmp 0x164a0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x164a3
jmp 0x16499
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16467
callq 0x7768
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1647b
callq 0x7768
jmp 0x1647b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1648f
callq 0x7768
jmp 0x1648f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x164a3
callq 0x7768
jmp 0x164a3
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x164b2
callq 0x7768
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x164c4
callq 0x7768
leaq 0xa0(%rsp), %rdi
callq 0x7720
movq %rbx, %rdi
callq 0x66e0