[Question]
  [
*Blatant [rip-off](https://codegolf.stackexchange.com/q/192979/43319) of a [rip-off](https://codegolf.stackexchange.com/q/132558/43319). Go upvote those!*
Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.
## Examples
Let's say your source code is `ABC` and its input is `4`. If I write `CBA` instead and run it, the output must be `-4`.
Let's say your source code is `ABC` and its input is `-2`. If I write `CBA` instead and run it, the output must be `2`.
An input of `0` may give `0` or `-0`, however, if you do support signed zero, `-0` should give `0`.
  
[Answer]
# [J](http://jsoftware.com/), 3 bytes
```
-&0
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/ddUM/mtypSZn5CukKZgowFiWllxcRallqUXFqSkKtnoKBmq6XBA5uKgJGh@o5T8A "J – Try It Online")
`-&0` is "argument minus 0"
`0&-` is "0 minus argument"
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~18~~ 14 bytes
```
$args#"sgra$"-
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfmvkmZb/V8lsSi9WFmpOL0oUUVJ938tF5eaSpqC@X8A "PowerShell – Try It Online") [!enilno ti yrT](https://tio.run/##K8gvTy0qzkjNyfmvkmZb/V9XSSWxKL1YSbk4vShR5X8tF5eaSpqC@X8A "PowerShell – Try It Online")
First of the trivial comment-abuse answers
[Answer]
# x86 machine code, 3 bytes
```
C3 D8 F7
```
The above bytes of code define a function that is a no-op: it simply returns control to the caller. That function is followed by two garbage bytes that will not be executed, since they come after a return—they are in "no man's land". In assembler mnemonics:
```
ret                     ; C3    
fdiv  st(0), st(7)      ; D8 F7
```
Okay, so now some troll comes by and reverses the order of the bytes:
```
F7 D8 C3
```
These bytes now define a function that takes an integer argument in the `EAX` register, negates it, and returns control to the caller. In assembler mnemonics:
```
neg  eax     ; F7 D8
ret          ; C3
```
So…that was simple. :-)
Note that we can make the "negation" instruction be *anything* we want, since it is never executed in the "forward" orientation and only executed in the "reversed" orientation. Therefore, we can follow the same pattern to do arbitrarily more complicated stuff. For example, here we take an integer argument in a different register (say, `EDI`, to follow the System V calling convention commonly used on \*nix systems), negate it, and return it in the conventional `EAX` register:
```
C3      ret
D8 F7   fdiv  st(0), st(7)      ;  \ garbage bytes that
F8      clc                     ;  | never get executed,
89      .byte 0x89              ;  / so nobody cares
```
  ↓ ↓
```
89 F8   mov  eax, edi
F7 D8   neg  eax
C3      ret
```
[Answer]
# JavaScript, 11 bytes
```
n=>n//n->=n
```
[Try it Online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1i5PXz9P1842739yfl5xfk6qXk5@ukaahomm5n8A) | [Reversed](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1k43T18/z842739yfl5xfk6qXk5@ukaahomm5n8A)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
oN
```
**[Try it online!](https://tio.run/##y0rNyan8/z/f7////7qmAA "Jelly – Try It Online")** and [its reverse](https://tio.run/##y0rNyan8/98v/////7qmAA "Jelly – Try It Online").
```
oN - (input) OR ((input) negated)
No - ((input) negated) OR (input)
```
[Answer]
# [Haskell](https://www.haskell.org/), 8 bytes
Anonymous identity function, turning into subtraction from `0` when reversed.
```
id--)-0(
```
[Try it online!](https://tio.run/##y0gszk7Nyfmfm5iZZ5uZV5JalJhcolKckV@ul6anUZSamGJlFVxSlJmXrmvnmVeiyZVmqxDzPzNFV1dT10Dj/3@Tf8lpOYnpxf91I5wDAgA "Haskell – Try It Online")
Reversed:
```
(0-)--di
```
[Try it online!](https://tio.run/##y0gszk7Nyfmfm5iZZ5uZV5JalJhcolKckV@ul6anUZSamGJlFVxSlJmXrmvnmVeiyZVmqxDzX8NAV1NXNyXz/3@Tf8lpOYnpxf91I5wDAgA "Haskell – Try It Online")
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), 48 bytes
```
S S S N
S N
S T N
T   T   T   T   T   T   N
S T N
N
N
T   S N
T   N
S S T   N
T   T   S S T   T   T   T   T   N
T   S N
S N
S S S 
```
Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.
Minor modification of [my Whitespace answer for the *I reverse the source code, you negate the output!* challenge](https://codegolf.stackexchange.com/a/192993/52210).
[Try it online](https://tio.run/##K8/ILEktLkhMTv3/X0FBgQsIObk4wQDE4uLiVOACssCCQBIszglWpqDw/7@hAQA) or [try it online reversed](https://tio.run/##K8/ILEktLkhMTv3/X0FBgQsIObk4QUBBgRPIAgpxgoS4gEyIOEgQpExB4f9/QwMA) (with raw spaces, tabs and new-lines only).
**Explanation:**
Utilizing the *Exit Program* builtin being a short palindrome `NNN`.  
The regular program will:
```
SSSN   # Push 0 to the stack
SNS    # Duplicate it
TNTT   # Read STDIN as integer, and store it at heap address 0
TTT    # Retrieve the input from heap address 0, and push it to the stack
TNST   # Pop and print the top of the stack as number
NNN    # Exit the program, making everything after it no-ops
```
The reverse program will:
```
SSSN   # Push 0 to the stack
SNS    # Duplicate it
TNTT   # Read STDIN as integer, and store it at heap address 0
TTT    # Retrieve the input from heap address 0, and push it to the stack
SSTTN  # Push -1 to the stack
TSSN   # Multiply the top two values on the stack together
TNST   # Pop and print the top of the stack as number
NNN    # Exit the program, making everything after it no-ops
```
Small additional explanation of pushing a number:
* First `S`: Enable Stack Manipulation
* Second `S`: Push a number to the stack
* `S` or `T`: Positive/negative respectively
* Some `S`/`T` followed by a trailing `N`: number in binary, where `S=0` and `T=1`
I.e. `SSTTSTSN` pushes `-10`. For the `0` we don't need an explicit `S=0`, so simply `SSSN` or `SSTN` is enough.
[Answer]
# [R](https://www.r-project.org/), 23 bytes
I decided to give it a go without the comment trick.
### Forward
```
`+`=scan;""+-0;nacs=`+`
```
[Try it online!](https://tio.run/##K/r/P0E7wbY4OTHPWklJW9fAOi8xudgWKPbf9P9/AA "R – Try It Online")
### Reverse
```
`+`=scan;0-+"";nacs=`+`
```
[Try it online!](https://tio.run/##K/r/P0E7wbY4OTHP2kBXW0nJOi8xudgWKPbf9P9/AA "R – Try It Online")
In the forward version `+` is acting a binary operator, and `-` is a unary operator.
In the reverse the `+` becomes unary and the `-` is binary. So scan function takes the arguments: `file=""` which means stdin and `what=0`, which are also defaults. So when the `+` is unary the first argument is on the right, when it is binary the first argument is on the left.
The 
```
;nacs=`+`
```
part of the code does nothing really useful, so in a sense my code is not really very much more valid than using the comment trick.
[Answer]
# [C (clang)](http://clang.llvm.org/), 23 bytes
```
f(*x){}//};x*-=x*{)x*(g
```
[Try it online!](https://tio.run/##fYrLCoAgEEX3fsUQFOOQuA7xT9qIoQQlES0GxG@3F23bnXvO9covLsVaAxLLXLQuhklZpiyZMNb4eGKriE0RYk4HrG5OKLMAuBfbYTAXAwTsWL647VcKgE07janpPx1/H6We "C (clang) – Try It Online")
[Answer]
# [Labyrinth](https://github.com/m-ender/labyrinth) / [Hexagony](https://github.com/m-ender/hexagony), 6 bytes
Labyrinth:
```
?!@!`?
```
**[Try it online!](https://tio.run/##y0lMqizKzCvJ@P/fXtFBMcH@/39dUwA "Labyrinth – Try It Online")** and [its reverse](https://tio.run/##y0lMqizKzCvJ@P/fPkHRQdH@/39dUwA "Labyrinth – Try It Online").
Hexagony:
```
?!@!~?
```
**[Try it online!](https://tio.run/##y0itSEzPz6v8/99e0UGxzv7/f11TAA "Hexagony – Try It Online")** and [its reverse](https://tio.run/##y0itSEzPz6v8/9@@TtFB0f7/f11TAA "Hexagony – Try It Online").
### How?
```
?       - take a signed integer
(` / ~) - negate
!       - output top-of-stack / current-memory-edge
@       - exit
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg) / Raku, 3 bytes
```
*-0
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJKmYPtfS9fgvzUXF5Crlq5gq2Cgq8UF5BYngqQ1jDStwcx0BSNrmJgpXMzU@j8A "Perl 6 – Try It Online")
Creates a Whatever code block. Read in normally its standard block equivalent is `-> \x {x - 0}`, but in reverse it becomes `-> \x {0 - x}`. 
[Answer]
# [Python 3](https://docs.python.org/3/), 22 bytes
```
lambda x:x#x-:x adbmal
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaHCqkK5QteqQiExJSk3Med/QVFmXolGmoalpuZ/AA "Python 3 – Try It Online")
A lambda which implements the identity function (or negation)
[Answer]
# [MarioLANG](https://github.com/tomsmeding/MarioLANG), 22 bytes
```
;:
=#
:)!
--
<(
"
[>
;
```
[Try it online!](https://tio.run/##y00syszPScxL///f2orLVpnLSlORS1eXy0aDS4kr2o7L@v9/QwMA "MarioLANG – Try It Online")
He just inputs and outputs the number before he falls to EOF
reversed:
```
;
>[
"
(<
--
!):
#=
:;
```
[Try it online!](https://tio.run/##y00syszPScxL///fmssumkuJS8OGS1eXS1HTikvZlsvK@v9/QwMA "MarioLANG – Try It Online")
He loops until the input value is 0 and the output value is -input, the he says the number.
[Answer]
## Haskell, 12 bytes
```
f=id;x-0=x f
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P802M8W6QtfAtkIh7X9uYmaegq1CQVFmXomCikKagul/AA "Haskell – Try It Online") Reverse:
```
f x=0-x;di=f
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02hwtZAt8I6JdM27X9uYmaegq1CQVFmXomCikKagul/AA "Haskell – Try It Online")
Not as short as [Ørjan Johansen's answer](https://codegolf.stackexchange.com/a/193054/34531), but without comments.
[Answer]
# Perl 5 (`-p`), ~~7~~ 6 bytes
-1 thanks to @primo
```
$_*=$#
```
[TIO](https://tio.run/##K0gtyjH9/18lXstWRfn/f5N/@QUlmfl5xf91CwA)
A comment doesn't change input
```
#1-=*_$
```
Negate the input
```
$_*=-1#
```
[TIO](https://tio.run/##K0gtyjH9/1/ZUNdWK17l/3@jf/kFJZn5ecX/dQsA)
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 2 bytes
```
_@
```
[Try it online!](https://tio.run/##S0/MTPz/P97h/39TAA "Gaia – Try It Online")
```
_	| implicit push input and negate
 @	| push next input OR push last input (when all inputs have been pushed)
	| implicit print TOS
```
Reversed:
```
@	| push input
 _	| negate
	| implicit print TOS
```
[Answer]
# [Backhand](https://github.com/GuyJoKing/Backhand), ~~6~~ 5 bytes
```
I@-Ov
```
[Try it online!](https://tio.run/##S0pMzs5IzEv5/9/TQde/7P9/QwMA "Backhand – Try It Online") [Try it doubled!](https://tio.run/##S0pMzs5IzEv5/7/MX9fB8/9/QwMA)
Made a little complex due to the nature of the pointer in Backhand. ~~I don't think it's possible to get any shorter~~ haha, turns out I was wrong. This duplicates *no* instruction and reuses both the input, output and terminate commands between the two programs. *Now* I think it is optimal, since you need all of the `IO-@` commands to work, and in a 4 byte program you can only execute two of those commands.
### Explanation:
The pointer in Backhand moves at three cells a tick and bounces off the boundaries of the cell, which means the general logic is overlapping. However you can manipulate this speed with the `v` and `^` commands.
The original program executes the instructions `IO-@`, which is input as number, output as number, subtract, terminate. Obviously the subtract is superfluous. In the code these are:
```
I@-Ov
^  ^    Reflect
  ^     Reflect again
 ^
```
The reversed program executes `v-I-vO-@`. The `v` reduces the pointer steps between ticks, and the `-` subtracts from the bottom of the stack, which is implicitly zero. The extra `-` commands do nothing. The program executes like
```
vO-@I
v       Reduce pointer speed to 2
  -     Subtract zero from zero
    I   Get input as number and reflect off boundary
  -     Subtract input from zero
v       Reduce pointer speed to 1
 O      Output as number
  -     Subtract zero from zero
   @    Terminate
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 7 bytes
```
#)]}{[(
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/X1kztrY6WuP/f2MA "Brain-Flak – Try It Online")
Reversed:
```
([{}])#
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/XyO6ujZWU/n/f2MA "Brain-Flak – Try It Online")
Note: Only works in interpreters that support comments (e.g. works in Rain-Flak, but not in BrainHack) 
---
If we also swap opening/closing brackets instead of just reversing the bytes we can do this in 8 bytes without using comments:
```
({}[{}])
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/X6O6Nrq6Nlbz/39jAA "Brain-Flak – Try It Online")  
[Try it reversed!](https://tio.run/##SypKzMzTTctJzP7/XyO6uja2ulbz/39jAA "Brain-Flak – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 14 bytes
```
scan()#)(nacs-
```
[Try it online!](https://tio.run/##K/r/vzg5MU9DU1lTIy8xuVj3v@n//wA "R – Try It Online")
A full program that reads a number, or reads and negates a number. The reverse functionality is protected by an inline comment
[Answer]
# [Python 3](https://docs.python.org/3/), ~~22~~ 14 bytes
```
int#__bus__. 0
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPzOvRDk@Pqm0OD5eT8Hgf0ERUEAjTcNYU/M/AA "Python 3 – Try It Online")
Uses the `int` class's constructor and a built-in pseudo-private method.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 9 bytes
```
1&0+#-0&1
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2ar9N9QzUBbWddAzfC/EldAUWZeSbSyrl11SL5rRUFRanFxZn5edFqsg7IOikhwCVBlelBqWWpRcaoDSL42Vk3fISgxLz3VwdDgPwA "Wolfram Language (Mathematica) – Try It Online")
Forward: read `((1)&*0+#-0)&*1`=`#&`
Backward: read `((1)&*0-#+0)&*1`=`-#&`
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~13~~ 3 bytes
```
-∘0
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////3/ao7YJuo86ZhhwpQNZBkCW7v80BUOudAVDAA "APL (Dyalog Unicode) – Try It Online")
Trivial answer. Returns `arg` or `¯arg`.
Saved 10 bytes by not being dumb (thanks Adám).
Altered the resulting 3-byter to a more fitting function.
[Answer]
# Batch, 34 bytes
```
@ECHO.%1 2>MER@
@REM>2 1%=-aa/TES@
```
Echoes (`ECHO.`) the input (`%1`). The rest of the first line technically redirects `STDERR` to a file called `MER@`, but this isn't impactful.  
Second line is commented out (`REM...`).
### Reversed
```
@SET/aa-=%1 2>MER@
@REM>2 1%.OHCE@
```
Uses the arithmetic mode of the set command (`SET /a`) to subtract (`-=`) the input (`%1`) from an undefined variable (`a`) which is equivalent to `0 - input`. Again, the rest of the first line technically redirects `STDERR` to a file called `MER@`, but this isn't impactful.  
Second line is commented out (`REM...`).
[Answer]
## Excel VBA, 12
```
?[A1]']1A[-?
```
Reversed:
```
?-[A1]']1A[?
```
Input is cell A1 of the ActiveSheet. Comments still work in the Immediate Window :)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
(I
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fU@P/f1MA)
[Reversed](https://tio.run/##yy9OTMpM/f/fU@P/f1MA)
```
(    negates nothing
  I  pushes input
I    pushes input
  (  negates input
```
[Answer]
# [Befunge-98 (FBBI)](https://github.com/catseye/FBBI), 6 bytes
```
&[[email protected]](/cdn-cgi/l/email-protection)&
```
[Try it online!](https://tio.run/##S0pNK81LT9W1tPj/X03PQU9X7f9/QwMA "Befunge-98 (FBBI) – Try It Online") [Try it reversed!](https://tio.run/##S0pNK81LT9W1tPj/X01Xz0FP7f9/QwMA "Befunge-98 (FBBI) – Try It Online")
[Answer]
# [Klein](https://github.com/Wheatwizard/Klein), 2 bytes
*Works in all 12 topologies!*
```
@-
```
[Try it online!](https://tio.run/##y85Jzcz7/99B9////wYGBv8NAQ "Klein – Try It Online")
# Reverse
```
-@
```
[Try it online!](https://tio.run/##y85Jzcz7/1/X4f///wYGBv8NAQ "Klein – Try It Online")
`-` negates the input and `@` ends the program
[Answer]
# [Turing Machine Language](http://morphett.info/turing/turing.html), 39 bytes
[The Positive](http://morphett.info/turing/turing.html?3fbc2a79501a4424cbbb52ae008e684f)
```
1 r - _ 0
0 l * * 0
0 - _ l 0
0 _ _ r 0
```
[The Negative](http://morphett.info/turing/turing.html?2742e8faf2421c7f508801f64b69090b)
```
0 r _ _ 0
0 l _ - 0
0 * * l 0
0 _ - r 1
```
This one was a bit trickier than I thought, mostly because I had to get past my prejudices of having code that runs with 'compile' errors.
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~5~~ 4 bytes
```
n-r0
```
uses stack initialisation with the `-v` option, put your input variable there.
[Try it online!](https://tio.run/##S8sszvj/P09L19Dg////umUKhgYA)
[Or try the reversal](https://tio.run/##S8sszvj/38BQVyvv////umUKuoYA)
**Explanation**
```
n       Prints whatever is on the stack as a number
 -      Subtract the top 2 elements on the stack.
        There aren't 2 elements, so it crashes.
  r0    Never gets executed
or reversed:
0       Push a 0 onto the stack
 r      reverse the stack (now 0, -v)
  -     Subtract top 2 elements and push result (0-v, ie negated)
   n    Print as number
        The code wraps around and executes again. 
        It crashes on the - as there is only one
        item on the stack: 0.
```
[Answer]
## [Stack Cats](https://github.com/m-ender/stackcats) `-mn`, 2 bytes
```
-X
```
[Try it online!](https://tio.run/##Ky5JTM5OTiwp/v9fN@L/f9P/url5AA "Stack Cats – Try It Online")
[Try the reverse!](https://tio.run/##Ky5JTM5OTiwp/v8/Qvf/f9P/url5AA "Stack Cats – Try It Online")
### Explanation
Turns out this is actually a lot easier than the previous challenge in Stack Cats. The full program (after applying `-m`) here is `-X-`. `X` is used to swap the stacks left and right of the tape head, i.e. it doesn't affect the initial stack at all, so we can ignore it. But then the program is effectively just `--` (negate the top of the stack twice), which does nothing.
For the inverse program, applying `-m` gives `X-X`. Again, `X` does nothing, so the program is effectively just `-`, which negates the top of the stack.
The only other 2-byte solution is `-=`, but it's virtually the same. The only difference is that `=` swaps only the tops of the adjacent stacks, not the entire stacks.
But again, using `-m` feels a bit like cheating, so below is a solution that uses a fully mirrored program.
---
## [Stack Cats](https://github.com/m-ender/stackcats) `-n`, 7 bytes
```
:I<->I:
```
[Try it online!](https://tio.run/##Ky5JTM5OTiwp/v/fytNG187TCkxzAYl4rhoQqwbECgGxgET8f13D/7p5AA "Stack Cats – Try It Online")
[Try the reverse!](https://tio.run/##Ky5JTM5OTiwp/v/fytNO18bTCkjb6HIBiXiuGhCrBsQKAbGARPx/XcP/unkA "Stack Cats – Try It Online")
### Explanation
The considerations [from the previous answer still apply](https://codegolf.stackexchange.com/a/193215/8478): any valid solution needs to use the paired characters and `I`. The six possible solutions (included in the TIO link) are all virtually the same. `-` and `_` are equivalent in this program, and `:` can be replaced by `|` or `T` (which do the same for non-zero inputs and coincidentally also work for zero inputs). I've just picked this one to explain because it's easiest.
So remember that the initial stack holds the input on top of a `-1` (on top of infinitely many zeros) whereas all the other stacks along the tape only hold zeros. Stack Cats also has the property that any even-length program does nothing (provided it terminates, but we can't use loops for this challenge anyway). The same is then obviously true for any odd-length program whose centre character does nothing... let's see:
```
:    Swap the input with the -1 below.
I    Move the -1 one stack to the left and turn it into +1.
<    Move another stack left (without taking the value).
-    Negate the zero on top of that stack (i.e. do nothing).
```
Therefore, the second half of the program exactly undoes the first half and we end up with the input on top of a `-1` again.
The inverse program is `:I>-<I:`. Let's see how that changes things:
```
:    Swap the input with the -1 below.
I    Move the -1 one stack to the left and turn it into +1.
>    Move one stack right, i.e. back onto the initial stack which still holds the input.
-    Negate the input.
<    Move back to the left where we've parked the 1.
I    Move that 1 back onto the initial stack and turn it back into a -1.
:    Swap the -1 below the negated input to act as an EOF marker.
```
]