void HWL_GPIO_PIN_DIRECTORY(unsigned char pin, unsigned char dir) {
  unsigned char *reg = (unsigned char *)((0xF92) + (pin / 8));
  if (dir) {
    *reg = (unsigned char)(*reg) | (unsigned char)(0x01 << (pin % 8));
  } else {
    *reg = (unsigned char)(*reg) & (unsigned char)(~(0x01 << (pin % 8)));
  }
}


x86 assembly (clang, -O0):
<HWL_GPIO_PIN_DIRECTORY>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0xf92,%eax
cltq
mov    %rax,-0x10(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     1167 <HWL_GPIO_PIN_DIRECTORY+0x67>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movzbl %cl,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    119b <HWL_GPIO_PIN_DIRECTORY+0x9b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
movzbl %cl,%ecx
and    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<HWL_GPIO_PIN_DIRECTORY>:
mov    %edi,%r9d
shr    $0x3,%r9
mov    0xf92(%r9),%r8b
mov    %edi,%ecx
and    $0x7,%cl
mov    $0x1,%dl
shl    %cl,%dl
mov    $0xfe,%al
mov    %edi,%ecx
rol    %cl,%al
and    %r8b,%al
or     %r8b,%dl
test   %esi,%esi
movzbl %al,%eax
movzbl %dl,%ecx
cmove  %eax,%ecx
mov    %cl,0xf92(%r9)
ret

LLVM IR (-O0):
define void @HWL_GPIO_PIN_DIRECTORY(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = sdiv i32 %7, 8
%9 = add nsw i32 3986, %8
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = load i8, i8* %4
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = srem i32 %19, 8
%21 = shl i32 1, %20
%22 = trunc i32 %21 to i8
%23 = zext i8 %22 to i32
%24 = or i32 %17, %23
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %5
store i8 %25, i8* %26
br label %41
27: ; preds = %2
%28 = load i8*, i8** %5
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = srem i32 %32, 8
%34 = shl i32 1, %33
%35 = xor i32 %34, -1
%36 = trunc i32 %35 to i8
%37 = zext i8 %36 to i32
%38 = and i32 %30, %37
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %5
store i8 %39, i8* %40
br label %41
41: ; preds = %27, %14
ret void
}

LLVM IR (-O2):
define void @HWL_GPIO_PIN_DIRECTORY(i8 zeroext %0, i8 zeroext %1) {
%3 = lshr i8 %0, 3
%4 = zext i8 %3 to i64
%5 = add nuw nsw i64 %4, 3986
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i8 %1, 0
%8 = load i8, i8* %6
%9 = and i8 %0, 7
%10 = shl nuw i8 1, %9
%11 = xor i8 %10, -1
%12 = and i8 %8, %11
%13 = or i8 %8, %10
%14 = select i1 %7, i8 %12, i8 %13
store i8 %14, i8* %6
ret void
}