// File: /workspace/github_cpp_makefile_star2_O1/istellartech[P]OpenTsiolkovsky/src/air.cpp
// Function: Air::altitude(double)
Air Air::altitude(double altitude){
    Air air;
    if ( altitude > HAL[0] && altitude < HAL[1] ){
        k = 0;
    } else if ( altitude >= HAL[1] && altitude < HAL[2] ){
        k = 1;
    } else if ( altitude >= HAL[2] && altitude < HAL[3] ){
        k = 2;
    } else if ( altitude >= HAL[3] && altitude < HAL[4] ){
        k = 3;
    } else if ( altitude >= HAL[4] && altitude < HAL[5] ){
        k = 4;
    } else if ( altitude >= HAL[5] && altitude < HAL[6] ){
        k = 5;
    } else if ( altitude >= HAL[6] && altitude < HAL[7] ){
        k = 6;
    } else if ( altitude >= HAL[7]){
        k = 7;
    } else {
        k = 0;
    }

    air.temperature = air.T0[k] + air.LR[k] * (altitude - air.HAL[k]);
    air.airspeed = sqrt(air.temperature * air.gamma * air.R);
    if (air.LR[k] != 0){
        air.pressure = air.P0[k] * pow(((T0[k] + LR[k] *(altitude - air.HAL[k])) / air.T0[k]) ,
                                       (air.g / -air.LR[k] / air.R));
    } else {
        air.pressure = air.P0[k] * exp(air.g / air.R * (air.HAL[k] - altitude) / air.T0[k]);
    }
    air.density = air.pressure / R / air.temperature;
    return air;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movapd %xmm0, %xmm2
movq %rsi, %r14
movq %rdi, %rbx
movabsq $0x40239cf41f212d77, %rax # imm = 0x40239CF41F212D77
movq %rax, (%rdi)
movabsq $0x3ff6666666666666, %rax # imm = 0x3FF6666666666666
movq %rax, 0x8(%rdi)
movabsq $0x4071f0d97f62b6ae, %rax # imm = 0x4071F0D97F62B6AE
movq %rax, 0x10(%rdi)
movups 0x21c33(%rip), %xmm0    # 0x277c0
movups %xmm0, 0x18(%rdi)
movups 0x21c38(%rip), %xmm0    # 0x277d0
movups %xmm0, 0x28(%rdi)
movups 0x2165d(%rip), %xmm0    # 0x27200
movups %xmm0, 0x38(%rdi)
movups 0x21662(%rip), %xmm0    # 0x27210
movups %xmm0, 0x48(%rdi)
movups 0x21667(%rip), %xmm0    # 0x27220
movups %xmm0, 0x58(%rdi)
movups 0x2166c(%rip), %xmm0    # 0x27230
movups %xmm0, 0x68(%rdi)
movups 0x21671(%rip), %xmm0    # 0x27240
movups %xmm0, 0x78(%rdi)
movups 0x21676(%rip), %xmm0    # 0x27250
movups %xmm0, 0x88(%rdi)
movups 0x21678(%rip), %xmm0    # 0x27260
movups %xmm0, 0x98(%rdi)
movups 0x2167a(%rip), %xmm0    # 0x27270
movups %xmm0, 0xa8(%rdi)
movups 0x216ac(%rip), %xmm0    # 0x272b0
movups %xmm0, 0xe8(%rdi)
movups 0x2168e(%rip), %xmm0    # 0x272a0
movups %xmm0, 0xd8(%rdi)
movups 0x21670(%rip), %xmm0    # 0x27290
movups %xmm0, 0xc8(%rdi)
movups 0x21652(%rip), %xmm0    # 0x27280
movups %xmm0, 0xb8(%rdi)
movl $0x0, 0xf8(%rdi)
movabsq $0x4072c00000000000, %rax # imm = 0x4072C00000000000
movq %rax, 0x100(%rdi)
movabsq $0x4092c00000000000, %rax # imm = 0x4092C00000000000
movq %rax, 0x108(%rdi)
movabsq $0x40f8bb4000000000, %rax # imm = 0x40F8BB4000000000
movq %rax, 0x110(%rdi)
movabsq $0x3ff3333333333333, %rax # imm = 0x3FF3333333333333
movq %rax, 0x118(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsi), %xmm0
ucomisd %xmm0, %xmm2
jbe 0x5ca4
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
ucomisd %xmm2, %xmm0
ja 0x5dc2
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5cd2
xorps %xmm0, %xmm0
cvtsi2sdl 0x20(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5cd2
movl $0x1, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x20(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5d00
xorps %xmm0, %xmm0
cvtsi2sdl 0x24(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5d00
movl $0x2, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x24(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5d2e
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5d2e
movl $0x3, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5d59
xorps %xmm0, %xmm0
cvtsi2sdl 0x2c(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5d59
movl $0x4, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x2c(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5d84
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5d84
movl $0x5, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%r14), %xmm0
ucomisd %xmm0, %xmm2
jb 0x5daf
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r14), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x5daf
movl $0x6, 0xf8(%r14)
jmp 0x5dcd
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r14), %xmm0
ucomisd %xmm0, %xmm2
jae 0x5ef8
movl $0x0, 0xf8(%r14)
movslq 0xf8(%r14), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rbx,%rax,4), %xmm0
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
mulsd 0x38(%rbx,%rax,8), %xmm1
addsd 0x78(%rbx,%rax,8), %xmm1
movsd %xmm1, 0x100(%rbx)
movsd 0x8(%rbx), %xmm0
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
mulsd 0x211f8(%rip), %xmm0    # 0x27008
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x5e20
sqrtsd %xmm0, %xmm0
jmp 0x5e35
movsd %xmm2, 0x8(%rsp)
callq 0x52e0
xorpd %xmm3, %xmm3
movsd 0x8(%rsp), %xmm2
movsd %xmm0, 0x108(%rbx)
movslq 0xf8(%r14), %rax
movsd 0x38(%rbx,%rax,8), %xmm0
movsd 0xb8(%rbx,%rax,8), %xmm1
movsd %xmm1, 0x8(%rsp)
ucomisd %xmm3, %xmm0
jne 0x5e61
jnp 0x5ea2
xorps %xmm1, %xmm1
cvtsi2sdl 0x18(%rbx,%rax,4), %xmm1
subsd %xmm1, %xmm2
mulsd 0x38(%r14,%rax,8), %xmm2
addsd 0x78(%r14,%rax,8), %xmm2
divsd 0x78(%rbx,%rax,8), %xmm2
xorpd 0x21196(%rip), %xmm0    # 0x27020
movsd (%rbx), %xmm1
divsd %xmm0, %xmm1
divsd 0x10(%rbx), %xmm1
movapd %xmm2, %xmm0
callq 0x5640
jmp 0x5ec7
movsd (%rbx), %xmm1
divsd 0x10(%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rbx,%rax,4), %xmm0
subsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
divsd 0x78(%rbx,%rax,8), %xmm0
callq 0x5660
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x110(%rbx)
divsd 0x10(%r14), %xmm1
divsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x118(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movl $0x7, 0xf8(%r14)
jmp 0x5dcd