// File: /workspace/github_c_makefile_star2_O1/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioTimeOnAir
uint32_t RadioTimeOnAir( RadioModems_t modem, uint32_t bandwidth,
                              uint32_t datarate, uint8_t coderate,
                              uint16_t preambleLen, bool fixLen, uint8_t payloadLen,
                              bool crcOn )
{
    uint32_t numerator = 0;
    uint32_t denominator = 1;

    switch( modem )
    {
    case MODEM_FSK:
        {
            numerator   = 1000U * RadioGetGfskTimeOnAirNumerator( datarate, coderate,
                                                                  preambleLen, fixLen,
                                                                  payloadLen, crcOn );
            denominator = datarate;
        }
        break;
    case MODEM_LORA:
        {
            numerator   = 1000U * RadioGetLoRaTimeOnAirNumerator( bandwidth, datarate,
                                                                  coderate, preambleLen,
                                                                  fixLen, payloadLen, crcOn );
            denominator = RadioGetLoRaBandwidthInHz( Bandwidths[bandwidth] );
        }
        break;
    }
    // Perform integral ceil()
    return ( numerator + denominator - 1 ) / denominator;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edx, %r10d
movb 0x18(%rbp), %al
movb 0x10(%rbp), %dl
cmpl $0x1, %edi
je 0x32d1
testl %edi, %edi
jne 0x32fe
movzwl %r8w, %ecx
movzbl %dl, %edx
addl %ecx, %edx
movzbl %al, %eax
leal (%rdx,%rax,2), %eax
shll $0x3, %eax
xorb $0x1, %r9b
movzbl %r9b, %ecx
leal (%rax,%rcx,8), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
addl $0x5dc0, %eax           # imm = 0x5DC0
jmp 0x3306
testl %esi, %esi
sete %dil
leal -0xb(%r10), %r11d
cmpl $0x2, %r11d
setb %r11b
testb %r11b, %dil
jne 0x32f9
movl %esi, %edi
xorl $0x1, %edi
movl %r10d, %r11d
xorl $0xc, %r11d
orl %edi, %r11d
jne 0x3315
movb $0x1, %r11b
jmp 0x3318
movl $0x1, %r10d
xorl %eax, %eax
addl %r10d, %eax
decl %eax
xorl %edx, %edx
divl %r10d
popq %rbx
popq %r14
popq %rbp
retq
xorl %r11d, %r11d
leal -0x5(%r10), %ebx
cmpw $0xd, %r8w
movl $0xc, %edi
cmovael %r8d, %edi
cmpl $0x2, %ebx
cmovael %r8d, %edi
movzbl %cl, %ecx
addl $0x4, %ecx
movzbl %dl, %edx
movzbl %al, %r8d
shll $0x4, %r8d
leal (,%r10,4), %ebx
xorl %eax, %eax
testb %r9b, %r9b
movl $0x14, %r9d
cmovnel %eax, %r9d
subl %ebx, %r9d
addl %r8d, %r9d
leal -0x8(,%r10,4), %r8d
testb %r11b, %r11b
cmovel %ebx, %r8d
leal (%r9,%rdx,8), %r11d
xorl %r14d, %r14d
cmpl $0x7, %r10d
leal 0x8(%r9,%rdx,8), %edx
cmovbl %ebx, %r8d
cmovbl %r11d, %edx
setb %r14b
testl %edx, %edx
cmovlel %eax, %edx
leal (%rdx,%r8), %eax
decl %eax
cltd
idivl %r8d
imull %ecx, %eax
movzwl %di, %ecx
leal (%rcx,%r14,2), %ecx
addl %eax, %ecx
leal 0x31(,%rcx,4), %eax
addb $-0x2, %r10b
movl %r10d, %ecx
shll %cl, %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl %esi, %ecx
leaq 0x2e1c(%rip), %rdx      # 0x61e0
movl (%rdx,%rcx,4), %ecx
cmpq $0xa, %rcx
ja 0x341f
leaq 0x2d2c(%rip), %rdx      # 0x6100
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x1e84, %r10d          # imm = 0x1E84
jmp 0x3306
movl $0x7a12, %r10d          # imm = 0x7A12
jmp 0x3306
movl $0x3d090, %r10d         # imm = 0x3D090
jmp 0x3306
movl $0x3d09, %r10d          # imm = 0x3D09
jmp 0x3306
movl $0x7a120, %r10d         # imm = 0x7A120
jmp 0x3306
movl $0x28b1, %r10d          # imm = 0x28B1
jmp 0x3306
xorl %r10d, %r10d
jmp 0x3306
movl $0xf424, %r10d          # imm = 0xF424
jmp 0x3306
movl $0x1e848, %r10d         # imm = 0x1E848
jmp 0x3306
movl $0xa2c3, %r10d          # imm = 0xA2C3
jmp 0x3306
movl $0x5161, %r10d          # imm = 0x5161
jmp 0x3306