Determining integer, letter, integer from assembly code

27 views Asked by At

I have a task where with the assembly code below, I need to find an input which consists of three values in the following order separated by spaces: an integer (within the range of 0 to 7), a character(letter) and another integer, for example 3 z 44. I've been at this for a long time and the most I could get on my own is the letter "s" and the number 16, and both of these I am unsure of. I would really appreciate any help if someone can find maybe the last integer for me, or at least show me where to look. For more information, essentially the code is in need of a specific input, and if the input is correct, it will say so and the function will end, otherwise it will go to a different function called explode_bomb, where it will say that the input is wrong and I have to start over.

0000000000001b8d <phase_3>:
1b8d:       f3 0f 1e fa             endbr64 
1b91:       55                      push   %rbp
1b92:       48 89 e5                mov    %rsp,%rbp
1b95:       53                      push   %rbx
1b96:       48 83 ec 38             sub    $0x38,%rsp
1b9a:       48 89 7d c8             mov    %rdi,-0x38(%rbp)
1b9e:       64 48 8b 04 25 28 00    mov    %fs:0x28,%rax
1ba5:       00 00 
1ba7:       48 89 45 e8             mov    %rax,-0x18(%rbp)
1bab:       31 c0                   xor    %eax,%eax
1bad:       48 8d 75 dc             lea    -0x24(%rbp),%rsi
1bb1:       48 8d 4d d6             lea    -0x2a(%rbp),%rcx
1bb5:       48 8d 55 d8             lea    -0x28(%rbp),%rdx
1bb9:       48 8b 45 c8             mov    -0x38(%rbp),%rax
1bbd:       49 89 f0                mov    %rsi,%r8
1bc0:       48 8d 35 c6 17 00 00    lea    0x17c6(%rip),%rsi        # 338d <_IO_stdin_used+0x38d>
1bc7:       48 89 c7                mov    %rax,%rdi
1bca:       b8 00 00 00 00          mov    $0x0,%eax
1bcf:       e8 fc f6 ff ff          call   12d0 <__isoc99_sscanf@plt>
1bd4:       83 f8 02                cmp    $0x2,%eax
1bd7:       7f 0a                   jg     1be3 <phase_3+0x56>
1bd9:       b8 00 00 00 00          mov    $0x0,%eax
1bde:       e8 36 fa ff ff          call   1619 <explode_bomb>
1be3:       8b 05 07 37 00 00       mov    0x3707(%rip),%eax        # 52f0 <sId>
1be9:       be 05 00 00 00          mov    $0x5,%esi
1bee:       89 c7                   mov    %eax,%edi
1bf0:       e8 54 f8 ff ff          call   1449 <trunc_num>
1bf5:       89 c3                   mov    %eax,%ebx
1bf7:       8b 05 f3 36 00 00       mov    0x36f3(%rip),%eax        # 52f0 <sId>
1bfd:       be 05 00 00 00          mov    $0x5,%esi
1c02:       89 c7                   mov    %eax,%edi
1c04:       e8 40 f8 ff ff          call   1449 <trunc_num>
1c09:       0f af c3                imul   %ebx,%eax
1c0c:       48 63 d0                movslq %eax,%rdx
1c0f:       48 69 d2 56 55 55 55    imul   $0x55555556,%rdx,%rdx
1c16:       48 c1 ea 20             shr    $0x20,%rdx
1c1a:       c1 f8 1f                sar    $0x1f,%eax
1c1d:       89 c1                   mov    %eax,%ecx
1c1f:       89 d0                   mov    %edx,%eax
1c21:       29 c8                   sub    %ecx,%eax
1c23:       89 c7                   mov    %eax,%edi
1c25:       e8 93 f8 ff ff          call   14bd <getLastTwoDigits>
1c2a:       8b 55 d8                mov    -0x28(%rbp),%edx
1c2d:       01 d0                   add    %edx,%eax
1c2f:       89 45 e0                mov    %eax,-0x20(%rbp)
1c32:       8b 45 d8                mov    -0x28(%rbp),%eax
1c35:       89 45 e4                mov    %eax,-0x1c(%rbp)
1c38:       8b 45 d8                mov    -0x28(%rbp),%eax
1c3b:       83 f8 07                cmp    $0x7,%eax
1c3e:       0f 87 4f 01 00 00       ja     1d93 <phase_3+0x206>
1c44:       89 c0                   mov    %eax,%eax
1c46:       48 8d 14 85 00 00 00    lea    0x0(,%rax,4),%rdx
1c4d:       00 
1c4e:       48 8d 05 43 17 00 00    lea    0x1743(%rip),%rax        # 3398 <_IO_stdin_used+0x398>
1c55:       8b 04 02                mov    (%rdx,%rax,1),%eax
1c58:       48 98                   cltq   
1c5a:       48 8d 15 37 17 00 00    lea    0x1737(%rip),%rdx        # 3398 <_IO_stdin_used+0x398>
1c61:       48 01 d0                add    %rdx,%rax
1c64:       3e ff e0                notrack jmp *%rax
1c67:       c6 45 d7 63             movb   $0x63,-0x29(%rbp)
1c6b:       8b 45 dc                mov    -0x24(%rbp),%eax
1c6e:       39 45 e0                cmp    %eax,-0x20(%rbp)
1c71:       75 09                   jne    1c7c <phase_3+0xef>
1c73:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1c77:       38 45 d7                cmp    %al,-0x29(%rbp)
1c7a:       74 0a                   je     1c86 <phase_3+0xf9>
1c7c:       b8 00 00 00 00          mov    $0x0,%eax
1c81:       e8 93 f9 ff ff          call   1619 <explode_bomb>
1c86:       8b 45 e4                mov    -0x1c(%rbp),%eax
1c89:       e9 12 01 00 00          jmp    1da0 <phase_3+0x213>
1c8e:       c6 45 d7 66             movb   $0x66,-0x29(%rbp)
1c92:       8b 45 dc                mov    -0x24(%rbp),%eax
1c95:       39 45 e0                cmp    %eax,-0x20(%rbp)
1c98:       75 09                   jne    1ca3 <phase_3+0x116>
1c9a:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1c9e:       38 45 d7                cmp    %al,-0x29(%rbp)
1ca1:       74 0a                   je     1cad <phase_3+0x120>
1ca3:       b8 00 00 00 00          mov    $0x0,%eax
1ca8:       e8 6c f9 ff ff          call   1619 <explode_bomb>
1cad:       8b 45 e4                mov    -0x1c(%rbp),%eax
1cb0:       e9 eb 00 00 00          jmp    1da0 <phase_3+0x213>
1cb5:       c6 45 d7 71             movb   $0x71,-0x29(%rbp)
1cb9:       8b 45 dc                mov    -0x24(%rbp),%eax
1cbc:       39 45 e0                cmp    %eax,-0x20(%rbp)
1cbf:       75 09                   jne    1cca <phase_3+0x13d>
1cc1:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1cc5:       38 45 d7                cmp    %al,-0x29(%rbp)
1cc8:       74 0a                   je     1cd4 <phase_3+0x147>
1cca:       b8 00 00 00 00          mov    $0x0,%eax
1ccf:       e8 45 f9 ff ff          call   1619 <explode_bomb>
1cd4:       8b 45 e4                mov    -0x1c(%rbp),%eax
1cd7:       e9 c4 00 00 00          jmp    1da0 <phase_3+0x213>
1cdc:       c6 45 d7 69             movb   $0x69,-0x29(%rbp)
1ce0:       8b 45 dc                mov    -0x24(%rbp),%eax
1ce3:       39 45 e0                cmp    %eax,-0x20(%rbp)
1ce6:       75 09                   jne    1cf1 <phase_3+0x164>
1ce8:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1cec:       38 45 d7                cmp    %al,-0x29(%rbp)
1cef:       74 0a                   je     1cfb <phase_3+0x16e>
1cf1:       b8 00 00 00 00          mov    $0x0,%eax
1cf6:       e8 1e f9 ff ff          call   1619 <explode_bomb>
1cfb:       8b 45 e4                mov    -0x1c(%rbp),%eax
1cfe:       e9 9d 00 00 00          jmp    1da0 <phase_3+0x213>
1d03:       c6 45 d7 68             movb   $0x68,-0x29(%rbp)
1d07:       8b 45 dc                mov    -0x24(%rbp),%eax
1d0a:       39 45 e0                cmp    %eax,-0x20(%rbp)
1d0d:       75 09                   jne    1d18 <phase_3+0x18b>
1d0f:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1d13:       38 45 d7                cmp    %al,-0x29(%rbp)
1d16:       74 0a                   je     1d22 <phase_3+0x195>
1d18:       b8 00 00 00 00          mov    $0x0,%eax
1d1d:       e8 f7 f8 ff ff          call   1619 <explode_bomb>
1d22:       8b 45 e4                mov    -0x1c(%rbp),%eax
1d25:       eb 79                   jmp    1da0 <phase_3+0x213>
1d27:       c6 45 d7 62             movb   $0x62,-0x29(%rbp)
1d2b:       8b 45 dc                mov    -0x24(%rbp),%eax
1d2e:       39 45 e0                cmp    %eax,-0x20(%rbp)
1d31:       75 09                   jne    1d3c <phase_3+0x1af>
1d33:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1d37:       38 45 d7                cmp    %al,-0x29(%rbp)
1d3a:       74 0a                   je     1d46 <phase_3+0x1b9>
1d3c:       b8 00 00 00 00          mov    $0x0,%eax
1d41:       e8 d3 f8 ff ff          call   1619 <explode_bomb>
1d46:       8b 45 e4                mov    -0x1c(%rbp),%eax
1d49:       eb 55                   jmp    1da0 <phase_3+0x213>
1d4b:       c6 45 d7 63             movb   $0x63,-0x29(%rbp)
1d4f:       8b 45 dc                mov    -0x24(%rbp),%eax
1d52:       39 45 e0                cmp    %eax,-0x20(%rbp)
1d55:       75 09                   jne    1d60 <phase_3+0x1d3>
1d57:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1d5b:       38 45 d7                cmp    %al,-0x29(%rbp)
1d5e:       74 0a                   je     1d6a <phase_3+0x1dd>
1d60:       b8 00 00 00 00          mov    $0x0,%eax
1d65:       e8 af f8 ff ff          call   1619 <explode_bomb>
1d6a:       8b 45 e4                mov    -0x1c(%rbp),%eax
1d6d:       eb 31                   jmp    1da0 <phase_3+0x213>
1d6f:       c6 45 d7 6a             movb   $0x6a,-0x29(%rbp)
1d73:       8b 45 dc                mov    -0x24(%rbp),%eax
1d76:       39 45 e0                cmp    %eax,-0x20(%rbp)
1d79:       75 09                   jne    1d84 <phase_3+0x1f7>
1d7b:       0f b6 45 d6             movzbl -0x2a(%rbp),%eax
1d7f:       38 45 d7                cmp    %al,-0x29(%rbp)
1d82:       74 0a                   je     1d8e <phase_3+0x201>
1d84:       b8 00 00 00 00          mov    $0x0,%eax
1d89:       e8 8b f8 ff ff          call   1619 <explode_bomb>
1d8e:       8b 45 e4                mov    -0x1c(%rbp),%eax
1d91:       eb 0d                   jmp    1da0 <phase_3+0x213>
1d93:       b8 00 00 00 00          mov    $0x0,%eax
1d98:       e8 7c f8 ff ff          call   1619 <explode_bomb>
1d9d:       8b 45 e4                mov    -0x1c(%rbp),%eax
1da0:       48 8b 55 e8             mov    -0x18(%rbp),%rdx
1da4:       64 48 2b 14 25 28 00    sub    %fs:0x28,%rdx
1dab:       00 00 
1dad:       74 05                   je     1db4 <phase_3+0x227>
1daf:       e8 6c f4 ff ff          call   1220 <__stack_chk_fail@plt>
1db4:       48 8b 5d f8             mov    -0x8(%rbp),%rbx
1db8:       c9                      leave  
1db9:       c3                      ret   
0

There are 0 answers