// File: /workspace/github_cpp_makefile_star2_O1/sus304[P]ForRocket/src/factory/rocket_stage_factory.cpp
// Function: forrocket::RocketStageFactory::Create(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
forrocket::RocketStage forrocket::RocketStageFactory::Create(const int stage_number,
                                                                std::string rocket_config_json_file, 
                                                                std::string engine_config_json_file,
                                                                std::string sequence_of_event_json_file) {
    
    RocketFactory rocket_factory;
    RocketStage rocket_stage(stage_number, rocket_factory.Create(rocket_config_json_file, engine_config_json_file));

    JsonControl jc(sequence_of_event_json_file);

    rocket_stage.time_start = jc.getDouble("Flight Start Time [s]");
    rocket_stage.time_ignittion = jc.getDouble("Engine Ignittion Time [s]");

    rocket_stage.enable_launcher = jc.getBool("Enable Rail-Launcher Launch");
    if (rocket_stage.enable_launcher) {
        rocket_stage.length_launcher_rail = jc.getSubItem("Rail Launcher").getDouble("Length [m]");
    }
    
    rocket_stage.enable_cutoff = jc.getBool("Enable Engine Cutoff");
    if (rocket_stage.enable_cutoff) {
        rocket_stage.time_cutoff = jc.getSubItem("Cutoff").getDouble("Cutoff Time [s]");
        rocket_stage.rocket.engine.burn_duration = rocket_stage.time_cutoff;
    }
    
    rocket_stage.enable_program_attitude = jc.getBool("Enable Program Attitude");
    if (rocket_stage.enable_program_attitude) {
        auto jc_attitude_control = jc.getSubItem("Attitude Control");
        rocket_stage.time_start_attitude_controll = jc_attitude_control.getDouble("Start Time [s]");
        rocket_stage.time_end_attitude_controll = jc_attitude_control.getDouble("End Time [s]");
    }

    rocket_stage.enable_sepation = jc.getBool("Enable Stage Separation");
    if (rocket_stage.enable_sepation) {
        auto jc_separation = jc.getSubItem("Upper Stage");
        rocket_stage.time_separation = jc_separation.getDouble("Stage Separation Time [s]");
        rocket_stage.mass_upper_stage = jc_separation.getDouble("Upper Stage Mass [kg]");
    }

    rocket_stage.enable_despin = jc.getBool("Enable Despin Control");
    if (rocket_stage.enable_despin) {
        rocket_stage.time_despin = jc.getSubItem("Despin").getDouble("Time [s]");
    }

    rocket_stage.enable_fairing_jettson = jc.getBool("Enable Fairing Jettson");
    if (rocket_stage.enable_fairing_jettson) {
        auto jc_fairing_jettson = jc.getSubItem("Fairing");
        rocket_stage.time_jettson_fairing = jc_fairing_jettson.getDouble("Jettson Time [s]");
        rocket_stage.mass_fairing = jc_fairing_jettson.getDouble("Mass [s]");
    }

    rocket_stage.enable_parachute_open = jc.getBool("Enable Parachute Open");
    if (rocket_stage.enable_parachute_open) {
        auto jc_parachute = jc.getSubItem("Parachute");
        rocket_stage.enable_apogee_parachute_open = jc_parachute.getDouble("Enable Forced Apogee Open");
        rocket_stage.time_open_parachute = jc_parachute.getDouble("Open Time [s]");
    }

    rocket_stage.exist_second_parachute = jc.getBool("Enable Secondary Parachute Open");
    if (rocket_stage.exist_second_parachute) {
        auto jc_secondary_parachute = jc.getSubItem("Secondary Parachute");
        rocket_stage.time_open_second_parachute = jc_secondary_parachute.getDouble("Open Time [s]");
    }
    
    if (jc.getBool("Enable Auto Terminate SubOrbital Flight")) {
        double safety_factor = 1.4;
        rocket_stage.time_end = safety_factor * std::abs(60.0 * std::log(rocket_stage.rocket.engine.total_impulse) - 410.0);        
    } else {
        rocket_stage.time_end = jc.getDouble("Flight End Time [s]");
    }
    // rocket_stage.time_step = std::pow(10.0, std::floor((int)std::log10((int)rocket_stage.time_end)+1) - 5);
    rocket_stage.time_step = jc.getDouble("Time Step [s]");
    
    return rocket_stage;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1328, %rsp           # imm = 0x1328
movq %r9, %r14
movq %r8, %r15
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x4a0(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq 0x490(%rsp), %rdi
callq 0x7f1c
leaq 0x480(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x470(%rsp), %rdi
callq 0x7f1c
leaq 0x4b0(%rsp), %rdi
leaq 0x2f(%rsp), %rsi
leaq 0x490(%rsp), %rdx
leaq 0x470(%rsp), %rcx
callq 0x272cc
leaq 0x4b0(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2e4f4
leaq 0x4b0(%rsp), %rdi
callq 0x2c6b0
movq 0x470(%rsp), %rdi
cmpq %r13, %rdi
je 0x2cea5
movq 0x480(%rsp), %rsi
incq %rsi
callq 0x5350
movq 0x490(%rsp), %rdi
cmpq %r12, %rdi
je 0x2cec2
movq 0x4a0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x460(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x450(%rsp), %rdi
callq 0x7f1c
leaq 0x18(%rsp), %rdi
leaq 0x450(%rsp), %rsi
callq 0x800c
movq 0x450(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cf14
movq 0x460(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x440(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x100c9(%rip), %rsi     # 0x3cff0
leaq 0x100d7(%rip), %rdx     # 0x3d005
leaq 0x430(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x430(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1150(%rbx)
movq 0x430(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cf72
movq 0x440(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x420(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10081(%rip), %rsi     # 0x3d006
leaq 0x10093(%rip), %rdx     # 0x3d01f
leaq 0x410(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x410(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1158(%rbx)
movq 0x410(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cfd0
movq 0x420(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x400(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1003d(%rip), %rsi     # 0x3d020
leaq 0x10051(%rip), %rdx     # 0x3d03b
leaq 0x3f0(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x81d0
movb %al, 0x1160(%rbx)
movq 0x3f0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d02c
movq 0x400(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x1160(%rbx)
jne 0x2d10b
leaq 0x3e0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfff0(%rip), %rsi      # 0x3d03c
leaq 0xfff6(%rip), %rdx      # 0x3d049
leaq 0x3d0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x3d0(%rsp), %rdx
callq 0x81f2
leaq 0x3c0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xffbf(%rip), %rsi      # 0x3d04a
leaq 0xffc2(%rip), %rdx      # 0x3d054
leaq 0x3b0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1168(%rbx)
movq 0x3b0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d0d6
movq 0x3c0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
movq 0x3d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d10b
movq 0x3e0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x3a0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xff37(%rip), %rsi      # 0x3d055
leaq 0xff44(%rip), %rdx      # 0x3d069
leaq 0x390(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x81d0
movb %al, 0x1170(%rbx)
movq 0x390(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d167
movq 0x3a0(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x1170(%rbx)
jne 0x2d253
leaq 0x380(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfedc(%rip), %rsi      # 0x3d063
leaq 0xfedb(%rip), %rdx      # 0x3d069
leaq 0x370(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x370(%rsp), %rdx
callq 0x81f2
leaq 0x360(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xfea4(%rip), %rsi      # 0x3d06a
leaq 0xfeac(%rip), %rdx      # 0x3d079
leaq 0x350(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x350(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1178(%rbx)
movq 0x350(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d211
movq 0x360(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
movq 0x370(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d246
movq 0x380(%rsp), %rsi
incq %rsi
callq 0x5350
movsd 0x1178(%rbx), %xmm0
movsd %xmm0, 0x60(%rbx)
leaq 0x340(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfa56(%rip), %rsi      # 0x3ccbc
leaq 0xfa66(%rip), %rdx      # 0x3ccd3
leaq 0x330(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x330(%rsp), %rsi
callq 0x81d0
movb %al, 0x1180(%rbx)
movq 0x330(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d2af
movq 0x340(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x1180(%rbx)
jne 0x2d3eb
leaq 0x320(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfdab(%rip), %rsi      # 0x3d07a
leaq 0xfdb4(%rip), %rdx      # 0x3d08a
leaq 0x310(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x310(%rsp), %rdx
callq 0x81f2
movq 0x310(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d317
movq 0x320(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x300(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfccd(%rip), %rsi      # 0x3cff7
leaq 0xfcd4(%rip), %rdx      # 0x3d005
leaq 0x2f0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1188(%rbx)
movq 0x2f0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d375
movq 0x300(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x2e0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfe4e(%rip), %rsi      # 0x3d1d6
leaq 0xfe53(%rip), %rdx      # 0x3d1e2
leaq 0x2d0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1190(%rbx)
movq 0x2d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d3d3
movq 0x2e0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
leaq 0x2c0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfc8d(%rip), %rsi      # 0x3d08b
leaq 0xfc9d(%rip), %rdx      # 0x3d0a2
leaq 0x2b0(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x81d0
movb %al, 0x1198(%rbx)
movq 0x2b0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d447
movq 0x2c0(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x1198(%rbx)
jne 0x2d583
leaq 0x2a0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfc3c(%rip), %rsi      # 0x3d0a3
leaq 0xfc40(%rip), %rdx      # 0x3d0ae
leaq 0x290(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x290(%rsp), %rdx
callq 0x81f2
movq 0x290(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d4af
movq 0x2a0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x280(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfbed(%rip), %rsi      # 0x3d0af
leaq 0xfbff(%rip), %rdx      # 0x3d0c8
leaq 0x270(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11a0(%rbx)
movq 0x270(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d50d
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x260(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfba9(%rip), %rsi      # 0x3d0c9
leaq 0xfbb7(%rip), %rdx      # 0x3d0de
leaq 0x250(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11a8(%rbx)
movq 0x250(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d56b
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
leaq 0x240(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfb49(%rip), %rsi      # 0x3d0df
leaq 0xfb57(%rip), %rdx      # 0x3d0f4
leaq 0x230(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x81d0
movb %al, 0x11b0(%rbx)
movq 0x230(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d5df
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x11b0(%rbx)
jne 0x2d6be
leaq 0x220(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfaf6(%rip), %rsi      # 0x3d0f5
leaq 0xfaf5(%rip), %rdx      # 0x3d0fb
leaq 0x210(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x210(%rsp), %rdx
callq 0x81f2
leaq 0x200(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xfb9c(%rip), %rsi      # 0x3d1da
leaq 0xfb9d(%rip), %rdx      # 0x3d1e2
leaq 0x1f0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11b8(%rbx)
movq 0x1f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2d689
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
movq 0x210(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d6be
movq 0x220(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x1e0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xfa2b(%rip), %rsi      # 0x3d0fc
leaq 0xfa3a(%rip), %rdx      # 0x3d112
leaq 0x1d0(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x81d0
movb %al, 0x11c0(%rbx)
movq 0x1d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d71a
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x11c0(%rbx)
jne 0x2d856
leaq 0x1c0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf9d9(%rip), %rsi      # 0x3d113
leaq 0xf9d9(%rip), %rdx      # 0x3d11a
leaq 0x1b0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x1b0(%rsp), %rdx
callq 0x81f2
movq 0x1b0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d782
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x1a0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf986(%rip), %rsi      # 0x3d11b
leaq 0xf98f(%rip), %rdx      # 0x3d12b
leaq 0x190(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11c8(%rbx)
movq 0x190(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d7e0
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x180(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf939(%rip), %rsi      # 0x3d12c
leaq 0xf93a(%rip), %rdx      # 0x3d134
leaq 0x170(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11d0(%rbx)
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d83e
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
leaq 0x160(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf8cc(%rip), %rsi      # 0x3d135
leaq 0xf8da(%rip), %rdx      # 0x3d14a
leaq 0x150(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x81d0
movb %al, 0x11d8(%rbx)
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d8b2
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x11d8(%rbx)
jne 0x2d9fc
leaq 0x140(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf8cb(%rip), %rsi      # 0x3d19d
leaq 0xf8cd(%rip), %rdx      # 0x3d1a6
leaq 0x130(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x81f2
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d91a
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x120(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf81e(%rip), %rsi      # 0x3d14b
leaq 0xf830(%rip), %rdx      # 0x3d164
leaq 0x110(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x81ac
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setp %al
setne %cl
orb %al, %cl
movb %cl, 0x11d9(%rbx)
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d986
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x100(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf7cc(%rip), %rsi      # 0x3d165
leaq 0xf7d2(%rip), %rdx      # 0x3d172
leaq 0xf0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11e0(%rbx)
movq 0xf0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2d9e4
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
leaq 0xe0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf764(%rip), %rsi      # 0x3d173
leaq 0xf77c(%rip), %rdx      # 0x3d192
leaq 0xd0(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x81d0
movb %al, 0x11e8(%rbx)
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2da58
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x5350
cmpb $0x1, 0x11e8(%rbx)
jne 0x2db36
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf71b(%rip), %rsi      # 0x3d193
leaq 0xf727(%rip), %rdx      # 0x3d1a6
leaq 0xb0(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x81f2
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2dac0
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0xa0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf692(%rip), %rsi      # 0x3d165
leaq 0xf698(%rip), %rdx      # 0x3d172
leaq 0x90(%rsp), %rdi
callq 0x92e2
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11f0(%rbx)
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x2db1e
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x8(%rsp), %rdi
callq 0x860c
leaq 0x10(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf65e(%rip), %rsi      # 0x3d1a7
leaq 0xf67e(%rip), %rdx      # 0x3d1ce
leaq 0x70(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x81d0
movl %eax, %ebp
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x2db85
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5350
testb %bpl, %bpl
je 0x2dbbe
movsd 0x78(%rbx), %xmm0
callq 0x52c0
mulsd 0xcf3c(%rip), %xmm0     # 0x3aad8
addsd 0xf43c(%rip), %xmm0     # 0x3cfe0
andpd 0xd5e4(%rip), %xmm0     # 0x3b190
mulsd 0xf434(%rip), %xmm0     # 0x3cfe8
movsd %xmm0, 0x11f8(%rbx)
jmp 0x2dc0d
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf601(%rip), %rsi      # 0x3d1cf
leaq 0xf60d(%rip), %rdx      # 0x3d1e2
leaq 0x50(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x11f8(%rbx)
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x2dc0d
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xf5c6(%rip), %rsi      # 0x3d1e3
leaq 0xf5cc(%rip), %rdx      # 0x3d1f0
leaq 0x30(%rsp), %rdi
callq 0x92e2
leaq 0x18(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x81ac
movsd %xmm0, 0x1200(%rbx)
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x2dc5c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5350
leaq 0x18(%rsp), %rdi
callq 0x860c
leaq 0x20(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x86ae
movq %rbx, %rax
addq $0x1328, %rsp           # imm = 0x1328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x60(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0xa0(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0xc0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0xf0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x100(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x120(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x140(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x170(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x180(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x190(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x1a0(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x1b0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x1c0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x1f0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ddfe
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2ddfe
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x272b0
jmp 0x2de0d
movq %rax, %r14
movq 0x210(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x220(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x250(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x260(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x270(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x280(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x290(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x2a0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x2d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x2e0(%rsp), %rsi
jmp 0x2dec9
jmp 0x2ded3
movq %rax, %r14
movq 0x2f0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ded6
movq 0x300(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2ded6
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x272b0
jmp 0x2e153
movq %rax, %r14
movq 0x310(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x320(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x350(%rsp), %rdi
cmpq %r12, %rdi
je 0x2df30
movq 0x360(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2df30
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x272b0
jmp 0x2df3f
movq %rax, %r14
movq 0x370(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x380(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x3b0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2df87
movq 0x3c0(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2df87
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x272b0
jmp 0x2df96
movq %rax, %r14
movq 0x3d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x3e0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x40(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x80(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0xe0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x160(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x1d0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x1e0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x230(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x240(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x2b0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x2c0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x330(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x340(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x390(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x3a0(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x3f0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x400(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x410(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x420(%rsp), %rsi
jmp 0x2e146
jmp 0x2e150
movq %rax, %r14
movq 0x430(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e153
movq 0x440(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2e153
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x272b0
leaq 0xe80(%rbx), %rdi
callq 0x2e1fe
addq $0x10, %rbx
movq %rbx, %rdi
callq 0x2c6b0
movq %r14, %rdi
callq 0x55e0
movq %rax, %r14
movq 0x450(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e15d
movq 0x460(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2e15d
movq %rax, %r14
jmp 0x2e15d
movq %rax, %r14
leaq 0x4b0(%rsp), %rdi
callq 0x2c6b0
jmp 0x2e1b9
movq %rax, %r14
movq 0x470(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e1db
movq 0x480(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2e1db
movq %rax, %r14
movq 0x490(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e175
movq 0x4a0(%rsp), %rsi
incq %rsi
callq 0x5350
jmp 0x2e175
nop