// File: /workspace/github_cpp_makefile_star2_O3/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
movaps 0x1f4ac(%rip), %xmm0    # 0x25010
movups %xmm0, (%rdi)
movabsq $0x4071f0d97f62b6ae, %rax # imm = 0x4071F0D97F62B6AE
movq %rax, 0x10(%rdi)
movups 0x1fc84(%rip), %xmm0    # 0x25800
movups %xmm0, 0x18(%rdi)
movups 0x1fc89(%rip), %xmm0    # 0x25810
movups %xmm0, 0x28(%rdi)
movups 0x1f6ae(%rip), %xmm0    # 0x25240
movups %xmm0, 0x38(%rdi)
movups 0x1f6b3(%rip), %xmm0    # 0x25250
movups %xmm0, 0x48(%rdi)
movups 0x1f6b8(%rip), %xmm0    # 0x25260
movups %xmm0, 0x58(%rdi)
movups 0x1f6bd(%rip), %xmm0    # 0x25270
movups %xmm0, 0x68(%rdi)
movups 0x1f6c2(%rip), %xmm0    # 0x25280
movups %xmm0, 0x78(%rdi)
movups 0x1f6c7(%rip), %xmm0    # 0x25290
movups %xmm0, 0x88(%rdi)
movups 0x1f6c9(%rip), %xmm0    # 0x252a0
movups %xmm0, 0x98(%rdi)
movups 0x1f6cb(%rip), %xmm0    # 0x252b0
movups %xmm0, 0xa8(%rdi)
movups 0x1f6fd(%rip), %xmm0    # 0x252f0
movups %xmm0, 0xe8(%rdi)
movups 0x1f6df(%rip), %xmm0    # 0x252e0
movups %xmm0, 0xd8(%rdi)
movups 0x1f6c1(%rip), %xmm0    # 0x252d0
movups %xmm0, 0xc8(%rdi)
movups 0x1f6a3(%rip), %xmm0    # 0x252c0
movups %xmm0, 0xb8(%rdi)
movl $0x0, 0xf8(%rdi)
movaps 0x1f3eb(%rip), %xmm0    # 0x25020
movups %xmm0, 0x110(%rdi)
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsi), %xmm0
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%rsi), %xmm0
jbe 0x5c6a
ucomisd %xmm2, %xmm0
jbe 0x5c6a
movl $0x0, 0xf8(%r14)
xorl %eax, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x20(%r14), %xmm0
jb 0x5c94
ucomisd %xmm2, %xmm0
jbe 0x5c94
movl $0x1, 0xf8(%r14)
movl $0x1, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x24(%r14), %xmm0
jb 0x5cbe
ucomisd %xmm2, %xmm0
jbe 0x5cbe
movl $0x2, 0xf8(%r14)
movl $0x2, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%r14), %xmm0
jb 0x5ce8
ucomisd %xmm2, %xmm0
jbe 0x5ce8
movl $0x3, 0xf8(%r14)
movl $0x3, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x2c(%r14), %xmm0
jb 0x5d0f
ucomisd %xmm2, %xmm0
jbe 0x5d0f
movl $0x4, 0xf8(%r14)
movl $0x4, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%r14), %xmm0
jb 0x5d36
ucomisd %xmm2, %xmm0
jbe 0x5d36
movl $0x5, 0xf8(%r14)
movl $0x5, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r14), %xmm0
jb 0x5d5d
ucomisd %xmm2, %xmm0
jbe 0x5d5d
movl $0x6, 0xf8(%r14)
movl $0x6, %eax
jmp 0x5d77
ucomisd %xmm0, %xmm2
jb 0x5c58
movl $0x7, 0xf8(%r14)
movl $0x7, %eax
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 0x1f2b4(%rip), %xmm0    # 0x25050
mulsd %xmm1, %xmm0
mulsd 0x1f2b0(%rip), %xmm0    # 0x25058
movsd %xmm1, 0x10(%rsp)
movsd %xmm1, 0x100(%rbx)
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jb 0x5dc6
sqrtsd %xmm0, %xmm0
jmp 0x5ddb
movsd %xmm2, 0x8(%rsp)
callq 0x52e0
xorpd %xmm3, %xmm3
movsd 0x8(%rsp), %xmm2
leaq 0x18(%rbx), %rdx
leaq 0x78(%rbx), %rax
movsd %xmm0, 0x108(%rbx)
movslq 0xf8(%r14), %rcx
movsd 0x38(%rbx,%rcx,8), %xmm0
movsd 0xb8(%rbx,%rcx,8), %xmm1
movsd %xmm1, 0x8(%rsp)
ucomisd %xmm3, %xmm0
jne 0x5e0f
jnp 0x5e4d
xorps %xmm1, %xmm1
cvtsi2sdl (%rdx,%rcx,4), %xmm1
subsd %xmm1, %xmm2
mulsd 0x38(%r14,%rcx,8), %xmm2
addsd 0x78(%r14,%rcx,8), %xmm2
divsd (%rax,%rcx,8), %xmm2
movsd 0x1f232(%rip), %xmm1    # 0x25068
divsd %xmm0, %xmm1
divsd 0x1f216(%rip), %xmm1    # 0x25058
movapd %xmm2, %xmm0
callq 0x5640
jmp 0x5e6b
xorps %xmm0, %xmm0
cvtsi2sdl (%rdx,%rcx,4), %xmm0
subsd %xmm2, %xmm0
mulsd 0x1f1ff(%rip), %xmm0    # 0x25060
divsd (%rax,%rcx,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