// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movsd %xmm0, (%rsp)
movq %rsi, %r14
movq %rdi, %rbx
callq 0x634e
movsd (%rsp), %xmm2
cvtsi2sdl 0x18(%r14), %xmm0
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x1c(%r14), %xmm0
jbe 0x59bc
ucomisd %xmm2, %xmm0
jbe 0x59bc
andl $0x0, 0xf8(%r14)
xorl %eax, %eax
jmp 0x5aa0
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x20(%r14), %xmm0
jb 0x59e0
ucomisd %xmm2, %xmm0
jbe 0x59e0
movl $0x1, 0xf8(%r14)
pushq $0x1
jmp 0x5a9f
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x24(%r14), %xmm0
jb 0x5a04
ucomisd %xmm2, %xmm0
jbe 0x5a04
movl $0x2, 0xf8(%r14)
pushq $0x2
jmp 0x5a9f
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x28(%r14), %xmm0
jb 0x5a25
ucomisd %xmm2, %xmm0
jbe 0x5a25
movl $0x3, 0xf8(%r14)
pushq $0x3
jmp 0x5a9f
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x2c(%r14), %xmm0
jb 0x5a46
ucomisd %xmm2, %xmm0
jbe 0x5a46
movl $0x4, 0xf8(%r14)
pushq $0x4
jmp 0x5a9f
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x30(%r14), %xmm0
jb 0x5a67
ucomisd %xmm2, %xmm0
jbe 0x5a67
movl $0x5, 0xf8(%r14)
pushq $0x5
jmp 0x5a9f
ucomisd %xmm0, %xmm2
cvtsi2sdl 0x34(%r14), %xmm0
jb 0x5a88
ucomisd %xmm2, %xmm0
jbe 0x5a88
movl $0x6, 0xf8(%r14)
pushq $0x6
jmp 0x5a9f
ucomisd %xmm0, %xmm2
jb 0x59ad
movl $0x7, 0xf8(%r14)
pushq $0x7
popq %rax
cvtsi2sdl 0x18(%rbx,%rax,4), %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
mulsd 0x38(%rbx,%rax,8), %xmm0
addsd 0x78(%rbx,%rax,8), %xmm0
movsd %xmm0, 0x100(%rbx)
mulsd 0x8(%rbx), %xmm0
mulsd 0x10(%rbx), %xmm0
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x5adc
sqrtsd %xmm0, %xmm0
jmp 0x5aea
callq 0x52e0
xorpd %xmm3, %xmm3
movsd (%rsp), %xmm2
movsd %xmm0, 0x108(%rbx)
movslq 0xf8(%r14), %rax
movsd 0x38(%rbx,%rax,8), %xmm0
movsd 0xb8(%rbx,%rax,8), %xmm1
movsd %xmm1, (%rsp)
ucomisd %xmm3, %xmm0
jne 0x5b15
jnp 0x5b53
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 0x194d5(%rip), %xmm0    # 0x1f010
movsd (%rbx), %xmm1
divsd %xmm0, %xmm1
divsd 0x10(%rbx), %xmm1
movapd %xmm2, %xmm0
callq 0x5630
jmp 0x5b75
movsd (%rbx), %xmm1
divsd 0x10(%rbx), %xmm1
cvtsi2sdl 0x18(%rbx,%rax,4), %xmm0
subsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
divsd 0x78(%rbx,%rax,8), %xmm0
callq 0x5650
movsd (%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x110(%rbx)
divsd 0x10(%r14), %xmm1
divsd 0x100(%rbx), %xmm1
movsd %xmm1, 0x118(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop