// File: /workspace/github_cpp_makefile_star2_O3/mrlordkaj[P]i2cdevlib-pi/Arduino/wiringPi/wiringPi.c
// Function: pinMode
void pinMode (int pin, int mode)
{
  int    fSel, shift, alt ;
  struct wiringPiNodeStruct *node = wiringPiNodes ;
  int origPin = pin ;

  setupCheck ("pinMode") ;

  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 ;

    softPwmStop  (origPin) ;
    softToneStop (origPin) ;

    fSel    = gpioToGPFSEL [pin] ;
    shift   = gpioToShift  [pin] ;

    /**/ if (mode == INPUT)
      *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) ; // Sets bits to zero = input
    else if (mode == OUTPUT)
      *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (1 << shift) ;
    else if (mode == SOFT_PWM_OUTPUT)
      softPwmCreate (origPin, 0, 100) ;
    else if (mode == SOFT_TONE_OUTPUT)
      softToneCreate (origPin) ;
    else if (mode == PWM_TONE_OUTPUT)
    {
      pinMode (origPin, PWM_OUTPUT) ;	// Call myself to enable PWM mode
      pwmSetMode (PWM_MODE_MS) ;
    }
    else if (mode == PWM_OUTPUT)
    {
      if ((alt = gpioToPwmALT [pin]) == 0)	// Not a hardware capable PWM pin
	return ;

      usingGpioMemCheck ("pinMode PWM") ;

// Set pin to PWM mode

      *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (alt << shift) ;
      delayMicroseconds (110) ;		// See comments in pwmSetClockWPi

      pwmSetMode  (PWM_MODE_BAL) ;	// Pi default mode
      pwmSetRange (1024) ;		// Default range of 1024
      pwmSetClock (32) ;		// 19.2 / 32 = 600KHz - Also starts the PWM
    }
    else if (mode == GPIO_CLOCK)
    {
      if ((alt = gpioToGpClkALT0 [pin]) == 0)	// Not a GPIO_CLOCK pin
	return ;

      usingGpioMemCheck ("pinMode CLOCK") ;

// Set pin to GPIO_CLOCK mode and set the clock frequency to 100KHz

      *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (alt << shift) ;
      delayMicroseconds (110) ;
      gpioClockSet      (pin, 100000) ;
    }
  }
  else
  {
    if ((node = wiringPiFindNode (pin)) != NULL)
      node->pinMode (node, pin, mode) ;
    return ;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movl %edi, %ebx
leaq 0x1197e(%rip), %rdi     # 0x35a93
callq 0x240ee
cmpl $0x3f, %ebx
ja 0x24143
movl 0x2364f(%rip), %eax     # 0x47774
testl %eax, %eax
je 0x24165
movl %ebx, %r14d
cmpl $0x1, %eax
je 0x24175
cmpl $0x3, %eax
jne 0x24355
leaq 0x2433f(%rip), %rax     # 0x48480
jmp 0x2416c
movq 0x22e6e(%rip), %rax     # 0x46fb8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x24355
cmpl %ebx, (%rdi)
jg 0x2415f
cmpl %ebx, 0x4(%rdi)
jge 0x241d5
movq 0x58(%rdi), %rdi
jmp 0x2414d
leaq 0x2430c(%rip), %rax     # 0x48478
movq (%rax), %rax
movl %ebx, %ecx
movl (%rax,%rcx,4), %r14d
movl %ebx, %edi
callq 0x1f4d0
movl %ebx, %edi
callq 0x1f3b0
cmpl $0x6, %ebp
ja 0x24355
movslq %r14d, %rax
leaq 0x1109a(%rip), %rcx     # 0x35230
movzbl (%rax,%rcx), %r12d
leaq 0x110ce(%rip), %rcx     # 0x35270
movzbl (%rax,%rcx), %r15d
movl %ebp, %ecx
leaq 0x11020(%rip), %rdx     # 0x351d0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x242d0(%rip), %rax     # 0x48490
movl $0x7, %edx
movl %r15d, %ecx
shll %cl, %edx
notl %edx
andl %edx, (%rax,%r12,4)
jmp 0x24355
movq 0x20(%rdi), %rax
movl %ebx, %esi
movl %ebp, %edx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movl %ebx, %edi
xorl %esi, %esi
movl $0x64, %edx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1f110
leaq 0x11224(%rip), %rcx     # 0x35430
movzbl (%rax,%rcx), %ebx
testl %ebx, %ebx
je 0x24355
leaq 0x1187c(%rip), %rdi     # 0x35a9b
callq 0x24362
movq 0x24265(%rip), %rax     # 0x48490
movl $0x7, %edx
movl %r15d, %ecx
shll %cl, %edx
notl %edx
andl (%rax,%r12,4), %edx
shll %cl, %ebx
orl %edx, %ebx
movl %ebx, (%rax,%r12,4)
movq %rsp, %rdi
movq $0x0, (%rdi)
movq $0x1adb0, 0x8(%rdi)     # imm = 0x1ADB0
xorl %esi, %esi
callq 0x1f160
movl 0x23512(%rip), %eax     # 0x47774
cmpl $0x3, %eax
ja 0x24279
cmpl $0x2, %eax
je 0x24279
movq 0x24225(%rip), %rax     # 0x48498
movl $0x101, (%rax)          # imm = 0x101
movl $0x400, %edi            # imm = 0x400
callq 0x1f330
movl $0x20, %edi
callq 0x1f540
jmp 0x24355
leaq 0x111d7(%rip), %rcx     # 0x35470
movzbl (%rax,%rcx), %ebx
testl %ebx, %ebx
je 0x24355
leaq 0x117fb(%rip), %rdi     # 0x35aa7
callq 0x24362
movq 0x241d8(%rip), %rax     # 0x48490
movl $0x7, %edx
movl %r15d, %ecx
shll %cl, %edx
notl %edx
andl (%rax,%r12,4), %edx
shll %cl, %ebx
orl %edx, %ebx
movl %ebx, (%rax,%r12,4)
movq %rsp, %rdi
movq $0x0, (%rdi)
movq $0x1adb0, 0x8(%rdi)     # imm = 0x1ADB0
xorl %esi, %esi
callq 0x1f160
movl %r14d, %edi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x1f6f0
jmp 0x24355
movq 0x24191(%rip), %rax     # 0x48490
movl $0x7, %edx
movl %r15d, %ecx
shll %cl, %edx
notl %edx
andl (%rax,%r12,4), %edx
btsl %r15d, %edx
movl %edx, (%rax,%r12,4)
jmp 0x24355
movl %ebx, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1f3d0
movl %ebx, %edi
movl $0x2, %esi
callq 0x1f310
movl 0x23436(%rip), %eax     # 0x47774
cmpl $0x3, %eax
ja 0x24355
cmpl $0x2, %eax
je 0x24355
movq 0x24149(%rip), %rax     # 0x48498
movl $0x8181, (%rax)         # imm = 0x8181
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq