[Question]
  [
> 
> For nandgame fans: Please try out [DPD to decimal in logic gates](https://codegolf.stackexchange.com/q/176557/78410) too!
> 
> 
> 
## Background
[Densely packed decimal (DPD)](https://en.wikipedia.org/wiki/Densely_packed_decimal) is a way to efficiently store decimal digits in binary. It stores three decimal digits (000 to 999) in 10 bits, which is much more efficient than naive BCD (which stores one digit in 4 bits).
### Notations
* The lowercase letters `a` to `i` are the bits that are copied to the decimal representation.
* `0` and `1` are the exact bits in the input or output bit patterns.
* `x` bits are ignored in the conversion.
### Conversion table
The following is the conversion table from 10 bits of DPD to three decimal digits. Each decimal digit is represented as 4-bit binary (BCD). Both sides are written left to right from the most significant digit to the least.
```
Bits                 =>  Decimal         (Digit range)
a b c d e f 0 g h i  =>  0abc 0def 0ghi  (0-7) (0-7) (0-7)
a b c d e f 1 0 0 i  =>  0abc 0def 100i  (0–7) (0–7) (8–9)
a b c g h f 1 0 1 i  =>  0abc 100f 0ghi  (0–7) (8–9) (0–7)
g h c d e f 1 1 0 i  =>  100c 0def 0ghi  (8–9) (0–7) (0–7)
g h c 0 0 f 1 1 1 i  =>  100c 100f 0ghi  (8–9) (8–9) (0–7)
d e c 0 1 f 1 1 1 i  =>  100c 0def 100i  (8–9) (0–7) (8–9)
a b c 1 0 f 1 1 1 i  =>  0abc 100f 100i  (0–7) (8–9) (8–9)
x x c 1 1 f 1 1 1 i  =>  100c 100f 100i  (8–9) (8–9) (8–9)
```
## Task
Convert 10 bits of DPD to 3 digits of decimal.
## Test cases
```
DPD           Decimal
0000000101    005
0001100011    063
0001111001    079
0000011010    090
0001011110    098
1010111010    592
0011001101    941
1100111111    879
1110001110    986
0011111111    999
1111111111    999  * Output is same regardless of the `x` bits
```
## Input
The default input format is a list of 10 bits. The bits should follow the exact order above, or the reverse of it. You may choose to use an equivalent string or integer representation instead. Unlike my other challenges, **reordering or using nested structures is not allowed**.
For the input `[1, 1, 0, 0, 0, 1, 0, 1, 0, 0]`, the following formats are allowed:
* List of bits: `[1, 1, 0, 0, 0, 1, 0, 1, 0, 0]`
* String: `"1100010100"`
* Binary integer: `788` or `0b1100010100`
* Decimal integer: `1100010100`
* Reversed: `[0, 0, 1, 0, 1, 0, 0, 0, 1, 1]` and reversed in any other formats above
The following formats are NOT allowed:
* Arbitrary reordering of bits: `[0, 0, 0, 0, 0, 1, 1, 1, 0, 1]`
* Nested structures: `[[1, 1, 0], [0, 0, 1], [0, 1, 0, 0]]` or `[0b110, 0b001, 0b0100]`
## Output
The default output format is a list of 3 decimal digits. Each digit should be represented as 0 to 9, either an integer or a character. As in input, you can choose string or integer representation. If you choose integer representation, leading zeroes can be omitted.
## Scoring & winning criterion
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply. The shortest program or function in bytes for each language wins.
  
[Answer]
# JavaScript (ES6), 112 bytes
*All credit for this shorter version goes to @nwellnhof.*
Takes input as an integer. Returns an array of three decimal digits.
```
n=>[(x=n>>4,y=x>>3,q=n/2&55,p=q%8)>5&&q-39?8|y&1:y,(p&5^5?x&6:q-23?8:y&6)|x&1,(p<5?p*2:p<6?x&6:p%q<7?y&6:8)|n&1]
```
[Try it online!](https://tio.run/##XY3RboMgFIbvfQpuSmEBJzqccwJXe4JeNl3CbO26NIDWLJr47s7Kupr9FyQf33/O@dLf@lI2J9dSY/eHsRKjEXKLOmGkfCK96KRMSC3MYww5J07UqwxLDmFNkxeVDT1keU@Qg/ydqw6meU3jRGV5D1M8dJBNquDKPcS5K9K54FZ18awmn2d4MJDtxtdtAED0EfmwiJEbMzY/C77@3HlusOjufcMz87jw8/Dffk/X3NhfW/b/@d8EuzCobPOmy09kgJCgtOZiz4fwbI/IhK3dtM3JHFGMQ6f3m1Y3LZq2gggTsKZUrgmokMEYjz8 "JavaScript (Node.js) – Try It Online")
---
# JavaScript (ES6), ~~118~~ 117 bytes
Takes input as an integer. Returns an array of three decimal digits.
```
n=>[(x=n>>4&7,y=n>>7,p=n/2&7)>5&&p<7|x/2^2?8|y&1:y,(p<7?p-5?x:8:x/2^1?8:y&6)|x&1,(p<5?p*2:p<6?x&6:p<7|x<2?y&6:8)|n&1]
```
[Try it online!](https://tio.run/##XY3NbsMgEITvfgpOBCrsGFT/iBo49QlyjFKJOHGaKgLkoMqW/O6ubZrG6hxW@@0Mw5f@1ve6vTofG3s6j40YjZB71Akj5SssSD8vBXHCbBkssMwgdFUxdFv2wVQ59JDynqDppFycqY6XfLaoKnkPczx0kM5uptwL467KVQdzvhRUTE0JXuLBQHoY3/YRAOkxDaIpJQ@mdBkrni9PXhI0ffohEZgGXPnL47/@QLMeHH5b5//5v4oOSdTY9l3Xn8gAIUFtzd3ezsnNXpBJvN359mouiOHE6dPO69ajqRWkmIBNHMsNAQ0yGOPxBw "JavaScript (Node.js) – Try It Online")
## How?
Instead of trying to apply the 'official' algorithm, this code is based on some kind of reverse-engineering of the patterns that can be found in the expected results.
Given the input integer \$n\$, we compute:
$$\begin{align}&x=\left\lfloor\frac{n}{16}\right\rfloor \bmod 8\\
&y=\left\lfloor\frac{n}{128}\right\rfloor\\
&p=\left\lfloor\frac{n}{2}\right\rfloor \bmod 8\end{align}
$$
### Example: first digit (hundreds)
```
x     | 0                | 1                | 2                | 3               
n & 1 | 0101010101010101 | 0101010101010101 | 0101010101010101 | 0101010101010101
p     | 0011223344556677 | 0011223344556677 | 0011223344556677 | 0011223344556677
------+------------------+------------------+------------------+-----------------
y = 0 | 0000000000008888 | 0000000000008888 | 0000000000008888 | 0000000000008888
y = 1 | 1111111111119999 | 1111111111119999 | 1111111111119999 | 1111111111119999
y = 2 | 2222222222228888 | 2222222222228888 | 2222222222228888 | 2222222222228888
y = 3 | 3333333333339999 | 3333333333339999 | 3333333333339999 | 3333333333339999
y = 4 | 4444444444448888 | 4444444444448888 | 4444444444448888 | 4444444444448888
y = 5 | 5555555555559999 | 5555555555559999 | 5555555555559999 | 5555555555559999
y = 6 | 6666666666668888 | 6666666666668888 | 6666666666668888 | 6666666666668888
y = 7 | 7777777777779999 | 7777777777779999 | 7777777777779999 | 7777777777779999
x     | 4                | 5                | 6                | 7               
n & 1 | 0101010101010101 | 0101010101010101 | 0101010101010101 | 0101010101010101
p     | 0011223344556677 | 0011223344556677 | 0011223344556677 | 0011223344556677
------+------------------+------------------+------------------+-----------------
y = 0 | 0000000000008800 | 0000000000008800 | 0000000000008888 | 0000000000008888
y = 1 | 1111111111119911 | 1111111111119911 | 1111111111119999 | 1111111111119999
y = 2 | 2222222222228822 | 2222222222228822 | 2222222222228888 | 2222222222228888
y = 3 | 3333333333339933 | 3333333333339933 | 3333333333339999 | 3333333333339999
y = 4 | 4444444444448844 | 4444444444448844 | 4444444444448888 | 4444444444448888
y = 5 | 5555555555559955 | 5555555555559955 | 5555555555559999 | 5555555555559999
y = 6 | 6666666666668866 | 6666666666668866 | 6666666666668888 | 6666666666668888
y = 7 | 7777777777779977 | 7777777777779977 | 7777777777779999 | 7777777777779999
```
Algorithm:
* If \$p<6\$, we have \$d=y\$
* If \$p=6\$, we have \$d=8+(y\bmod2)\$
* If \$p=7\text{ AND }(x<4\text{ OR }x>5)\$, we have \$d=8+(y\bmod2)\$
* If \$p=7\text{ AND }(x=4\text{ OR }x=5)\$, we have \$d=y\$
As JS code:
```
p > 5 && p < 7 | x / 2 ^ 2 ? 8 | y & 1 : y
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~126~~ ~~119~~ ~~117~~ ~~112~~ 111 bytes
```
(a,b,c,d,e,f,g,h,i,j)=>[(g&h&i+(b+=a*4+b,e+=d*4+e)!=5?8:b)+c,(g&i?h+e-3?8:b:e)+f,(g?h<i?e:h>i*e?b:8:h*4+i*2)+j]
```
[Try it online!](https://tio.run/##fZJRb5swEMff@RTGD8jOuQ5NMwlBHZQ@pJq0h2p5rKbVgAFHDBC4VaQqnz01bJnGSvtyOp3vd//72z7IF9mnnW7NVd1k6rwTZyJZwlKWMcVyVrCSaXagYvNICq/0NJAEhFysIWEKRGYTRV3xJQ7ChELKbJOOS1BXN0MlVBRyW4vLWx2rsNzohYqTMAhLy@nFisLhxzl/rlOjmxrdzyqjVwfpHBG3oKhT5rmr0eOov1hZvXEBm@Xsz0g7MXKQqno1UoXnlp6rP0eDOWiWCWz3hfufmeoEE4XLhCnjZp6rvPFap2DwGTJLXLrfm5nTmBp6T3y41O/Wk@O0su@RQH7k5E1HXmSHtPAjfXvtr9aRBhifbSgfbZfmptmbTtcFWVHeymxvZGfItc98aoXTpu6bSvGqKciRd6qtZKrIkvDXmxP9G9cnumTkJxv/iP2PEjDCkIwxpWwrdoRzfuR9W2nz9MR/yZYYsQFDKbsT9x8fYgxbIWy8i8lgC4Dhh@1@j2mId9uv3zC1hv/dET8M5r9LoxBGgMarAJsu0eAe0@j8Bg "JavaScript (Node.js) – Try It Online")
**-5 bytes thanks @tsh** (and 2 by myself) So `l` can make more effort than I expected.
**-2 more bytes using @tsh's technique!**
**-5 bytes thanks @Arnauld**
**-1 byte thanks @Neil**
Input as a list of 10 bits (as 10 arguments), output as a list of 3 digits.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~229 ... 97~~ 96 bytes
```
lambda a:[[a&6,a>>4&6,a>>7&6,8][b"  eW7B]Oys"[~a&8or~a&6or~6|a>>4]%x&3]|a>>x%9&1for x in[7,4,9]]
```
[Try it online!](https://tio.run/##VY9NboMwEIX3PoUbKRhLVoTzAzgSWfQCXXTRBfHCSYlKRQBhIyVS1atTj4dU7SzGfh9vnpn@7j66djNdiuPUmOvp3VCzL0sTpcIcDls8Mn/kujwtKK3esmf9creL8ttEeTf4nvqefoFbL2/RRsP1tlSRvHQDvdG6LTOxFUrrydKCMsYSLJlI6itJdgSUDC2QdIMEGJJMEZzxQ0kgKiGYAS4kOZEIZs9OrQkGy/kttZUENRSQ3CfL@W2cUnlKHg70KBU8/4nfgxBYqGzqtlrZvqldzCnsDMCvTe1M2bFlXBPiKuvOxlZhKq5bF4MSay4oiG50/eg4ZoQvSEKUHwdsBD2B/o3aE/iffoAAw/@Ii5fejMhYWw0uPMnY6rOr2/hq@ti6QYDPFy2KhxnnOcGTvY7nc2XtE@PTDw "Python 3 – Try It Online")
*-4 bytes by @xnor*
*-6 bytes by @nwellnhof*
Formatted:
```
h = lambda a:[
    [a&6, a>>4&6, a>>7&6, 8][              List to take high bits from
        b"  eW7B]Oys"[                     10 char string; where to get high bits for
                                             indicator values 1-8. 0th,1st chars not used.
            ~a&8 or ~a&6 or ~6|a>>4]       Compute indicator (by @nwellnhof)
        %x&3]                              High bits of each digit
    | a >> x%9 & 1                         bitwise OR with low bit of each digit
    for x in [7,4,9]]
```
### Explanation
Because I originally wanted to implement this in Jelly, I take a different approach from most answers here, which is simple and perhaps suited to a golfing language. Though the golfed function takes an integer, let the input as a bit list be `[a0,a1,...,a9]`. Then we can derive three values from the input
* The low bits `[a2,a5,a9]`: These will always be the low bits of `[d0,d1,d2]` respectively.
* The high bits `[2*a0a1,2*a3a4,2*a7a8,8]`: The high bits of each digit will be one of these.
* The indicator bits, `[a3,a4,a5,a7,a8]`, determining how to get the high bits of each digit. We compute the indicator (between 1 and 8) as follows:
	+ If a5 == 0, the indicator is 8 (originally 0, but using 8 instead saves a byte)
	+ If a3 nand a4, the indicator is 6 - 2\*a3a4
	+ Otherwise the indicator is 2\*a7a8 + 1 (actually calculated as a negative number).
Then the nth digit can be elegantly computed as `high_bits[arr[indicator][n]] | low_bits[n]` by the table below, which is compressed into a string.
```
arr = [
    [0,1,2],
    [3,1,2],
    [1,3,2],
    [2,1,3],
    [2,3,3],
    [3,2,3],
    [3,3,2],
    [3,3,3]
]
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~138~~ 129 bytes
```
f(w){int t=w/2&55,s=t%8,v=w/16,u=v/8;w=((s<6|t==39?u:8|u%2)*10+v%2+(s&5^5?v&6:t-23?8:u&6))*10+w%2+(s<5?s*2:s<6?v&6:s%t<7?u&6:8);}
```
[Try it online!](https://tio.run/##TZDRboMgFIav9SlIEw2ojYDDgkp8kK5NNjcXL2aXipqs9dkdAibjgsDHd84PNMevplnXFs7o0fUKKDmnNGQsGaQKeDLpLcmTUU4pL2cJ4VDlTyVlJuqx4M8xoCgiOJ4CGsMhZFdWT2FeqCPNal6MYY7M8WyOK1YPES10ByMNgapOtXYKjspl3cK/37oeIvDwPXOV8wVIvcHv2A6CSQLSFGDMLCTETBbm2Q437OBJ7OUaEmyhwM60roNcQ2LZbjJBjWka7unihWwmsUkunZsg4i7kygXPXfk/UwhnugF26C2l77W3O4Db4zuJS9BVQ/f7eWuhQqlbRQppHsfml7yfu3ZbeAhw9vHaHxKg1XN3QUi3Wvxl/QM "C (gcc) – Try It Online")
First extracts some bits into variables `s` and `t`, so that the eight rows of the conversion table can be identified by:
```
1.  s < 4              u v w¹
2.  s = 4              u v 8¹
3.  s = 5              u 8 v
4.  s = 6              8 v u
5.  s = 7, t =  7      8 8 u
6.  s = 7, t = 23      8 u 8
7.  s = 7, t = 39      u 8 8
8.  s = 7, t = 55      8 8 8
¹ Can be computed with s*2
```
Then sets up `u` and `v` with divisions (right shifts), so that `u`, `v` and the input `w` contain the lower three BCD bits in positions 0-2. The rest is bit shuffling depending on `s` and `t`. Two notable tricks are:
```
s&5^5  // Rows 1, 2 and 4.
s%t<7  // Rows 1-5.
```
A port of [Shieru Asakoto's Javascript solution](https://codegolf.stackexchange.com/a/176375/9296) is only **124 bytes**:
```
f(a,b,c,d,e,f,g,h,i,j){a=(((g&h&i+(b+=a*4+b,e+=d*4+e)!=5?8:b)+c)*10+(g&i?h+e-3?8:b:e)+f)*10+(g?h-i|h&!e?h?b:e:8:h*4+i*2)+j;}
```
[Try it online!](https://tio.run/##TZDRbsIgFIav61OgyRooGMFaLXW1D@K8aCsIJtPFNV7M9dk7CqfJuOCHj//ww2mXl7YdBo1r1rCWnZliml2YYZZdyasuMcaX2MSW4oaWdbKhDVO0PLuFIvMyq/KiIbQlieDUGW1lqFqmIy0UoRp4ZZb218RzVZnKHRR5YdwFNlkTet33g7116LO2N0zQaxaNu@54QqXb8IaHIbhgaLVCnGcBCuGnALfpBEcMcCencgcFD1BycAYvwNxBEdjkzOTaO/2FU7rciNEpQhKk5z5IwIOgXOZbKP/nlBKcMNAEo34/i/T9gfD4eVvyPbLv3/ZH3TXuyApWSUccp9R3ybfp6ZrUHe3JVUdfD0c0Xrzx9PxxWzCk8fNwkLGLdpqD7kC3oBnoBjQFXYMKr7EgxGX0s374Aw "C (gcc) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~153 ... 119~~ 117 bytes
```
->n{n+=n&896;a,b,c=n&1536,n&96,n&14;"%x"%n+=c<9?0:2036+[b/16-b-1918,r=a>>8,[r+126,a/16-26,a-1978,38][b/32]-a][c/2-5]}
```
[Try it online!](https://tio.run/##TZBBDsIgEEX3nqIxsZsOlgGLjLX1IIQFNHFnY5qYaNSzVyjVymIgj8d8YLj5x3huRtb2z75o@lyTqh146MIaK6mgzykW3NXrzX29CVJ3pBM/CC5VYXyJinmGhBqGxrWtBjMUKBS4uBPnsLnXILUNshSWOWu6UrDKvkdjuOdpIEeoLKwSQZwKKPmHIkTY0w9NHnIgvljJA9IJYSLRqkh8talTTKQdzh6mhJCpvwk432Jqp5azs0e0eP/Mbi/u@nyFT3xl18w4OBtnwYfnfgA "Ruby – Try It Online")
### How it works:
```
->n{n+=n&896;
```
This is the starting point: convert to BCD by shifting 3 bits to the left, which works for most of the patterns.
```
a,b,c=n&1536,n&96,n&14;
```
Get the middle bits of each nibble (and one extra bit of the third nibble, but mask the least significant bit).
```
"%x"%n+=c<9?0
```
If the third digit is less than 10 (less than 9 because we never cared for the LSB anyway), we're set: this is plain BCD, we can output the hex without changing anything
```
:2036+[b/16-b-1918,r=a>>8,[r+126,a/16-26,a-1978,38][b/32]-a][c/2-5]}
```
Otherwise do some black magic by shifting bits around and adding magic numbers until we get the result we want.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~51~~ ~~48~~ ~~40~~ 39 bytes
```
&\‘f4;s3ɓạ4ḅ-œ?µ/Ḥ
“MY-€-Y¤©¡‘Dịs3Ḅç+ƭ/
```
[Try it online!](https://tio.run/##y0rNyan8/18t5lHDjDQT62Ljk5Mf7lpo8nBHq@7RyfaHtuo/3LGE61HDHN9I3UdNa3QjDy05tPLQQqBil4e7u4uNH@5oObxc@9ha/f8Pd29R8Fd4uKNJ4dBWhaN7FA63A9UreIOIyP//DSDA0MCQC0QZggkIE8QBM8HihgZcEHUgcS5DCAsiClYIMgHCAAEuQ6hRUAUIUSgAAA "Jelly – Try It Online")
### Algorithm
With the exception of list indices, all integers in this section are written in binary.
Given input \$\alpha\beta\gamma\delta\varepsilon\zeta\eta\theta\iota\kappa\$, we first construct the arrays \$[\eta\eta, \theta\iota, \delta\varepsilon]\$, \$[\alpha\beta, \delta\varepsilon, \theta\iota]\$, and \$[\gamma, \zeta, \kappa]\$.
1. If \$\eta\eta = 00\$, all three output digits are low (\$0000\$ to \$0111\$).
2. If \$\eta\eta = 11\$ but \$\theta\iota < 11\$, exactly one output digit is high (\$1000\$ or \$1001\$).
3. If \$\eta\eta = \theta\iota = 11\$ but \$\delta\varepsilon < 11\$, exactly two output digits are high.
4. If \$\eta\eta = \theta\iota = \delta\varepsilon = 11\$, all three output digits are high.
If we count the number of leading \$11\$'s \$[\eta\eta, \theta\iota, \delta\varepsilon]\$, create an array of a matching number of \$100\$'s, concatenate it with \$[\alpha\beta, \delta\varepsilon, \theta\iota]\$, and split the result into subarrays of length three, we get the following results in each case.
1. \$[[\alpha\beta, \delta\varepsilon, \theta\iota]]\$
2. \$[[100, \alpha\beta, \delta\varepsilon], [\theta\iota]]\$
3. \$[[100, 100, \alpha\beta], [\delta\varepsilon, \theta\iota]] = [[100, 100, \alpha\beta], [\delta\varepsilon, 11]]\$
4. \$[[100, 100, 100], [\alpha\beta, \delta\varepsilon, \theta\iota]] = [[100, 100, 100], [\alpha\beta, 11, 11]]\$
In the first and last case, we just have to zip the first array with \$[\gamma, \zeta, \kappa]\$, yielding \$[\alpha\beta\gamma, \delta\varepsilon\zeta, \theta\iota\kappa]\$ in the first case and \$[100\gamma, 100\zeta, 100\kappa]\$ in the last.
The remaining two cases are similar, but the arrays \$[100, \alpha\beta, \delta\varepsilon]\$ and \$[100, 100, \alpha\beta]\$ have to be reordered, according on the values of \$[\theta\iota]\$ and possibly \$\delta\varepsilon\$.
In the second case, the six permutations of \$[100, \alpha\beta, \delta\varepsilon]\$ are \$[100, \alpha\beta, \delta\varepsilon]\$, \$[100, \delta\varepsilon, \alpha\beta]\$, \$[\alpha\beta, 100, \delta\varepsilon]\$, \$[\alpha\beta, \delta\varepsilon, 100]\$, \$[\delta\varepsilon, 100, \alpha\beta]\$, and \$[\delta\varepsilon, \alpha\beta, 100]\$.
By computing \$100-\theta\iota\$, we map \$00\$, \$01\$, and \$10\$ to four, three and two, selecting the permutations \$[\alpha\beta, \delta\varepsilon, 100]\$, \$[\alpha\beta, 100, \delta\varepsilon]\$, and \$[100, \delta\varepsilon, \alpha\beta]\$.
After zipping the result with \$[\gamma, \zeta, \kappa]\$, we get \$[\alpha\beta\gamma, \delta\varepsilon\zeta, 100\kappa]\$, \$[\alpha\beta\gamma, 100\zeta, \delta\varepsilon\kappa]\$, or \$[100\gamma, \delta\varepsilon\zeta, \alpha\beta\kappa]\$.
In the third case, the permutations (with duplicates) of \$[100, 100, \alpha\beta]\$ are \$[100, 100, \alpha\beta]\$, \$[100, \alpha\beta, 100 ]\$, \$[100, 100, \alpha\beta]\$, \$[100, \alpha\beta, 100 ]\$, \$[\alpha\beta, 100, 100]\$ and \$[\alpha\beta, 100, 100]\$.
By computing \$(100 - \theta\iota) - (100 - \delta\varepsilon) = \delta\varepsilon - \theta\iota = \delta\varepsilon - 11\$, we map \$00\$, \$01\$, and \$10\$ to three, four, and five modulo six, selecting the permutations \$[100, 100, \alpha\beta]\$, \$[100, \alpha\beta, 100 ]\$, and \$[\alpha\beta, 100, 100]\$.
After zipping the result with \$[\gamma, \zeta, \kappa]\$, we get \$[100\gamma, 100\zeta, \alpha\beta\kappa]\$, \$[100\gamma, \alpha\beta\zeta, 100\kappa]\$, or \$[\alpha\beta\gamma, 100\zeta, 100\kappa]\$.
### Code
```
“MY-€-Y¤©¡‘Dịs3Ḅç+ƭ/  Main link. Argument: A (array of 10 bits)
“MY-€-Y¤©¡‘           Array literal; yield [77, 89, 45, 12, 45, 89, 3, 6, 0].
           D          Decimal; yield
                      [[7,7], [8,9], [4,5], [1,2], [4,5], [8,9], [3], [6], [0]].
            ị         Retrieve the elements of A at those indices.
                      Indexing is 1-based and modular, so 1 is the first index, while
                      0 is the last.
             s3       Split the results 2D array of bits into chunks of length 3.
               Ḅ      Convert the 9 arrays of bits from binary to integer.
                ç+ƭ/  Reduce the resulting array (length 3) once by the helper link,
                      then by addition.
&\‘f4;s3ɓạ4ḅ-œ?µ/Ḥ    Helper link. Arguments: B, C (arrays of three integers each)
&\                    Cumulatively reduce B by bitwise AND.
  ‘                   Increment the results by 1.
   f4                 Filter; keep only integers equal to 4.
     ;                Concatenate the result with C.
      s3              Split the result into (one or two) chunks of length 3.
        ɓ      µ/     Reduce the array of chunks by the following chain.
         ạ4               Take the absolute difference of the integers in the right
                          chunk and the integer 4.
           ḅ-             Convert the resulting array from base -1 to integer, i.e.,
                          map [x] to n = x and [x, y] to n = y - x.
             œ?           Take the n-th permutation of the left chunk.
                 Ḥ    Unhalve; multiply the resulting integers by 2.
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~191~~ 181 bytes
```
(...)(...)
:$1,$2;
..(.),11(.);111
100$1,100$2;100
(10|(..)(.,)01)(.);111
100$3$2$4;100
(..)(.),(00.);111
100$2,1$3;0$1
(..)((.{5});110|(.);101)
100$3$4;$1
1
01
+`10
011
.0+(1*)
$.1
```
[Try it online!](https://tio.run/##TU67DgIxDNvzHR1arori3rHQn4GBgYUBsQHfXvKodJfBcW3H6uv@fjxvY2RmLg50SaipdWLOXCqg2AEQRNQxbF2RMuSb/aoWQTnG1tTSFiEPlJpFDn6rSGvXuvAzf84/c61Qt7bNmq1rBiSg5QrRDWJZMk6FEmMMidELsgWHoPZw6rode850QrBQPWgNQeCfnFUzsKtz/g "Retina 0.8.2 – Try It Online") Link includes test cases. Edit: Saved 10 byte by not padding digits to 4 bits except where necessary. Explanation:
```
(...)(...)
:$1,$2;
```
Insert separators so that each digit can be converted to decimal separately. This effectively handles the first two cases in the conversion table.
```
..(.),11(.);111
100$1,100$2;100
```
Handle the last (eighth) case in the conversion table.
```
(10|(..)(.,)01)(.);111
100$3$2$4;100
```
Handle the sixth and seventh cases in the conversion table.
```
(..)(.),(00.);111
100$2,1$3;0$1
```
Handle the fifth case in the conversion table.
```
(..)((.{5});110|(.);101)
100$3$4;$1
```
Handle the third and fourth cases in the conversion table.
```
1
01
+`10
011
.0+(1*)
$.1
```
Perform binary to decimal conversion.
[Answer]
# [Python 2](https://docs.python.org/2/), 157 bytes
```
lambda a,b,c,d,e,f,g,h,i,j:[c+[a*4+b*2,8][g*h*~(d*~e*i)],f+[d*4+e*2,8,a*4+b*2][g*i+(d<e)*g*i*h],j+[h*4+i*2,[8,[a*4+b*2,d*4+e*2][h<i]][h^i or(h&i-(d|e))]][g]]
```
[Try it online!](https://tio.run/##bY59a4MwEIf/91McDGYSb2BcX7S0nyTLwDbRpLRWimMMRr@6O43oBstBCM89@d21X527NVlfHd76S3k9mhJKPOIJDVqssEaHHs87dUpUKVbJUWSYa1ULJx7MiIcVnmusEmWoaYcmTtog@YSZveWCXsJpPCfKUdOTpnKc86avWrm913S/e7jdmXv2L8x8W86J1Vr3n85fLMhdBP7gm/ajYzyC9u6bDiomrmXL6Ime8z5Ow5GpjOEJ6KRU62jgUo7XzDfwOvGhs/AtFFHIIS7TmReQBj/8@MXzKJYBL/6aeDb4Y/iyTwErkOTLMHjeJw9z5bTlnEPpsAk5f/xiqNH/h/8A "Python 2 – Try It Online")
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~238~~ ... 189 bytes
*-2 bytes thanks to Neil*
```
import StdEnv
$a b c d e f g h i j=100*(c+2*b+4*a)+10*(f+2*e+4*d)+j+2*i+4*h-2*(h*(99*b+198*a-394)+i*(9*e+18*d+h*(e+2*d-4+(b+2*a-4)*(1-10*e-100*d+110*e*d))-35)-4)*g+0^(e+d)*(2*b+4*a-8*i*h*g)
```
[Try it online!](https://tio.run/##bZBNT@MwEIbP7a@YAxL@GAs7TSGR4MYekPbG3kpWcmM3cdWmEXUX8ec3O6mzQCV8sGb8zDvzjuudt92wP7jTzsPehm4I@/7wGuE5uh/dn/mVhTXU4MDDBhpoIcD2wWgtWC0zsZa5sFwaSjeUekodl1sKA4WtygRrBStLKjRlIaxalDmXgZ6o1hTCScKeyp3KJVtTYFXOBTOKWno1znHSjDH15Wqx5CNupP5NKkeFkwVViCBa0fDhOVoy/wArdjjF/hQB4Qq@2YEDvLwAW1lcY40OPW6wwRYDbiuEpOVwr@hPemC27zNgY@hCE@Kvw1MXEQJ5guiP8VjN31r/6uHmBjKTz2fnx9HFfDZjq2udjtHmusKVRo3LiuMHowXHK7FbXFyykU7sDsuv7Kw0OrES9YUuKf@z4oOZhCbdklj2RXceNvksMUfzqTPJTPJZXHgx0wapJ03D24uen7qS5pGOUDX8rTc72xwH9fRzeHzv7D7Ux38 "Clean – Try It Online")
Takes a 'list' of 10 bits in the form of 10 arguments, using a direct formula to compute the result.
[Answer]
# Perl 5, 195 bytes
```
sub f{$n=shift;@p=((map{($n>>$_&3)*2}(8,5,1)),8);for(16390,28935,29005,227791,29108,225788,226803,228863){return 2*$n&256|$n&17|$p[$_>>4&3]<<8|$p[$_/4&3]<<4|$p[$_&3]if($_>>12&$n/2)==($_>>6&63);}}
```
[Try it online](https://tio.run/##ZZDRasIwFIbvfYrgYkkkzHMS26bUlr3DbgbbEMWWCRpDVRjUPnuXNGNY91@ck//jPychtmoOcd@fr1tSt9QU5699fclfbMHYcWNbRk1Z0nWk@Fx2TItYIOdC87w@NQwTlYGQOlOxkBmAqzJNM3QGQTsTp9q3RINyTetE8bapLtfGEDmnJpJxcnMN0xu173RdlstIfa5WOthFcMvg3HlfMx9CGVGzkLwoBptEbm3edf0TeT0dK1J9b472UJ0n7omEwRYAEV0BFBPi5dGgB@RTrozRMDoedAhhlAq5P4SBjFPDovsbA/C6Q@EJD4P/U7/ipHXQNntzqdl0Z3dsBs8IW17MQL19mKmga@E/jfN80vU/)
I know 195 bytes is far too much for this contest, but I had no idea how to further compress the Perl code. Suggestions?
## Explanation of the code
In a more readable version, the code intention should become apparent:
```
sub dpd {
  my $n = shift;
  my $v=2*($n&128)|$n&17;
  my @p=((map{($n>>$_&3)*2}(8,5,1)),8);
  for (16390,28935,29005,227791,29108,225788,226803,228863) {
    return $v |$p[$_>>4&3]<<8|$p[$_>>2&3]<<4|$p[$_&3]
      if(($_>>12&$n/2)==($_>>6&63));
  }
}
```
In the rules for DPD encoding, each line is encoded into a 18 bit value, segmentation into (6,6,(2,2,2)) bits. 
* The first 6 bits are an appropriate bit mask for the bits 1 (=h) to 6 (=d) of the input (bit 4 = f is redundant, but it simplifies the evaluation code to have it included).
* The next 6 bits are the value bits for this bit mask. The values are checked on all places where the bit mask has a 1 value.
* The following 3\*2 bits contain the indices for the array `@p` for the 3-bit sequences which are to spliced into bits 11-9, 7-5 and 3-1 of the result.
* The array `@p` is constructed from bits 9-8, 6-5, 3-2 of the input, and the number `8` as fourth member
* The bits at position 7,4 and 0 of the input are transferred directly into bits 8,4 and 0 of the result.
For example, the first number in the list, `16390`, which is `100000000000110` as a bit field, carries the following information:
```
000100 : bit mask says: only consider bit 3 of the input
000000 : bit values say: bit 3 should be 0
00     : use '0ab' as higher bits of first digit
01     : use '0de' as higher bits of second digit
10     : use '0gh' as higher bits of third digit
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 84 bytes
Port of [KimOyhus' answer](https://codegolf.stackexchange.com/a/178360/6484) to 05AB1E.
```
•4’7þ2Ô€iΘEuĆΣk4Ð€:ΘΛs‡CaΔʒì₁3¶rdiMß¡þи иø-˜)Â∍DY—WûQ@—Mā}Γ¤ÒÙ]p•44в2ôvÐyèP≠«}4ôC3.£
```
[Try it online!](https://tio.run/##AZ8AYP9vc2FiaWX//@KAojTigJk3w74yw5TigqxpzphFdcSGzqNrNMOQ4oKsOs6Yzptz4oChQ2HOlMqSw6zigoEzwrZyZGlNw5/CocO@0Lgg0LjDuC3LnCnDguKIjURZ4oCUV8O7UUDigJRNxIF9zpPCpMOSw5ldcOKAojQ00LIyw7R2w5B5w6hQ4omgwqt9NMO0QzMuwqP//zAwMDExMTEwMDE "05AB1E – Try It Online")
Rough explanation:
```
•yadayada•44в2ô   # encoded list of nand gates
v                 # for each gate
 ÐyèP≠            # compute the output of the gate
      «           # append it to the input
       }          # end of the loop
4ô                # split the list of bits in groups of 4
  C               # convert each from binary to decimal
   3.£            # keep the last 3 numbers
                  # implicit output
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~104~~ ~~103~~ 101 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
•3γã•S£©4èUXтÌ‹XSPVY®2èDˆTQ*~i0®нëт}®1èY¯`*i0®нëY_Xт>Ê*i0¯`ëт]®3èY¯`_*X110Q~i0®нëXт›iYiтë0¯`ëX]®θJ4ôC
```
Definitely not the right language for this kind of challenge, but ah well..  
Input as string, output as list of three digits.
[Try it online](https://tio.run/##yy9OTMpM/f//UcMi43ObDy8G0sGHFh9aaXJ4RWjExabDPY8adkYEB4RFHlpndHiFy@m2kECtukyDQ@su7D28@mJT7aF1hodXRB5an6AFE4yMB@qzO9wFElifAFIUe2idMURRvFaEoaFBINwAoMpHDbsyIzOBNq2GKI8Aqj63w8vk8Bbn//8NDIDKQdgQAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3l/0cNi4zPbT68GEgHH1p8aKXJ4RWhERebDvc8atgZERwQFnlondHhFS6n20ICteoyDQ6tu7D38OqLTbWH1hkeXhF5aH2CFkwwMh6oz@5wF0hgfQJYEVCVMURVvFaEoaFBINwEoNJHDbsyIzOBVq2GqI8AKT@3w8vk8Bbn/zqHtvw3gABDA0MuEGUIJiBMEAfMBIsbGnBB1IHEuQwhLIgoWCHIBAgDBLgMoUZBFSBEoQAA).
**Explanation:**
We have the following eight scenarios to consider:
```
     1st 2nd 3rd 4th 5th 6th                          1st digit    2nd digit    3rd digit
1.   ab  c   de  f   0gh i   →   0abc 0def 0ghi   →   '0'+1st 2nd  '0'+3rd 4th  5th     6th
2.   ab  c   de  f   100 i   →   0abc 0def 100i   →   '0'+1st 2nd  '0'+3rd 4th  5th     6th
3.   ab  c   gh  f   101 i   →   0abc 100f 0ghi   →   '0'+1st 2nd  '100'   4th  '0'+3rd 6th
4.   gh  c   de  f   110 i   →   100c 0def 0ghi   →   '100'   2nd  '0'+3rd 4th  '0'+1st 6th
5.   gh  c   00  f   111 i   →   100c 100f 0ghi   →   '100'   2nd  '100'   4th  '0'+1st 6th
6.   de  c   01  f   111 i   →   100c 0def 100i   →   '100'   2nd  '0'+1st 4th  '100'   6th
7.   ab  c   10  f   111 i   →   0abc 100f 100i   →   '0'+1st 2nd  '100'   4th  '100'   6th
8.   xx  c   11  f   111 i   →   100c 100f 100i   →   '100'   2nd  '100'   4th  '100'   6th
```
I first split the (implicit) input into chunks of size `[2,1,2,1,3,1]` and store that list in the register:
```
•3γã•     # Push compressed integer 212131
     S    # Convert it to a list of digits
      £   # Split the (implicit) input in chunks of that size
       ©  # Store it in the register (without popping)
```
[See this 05AB1E tip of mine (section *How to compress large integers?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `•3γã•` is `212131`
Now we're first going to built the 0s and 1s for the first digit of the output. Scenarios 1,2,3,7 use `'0'+1st+2nd`; and scenarios 4,5,6,8 use `'100'+2nd`:
```
4è                  # Take the 5th item of the list
  U                 # Pop and store it in variable `X`
XтÌ‹                #  Check if `X` is below 102
                ~   # OR
   XSP              #  `X` is equal to 111
      VY            #  And store that result in variable `Y`
               *    #  and
        ®2è         #  Get the 3rd item from the list of the register
           Dˆ       #  Push it to the global array
             TQ     #  And check if it's equal to 10
i                   # If the combined check above is truthy (exactly 1):
 0                  #  Push 0 to the stack
 ®н                 #  Push the 1st item of the list to the stack
ë                   # Else:
 т                  #  Push 100 to the stack
}                   # Close the if-else
®1è                 # And push the 2nd item of the list to the stack
```
Then we're going to built the 0s and 1s for the second digit of the output. Scenarios 1,2,4 use `'0'+3rd+4th`; scenarios 3,5,7,8 use `'100'+4th`; and scenario 6 uses `'0'+1st+4th`:
```
Y                # Push `Y` (check if `X` equals 111)
   *             # and
 ¯`              # Push the item from the global array (3rd item of the list)
i                # If both checks above are truthy (exactly 1):
 0               #  Push 0 to the stack
 ®н              #  Push the 1st item of the list to the stack
ë                # Else:
 Y_              #  Push inverted `Y` (check if `X` does NOT equal 111)
       *         #  and
   Xт>Ê          #  Check if `X` (5th item of the list) does NOT equal 101
 i               #  If both checks above are truthy (exactly 1):
  0              #   Push 0 to the stack
  ¯`             #   Push the item from the global array (3rd item of the list)
 ë               #  Else:
  т              #   Push 100 to the stack
]                # Close both if-else cases
®3è              # And push the 4th item of the list to the stack
```
Then we're going to built the 0s and 1s for the third digit of the output. Scenarios 1,2 use `5th+6th`; scenario 3 uses `'0'+3rd+6th`; scenarios 4,5 use `'0'+1st+6th`; and scenarios 6,7,8 use `'100'+6th`:
```
Y           #  Push `Y` (check if `X` equals 111)
    *       #  and
 ¯`_        #  Check if the item from the global array (3rd item of the list) is exactly 0
         ~  # OR
    X110Q   #  Check if `X` (5th item of the list) equals 110
i           # If the combined check above is truthy (exactly 1):
 0          #  Push 0 to the stack
 ®н         #  Push the 1st item of the list to the stack
ë           # Else:
 Xт›i       #  If `X` (5th item of the list) is larger than 100 (so 101/110/111):
     Yi     #   If `Y` (if `X` equals 111):
       т    #    Push 100 to the stack
      ë     #   Else:
       0    #    Push 0 to the stack
       ¯`   #    Push the item from the global array (3rd item of the list)
    ë       #  Else:
     X      #   Push `X` (5th item of the list) to the stack
]           # Close all if-else cases
®θ          # And push the last (6th) item of the list to the stack
```
Now we have all 0s and 1s on the stack, so we can convert it to the three output digits:
```
J     # Join the entire stack together
 4ô   # Split it into parts of size 4
   C  # Convert each part from binary to an integer (and output implicitly)
```
]