// File: /workspace/github_cpp_makefile_star2_O3/mrlordkaj[P]i2cdevlib-pi/Arduino/wiringPi/wiringPi.c
// Function: pullUpDnControl
void pullUpDnControl (int pin, int pud)
{
  struct wiringPiNodeStruct *node = wiringPiNodes ;

  setupCheck ("pullUpDnControl") ;

  if ((pin & PI_GPIO_MASK) == 0)		// On-Board Pin
  {
    /**/ if (wiringPiMode == WPI_MODE_PINS)
      pin = pinToGpio [pin] ;
    else if (wiringPiMode == WPI_MODE_PHYS)
      pin = physToGpio [pin] ;
    else if (wiringPiMode != WPI_MODE_GPIO)
      return ;

    if (piGpioPupOffset == GPPUPPDN0)
    {
      // Pi 4B pull up/down method
      int pullreg = GPPUPPDN0 + (pin>>4);
      int pullshift = (pin & 0xf) << 1;
      unsigned int pullbits;
      unsigned int pull;

      switch (pud)
      {
        case PUD_OFF: pull = 0; break;
        case PUD_UP: pull = 1; break;
        case PUD_DOWN: pull = 2; break;
        default: return ; /* An illegal value */
      }

      pullbits = *(gpio + pullreg);
      pullbits &= ~(3 << pullshift);
      pullbits |= (pull << pullshift);
      *(gpio + pullreg) = pullbits;
    }
    else
    {
      // legacy pull up/down method
      *(gpio + GPPUD)              = pud & 3 ;		delayMicroseconds (5) ;
      *(gpio + gpioToPUDCLK [pin]) = 1 << (pin & 31) ;	delayMicroseconds (5) ;

      *(gpio + GPPUD)              = 0 ;			delayMicroseconds (5) ;
      *(gpio + gpioToPUDCLK [pin]) = 0 ;			delayMicroseconds (5) ;
    }
  }
  else						// Extension module
  {
    if ((node = wiringPiFindNode (pin)) != NULL)
      node->pullUpDnControl (node, pin, pud) ;
    return ;
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
leaq 0x11735(%rip), %rdi     # 0x35ab5
callq 0x240ee
cmpl $0x3f, %ebx
ja 0x243ab
movl 0x233e4(%rip), %eax     # 0x47774
testl %eax, %eax
je 0x243cd
cmpl $0x1, %eax
je 0x243dc
cmpl $0x3, %eax
jne 0x24423
leaq 0x240d7(%rip), %rax     # 0x48480
jmp 0x243d4
movq 0x22c06(%rip), %rax     # 0x46fb8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x24423
cmpl %ebx, (%rdi)
jg 0x243c7
cmpl %ebx, 0x4(%rdi)
jge 0x244a5
movq 0x58(%rdi), %rdi
jmp 0x243b5
leaq 0x240a4(%rip), %rax     # 0x48478
movq (%rax), %rax
movl %ebx, %ecx
movl (%rax,%rcx,4), %ebx
movl 0x240ce(%rip), %eax     # 0x484b0
cmpl $0x39, %eax
jne 0x2442a
cmpl $0x2, %ebp
ja 0x24423
leal (%rbx,%rbx), %ecx
sarl $0x4, %ebx
movl %ebp, %eax
leaq 0x110f5(%rip), %rdx     # 0x354f0
movl (%rdx,%rax,4), %eax
movq 0x2408b(%rip), %rdx     # 0x48490
movslq %ebx, %rsi
movl $0x3, %edi
shll %cl, %edi
notl %edi
shll %cl, %eax
andl 0xe4(%rdx,%rsi,4), %edi
orl %edi, %eax
movl %eax, 0xe4(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
andl $0x3, %ebp
movq 0x2405c(%rip), %rax     # 0x48490
movl %ebp, 0x94(%rax)
movl $0x5, %edi
callq 0x1f240
movl $0x1, %eax
movl %ebx, %ecx
shll %cl, %eax
movq 0x2403c(%rip), %rcx     # 0x48490
movslq %ebx, %rdx
leaq 0x10ed2(%rip), %rsi     # 0x35330
movzbl (%rdx,%rsi), %ebx
shll $0x2, %ebx
movl %eax, (%rcx,%rbx)
movl $0x5, %edi
callq 0x1f240
movq 0x24017(%rip), %rax     # 0x48490
xorl %ebp, %ebp
movl %ebp, 0x94(%rax)
movl $0x5, %edi
callq 0x1f240
movq 0x23ffe(%rip), %rax     # 0x48490
movl %ebp, (%rax,%rbx)
movl $0x5, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1f240
movq 0x28(%rdi), %rax
movl %ebx, %esi
movl %ebp, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax