// File: sus304[P]ForRocket/src/environment/satmo1976.cpp
// Function: standardatmosphere1976::KineticTemperature(double)
double standardatmosphere1976::KineticTemperature(double geometric_altitude) {
    double z = geometric_altitude;

    double C1 = -76.3232;
    double C2 = 19.9429;
    double C3 = 12.0;
    double C4 = 0.01875;
    double TC = 263.1905;
    double T7 = 186.8673;
    double Z8 = 91.0;
    double Z9 = 110.0;  
    double T9 = 240.0;
    double Z10 = 120.0;
    double T10 = 360.0;
    double T12 = 1000.0;

    double t;
    double xx, yy;

    if (z <= Z8) {
        t = T7;
    } else if (z < Z9) {
        xx = (z - Z8) / C2;
        yy = std::sqrt(1.0 - xx * xx);
        t = TC + C1 * yy;
    } else if (z < Z10) {
        t = T9 + C3 * (z - Z9);
    } else {
        xx = (earth_radius + Z10) / (earth_radius + z);
        yy = (T12 - T10) * std::exp(-C4 * (z - Z10) * xx);
        t = T12 - yy;
    }
    return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x61b4e(%rip), %xmm0    # 0x97160
movsd %xmm0, -0x18(%rbp)
movsd 0x61b39(%rip), %xmm0    # 0x97158
movsd %xmm0, -0x20(%rbp)
movsd 0x61b24(%rip), %xmm0    # 0x97150
movsd %xmm0, -0x28(%rbp)
movsd 0x61b0f(%rip), %xmm0    # 0x97148
movsd %xmm0, -0x30(%rbp)
movsd 0x61afa(%rip), %xmm0    # 0x97140
movsd %xmm0, -0x38(%rbp)
movsd 0x61ae5(%rip), %xmm0    # 0x97138
movsd %xmm0, -0x40(%rbp)
movsd 0x61ad0(%rip), %xmm0    # 0x97130
movsd %xmm0, -0x48(%rbp)
movsd 0x61abb(%rip), %xmm0    # 0x97128
movsd %xmm0, -0x50(%rbp)
movsd 0x61aa6(%rip), %xmm0    # 0x97120
movsd %xmm0, -0x58(%rbp)
movsd 0x61a91(%rip), %xmm0    # 0x97118
movsd %xmm0, -0x60(%rbp)
movsd 0x61a7c(%rip), %xmm0    # 0x97110
movsd %xmm0, -0x68(%rbp)
movsd 0x61977(%rip), %xmm0    # 0x97018
movsd %xmm0, -0x70(%rbp)
movsd -0x10(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x356c5
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x35817
movsd -0x10(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x3574b
movsd -0x10(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
divsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x5ff22(%rip), %xmm1    # 0x95638
addsd %xmm1, %xmm0
callq 0x6370
movsd %xmm0, -0x88(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
movsd -0x88(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x35815
movsd -0x10(%rbp), %xmm1
movsd -0x60(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x35781
movsd -0x58(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
movsd -0x10(%rbp), %xmm2
subsd -0x50(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x35813
movsd 0xaed2f(%rip), %xmm0    # 0xe44b8
addsd -0x60(%rbp), %xmm0
movsd 0xaed22(%rip), %xmm1    # 0xe44b8
addsd -0x10(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x70(%rbp), %xmm0
subsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x30(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0x10(%rbp), %xmm1
subsd -0x60(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd -0x80(%rbp), %xmm0
callq 0x6790
movaps %xmm0, %xmm1
movsd -0x90(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x70(%rbp), %xmm0
subsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x35815
jmp 0x35817
movsd -0x78(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop