// File: eggnot[P]pixel_camera/matrix/lib/gpio.cc
// Function: rgb_matrix::(anonymous namespace)::HardwarePinPulser::SendPulse(int)
virtual void SendPulse(int c) {
    if (pwm_range_[c] < 16) {
      pwm_reg_[PWM_RNG1] = pwm_range_[c];

      *fifo_ = pwm_range_[c];
    } else {
      // Keep the actual range as short as possible, as we have to
      // wait for one full period of these in the zero phase.
      // The hardware can't deal with values < 2, so only do this when
      // have enough of these.
      pwm_reg_[PWM_RNG1] = pwm_range_[c] / 8;

      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
      *fifo_ = pwm_range_[c] / 8;
    }

    /*
     * We need one value at the end to have it go back to
     * default state (otherwise it just repeats the last
     * value, so will be constantly 'on').
     */
    *fifo_ = 0;   // sentinel.

    /*
     * For some reason, we need a second empty sentinel in the
     * fifo, otherwise our way to detect the end of the pulse,
     * which relies on 'is the queue empty' does not work. It is
     * not entirely clear why that is from the datasheet,
     * but probably there is some buffering register in which data
     * elements are kept after the fifo is emptied.
     */
    *fifo_ = 0;

    sleep_hint_ = sleep_hints_[c];
    start_time_ = *timer1Mhz;
    pwm_reg_[PWM_CTL] = PWM_CTL_USEF1 | PWM_CTL_PWEN1 | PWM_CTL_POLA1;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
cmpl $0x10, (%rax)
jae 0x3138
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
movq 0x38(%rdi), %rax
movl %ecx, 0x10(%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq %rax, %rcx
movq -0x18(%rbp), %rax
movl (%rcx), %ecx
movq 0x40(%rax), %rax
movl %ecx, (%rax)
jmp 0x323c
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x38(%rdi), %rax
movl %ecx, 0x10(%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq -0x18(%rbp), %rdi
movl (%rax), %ecx
shrl $0x3, %ecx
movq 0x40(%rdi), %rax
movl %ecx, (%rax)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b40
movq %rax, %rcx
movq -0x18(%rbp), %rax
movl (%rcx), %ecx
shrl $0x3, %ecx
movq 0x40(%rax), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
movq 0x40(%rdi), %rax
movl $0x0, (%rax)
movq 0x40(%rdi), %rax
movl $0x0, (%rax)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x4b60
movq %rax, %rcx
movq -0x18(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, 0x54(%rax)
movq 0xaf44(%rip), %rcx      # 0xe1b8
movl (%rcx), %ecx
movl %ecx, 0x50(%rax)
movq 0x38(%rax), %rax
movl $0x31, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)