Question about loading parameters for Multiplication function in Assembly

2a2e: 80 90 8a 02 lds r8, 0x028A
2a32: 90 90 8b 02 lds r9, 0x028B
2a36: a0 90 8c 02 lds r10, 0x028C
2a3a: b0 90 8d 02 lds r11, 0x028D
2a3e: c0 90 86 02 lds r12, 0x0286
2a42: d0 90 87 02 lds r13, 0x0287
2a46: e0 90 88 02 lds r14, 0x0288
2a4a: f0 90 89 02 lds r15, 0x0289
2a4e: c8 14 cp r12, r8
2a50: d9 04 cpc r13, r9
2a52: ea 04 cpc r14, r10
2a54: fb 04 cpc r15, r11
2a56: 64 f5 brge .+88 ; 0x2ab0
2a58: c7 01 movw r24, r14
2a5a: b6 01 movw r22, r12
2a5c: 0e 94 14 22 call 0x4428 ; 0x4428 <__floatsisf>
2a60: 2f e6 ldi r18, 0x6F ; 111
2a62: 32 e1 ldi r19, 0x12 ; 18
2a64: 43 e8 ldi r20, 0x83 ; 131
2a66: 5a e3 ldi r21, 0x3A ; 58
2a68: 0e 94 a0 22 call 0x4540 ; 0x4540 <__mulsf3>
2a6c: 6b 01 movw r12, r22
2a6e: 7c 01 movw r14, r24
2a70: c5 01 movw r24, r10
2a72: b4 01 movw r22, r8
2a74: 0e 94 14 22 call 0x4428 ; 0x4428 <__floatsisf>
2a78: 2f e6 ldi r18, 0x6F ; 111
2a7a: 32 e1 ldi r19, 0x12 ; 18
2a7c: 43 e8 ldi r20, 0x83 ; 131
2a7e: 5a e3 ldi r21, 0x3A ; 58
2a80: 0e 94 a0 22 call 0x4540 ; 0x4540 <__mulsf3>
2a84: 9b 01 movw r18, r22
2a86: ac 01 movw r20, r24
2a88: c7 01 movw r24, r14
2a8a: b6 01 movw r22, r12
2a8c: 0e 94 79 21 call 0x42f2 ; 0x42f2 <__divsf3>

I am trying to reverse engineer a piece of code and I am stuck on the multiplication call. Starting on line 2A60, a 32 bit number is loaded into the registers. I am trying to figure out what that number represents and what is being multiplied by what. I am used to the format where this piece of code represents loading 7000:

343e: 68 e5 ldi r22, 0x58 ; 88
3440: 7b e1 ldi r23, 0x1B ; 27
3442: 80 e0 ldi r24, 0x00 ; 0
3444: 90 e0 ldi r25, 0x00 ; 0

However it doesn’t seem correct that on line 2A60, there’s a multiplication by 981668463. Does anyone know how to read this?

asdf123: I am trying to reverse engineer a piece of code...

That is available as source code. Which may make what you are doing a fool's errand.

https://www.google.com/search?q=download+avr+libc

@[quote author=Coding Badly link=msg=3040308 date=1481571804] That is available as source code. Which may make what you are doing a fool's errand.

https://www.google.com/search?q=download+avr+libc

[/quote]

The full code is much longer than this. What I posted was simply a segment of the code

asdf123: @ The full code is much longer than this. What I posted was simply a segment of the code

That just proves CodingBadly's point lol

@Power_Broker

I guess I must be missing the point of his comment then.

What I am trying to do is take an avr -objdump output of an arduino hex file and try to understand the basis behind what the code does. Perhaps it is my fault for being a bit vague on my end goal, but I do not quite see how @Coding Badly 's post helps me with that

Working backwards from uncommented hex is very difficult. Do you have access to the C or C++ code that the hex was created from?

What is the code doing at this point? Is it square-root by some chance, or a different power function?

A floating point value being multiplied by an apparently arbitrary integer just screams of the inverse square root optimization from Quake.

EDIT: Never mind, that has subtraction so I'm probably wrong.

CrossRoads:
Working backwards from uncommented hex is very difficult. Do you have access to the C or C++ code that the hex was created from?

Unfortunately I do not have any access to the source code so at this point I feel like I have no other option than to try and break it down the hard way.

Does your code use the constant 0.001 anywhere? That is the number that 0x3a83126f represents when it is interpreted as a single-precision IEEE-754 floating point number.

You could look into disassemblers as well. https://www.google.com/?gws_rd=ssl#q=avr+disassembler

asdf123: Unfortunately I do not have any access to the source code...

Wrong.

Four clicks. That's all. Just four mouse clicks separate you from the complete Libc source code.

Or, if you follow a different path. Two clicks. Just two clicks separate you from the complete Libc source code.

Jiggy-Ninja: Does your code use the constant 0.001 anywhere? That is the number that 0x3a83126f represents when it is interpreted as a single-precision IEEE-754 floating point number.

Yes, I now believe that is what the code is doing. Any other value seems nonsensical to me.

CrossRoads: You could look into disassemblers as well. https://www.google.com/?gws_rd=ssl#q=avr+disassembler

I have looked at a couple disassemblers online, however I haven't found any free versions that support the Arduino Mega processor

[quote author=Coding Badly link=msg=3040382 date=1481575574] Wrong.

Four clicks. That's all. Just four mouse clicks separate you from the complete Libc source code.

Or, if you follow a different path. Two clicks. Just two clicks separate you from the complete Libc source code. [/quote]

Would you be able to explain in more detail what you mean? I have been given this program on a USB with only the hex file of the code. Is there some way of retrieving the source code from that?

Did you try this one?
https://www.onlinedisassembler.com/odaweb/

Altho, maybe decompiler might be better.

CrossRoads: Did you try this one? https://www.onlinedisassembler.com/odaweb/

Altho, maybe decompiler might be better.

I used the .hex file to create a .dmp file using avr- objdump so I do not believe a disassembler is what I need. I agree that a decompiler would be what I need.

Maybe this one, Boomerang http://boomerang.sourceforge.net/

asdf123: Would you be able to explain in more detail what you mean?

I apologize. I misunderstood what you are trying to do. Good luck with your project.

CrossRoads: Maybe this one, Boomerang http://boomerang.sourceforge.net/

Have you used boomerang before? I have downloaded the application and am trying to use it. I can specify the input file and where the output file should go but how do I start the decompilation process? The readme.txt does not seem to tell me what to do nor could I find some instructions online. Am quite confused.

It seems to be that my problem running it is that .hex files are not supported